Commit Graph

17 Commits

Author SHA1 Message Date
Martijn Pieters
3455bf3ae6 Allow sparse profiles to contain comments
Summary: Sometimes you want to be able to justify why a line is in a sparse profile. Support empty lines and comments (starting with a hash).

Test Plan: Run the test runner

Reviewers: #mercurial, rmcelroy, durham

Reviewed By: durham

Differential Revision: https://phabricator.intern.facebook.com/D4537617

Tasks: 15993301

Signature: t1:4537617:1486687441:18a00b65df244b573bab095809fb1fbb57e21d71
2017-02-13 04:17:51 -08:00
Jun Wu
8a3a99ba21 hgext: move single file extensions to hgext3rd
Summary:
Be a better citizen under system python path.

Fix all tests issues and change setup.py to use glob pattern to include
all extensions.

Test Plan:
Run tests and `make local`.
Also build and install the package and run `hg sl` in major repos.

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3534311

Signature: t1:3534311:1468275426:fe122646c8bd6c541e1889e73e9df28f86747ff2
2016-07-08 13:15:42 +01:00
Martijn Pieters
5b77967854 Backed out changeset 0aa2b8139243
Summary:
The upstream change has now been *properly* landed at
https://selenic.com/repo/hg//rev/6ee50bdeeb32.

Once again, Mea Culpa, yesterday I apparently was in clowntown mode with these
patches.

Test Plan:
Run all affected tests:

  $HGSRC/tests/run-tests.py -l test-pull-createmarkers* test-pushrebase* test-pushvars*

Reviewers: #sourcecontrol, ttung, quark

Reviewed By: quark

Subscribers: mjpieters, durham

Differential Revision: https://phabricator.intern.facebook.com/D3462832

Signature: t1:3462832:1466513182:58d6187c04e0e567a026aba90bf753c76f4949a7

Blame Revision: D3460645
2016-06-21 13:58:55 +01:00
Durham Goode
ec171a5a29 backout: backout e61bd9d5e8ca about file descriptor cache
Summary:
e61bd9d5e8ca requires a change to core that has been accepted but not yet
pushed. This breaks the build, so let's revert it until upstream pushes the
dependency.

Test Plan: Ran the tests

Reviewers: ttung, mjpieters, #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3460645

Signature: t1:3460645:1466465904:cd521a989e475f9987237307a7d4d672d58ba615
2016-06-20 16:38:48 -07:00
Martijn Pieters
08afaea81e Get rid of getfilecache now that it is no longer needed
Summary:
Now that my upstream patch for filedescriptor class access has landed the helper function to bypass the descriptor protocol can go altogether.

Depends on D3454878

Test Plan:
Run affected extension tests:

  $HGSRC/tests/run-tests.py -l test-sqldirstate-* test-reflog* test-sparse*

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3456368
2016-06-20 12:12:32 +01:00
Martijn Pieters
9b160b48c6 Use one function to access the filecache descriptor, and wrapfunction to patch
Summary:
There were 3 clowntowny versions of the wrapfiledescriptor function, 2 being
dangerously wrong about how they scan the class hierarchy. All because
`classobj.descriptorname` invokes the descriptor protocol and the filecache
descriptor is not set up for that access.

Instead of one function to do it all, use one utility function to retrieve
the descriptor object from the class __dict__ to avoid the descriptor protocol
kicking in, and use mercurial.extensions.wrapfunction to do the actual
wrapping.

I've sent a patch upstream to fix accessing the filecache descriptor on the
class; if accepted we can drop the getfilecache utility function altogether,
leaving only the wrapfunction calls.

Test Plan:
Run affected extension tests:

   $HGSRC/tests/run-tests.py -l test-sqldirstate-* test-reflog* test-sparse*

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3454878
2016-06-20 12:12:32 +01:00
Durham Goode
5de24a9709 sparse: update test output with simple change 2016-01-20 13:40:15 -08:00
Laurent Charignon
5ebc03718c cleanup: fix quoting patterns in tests
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.

Test Plan: All tests pass

Reviewers: #sourcecontrol, ttung

Differential Revision: https://phabricator.fb.com/D2811856
2016-01-07 18:30:24 -08:00
Martijn Pieters
383aee4ca3 Turn debug message into warning; not finding a sparse profile affects the user directly
Summary:
When a sparse profile is not found (perhaps because the user used an incomplete
or misspelled path), warn the user that a profile is not found.

There was already a debug message for this, elevate it to a warning.

Test Plan:
Run the tests:

  cd tests
  python run-tests.py test-sparse*.t

Manual test:

  hg init test
  cd test
  cat > .hg/hgrc <<EOF
  [extensions]
  sparse=$(dirname $TESTDIR)/sparse.py
  EOF
  touch testfile
  hg add testfile
  hg ci -m 'initial commit'
  hg sparse --enable-profile foo/bar
  hg sparse --disable-profile foo/bar

and the following warning is printed twice:

  warning: sparse profile 'foo/bar' not found in rev <hash> - ignoring it

Disabling the warning with:

  cat >> .hg/hgrc <<EOF
  [sparse]
  missingwarning=false
  EOF
  hg sparse --enable-profile foo/bar
  hg sparse --disable-profile foo/bar



Reviewers: rmcelroy, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D2668406

Tasks: 8994281

Signature: t1:2668406:1447948981:66d16b94ea7ea682b9e0c3faaccc1a364283364d
2015-11-19 08:47:45 +00:00
Durham Goode
c6514e9383 sparse: fix issue with profile changes and file permission changes
Summary:
There was a bug where if you had a sparse profile and updated across revs that
both A) add file X to the sparse profile, and B) changed the permissions on file
X (ex: to make it executable), the update would fail.

This was caused by the edit permission action being present in the action list
as an 'edit' action, so the profile changing code did not add the 'get' action
that would actually put it on disk.

The fixes is to just add the 'get' action for every file that wasn't previously
in the profile (overwriting any action that had already been computed).

Test Plan: Added a test, and verified it against the reported repro case

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2652793
2015-11-13 10:43:10 -08:00
Christian Delahousse
3bdbe85126 unittest: fixing merge conflict output in tests
Summary:
Some changes in core made the output for merge conflicts change. I just made
certain tests reflect that.

Test Plan: ran the tests

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy

Differential Revision: https://phabricator.fb.com/D2566237

Tasks: 8797924

Signature: t1:2566237:1445456815:d5a1560bd3421de6b9955e44a8dd2698f0462f51
2015-10-21 12:11:44 -07:00
Durham Goode
fa50ce426e sparse: change missing profile warning to be debug
Missing profiles are more common than previously expected (for instance when
reading old commits for a rebase).  Let's move this warning to debug.
2015-06-11 14:39:40 -07:00
Ryan McElroy
949908801c sparse: introduce flag on 'hg add' to update sparse config
Summary:
We want to be able to more seamlessly update sparse profiles when adding files.
This patch adds a `--sparse` flag to `hg add` that ensures the directory of the
added file is included in the sparse profile.

Test Plan: updated test

Reviewers: ttung, durham, #sourcecontrol

Reviewed By: durham, #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2003039

Tasks: 6733090

Signature: t1:2003039:1430327770:295f1ac9960ca9dcb4ce84f76458faad68106272
2015-04-17 14:29:23 -07:00
Durham Goode
933f828bb1 sparse: add temporarily included files when merging
Summary:
Now that we store a list of temporarily include files, and the ability to
clean them up, we now add the logic to add them in the first place. This watches
the actions provided by calculateupdates and adds any missing files to the
sparse checkout temporarily

Mucking with the dirstate and files on disk in the middle of calculateupdates
seems a little risky, but it seems to work.

Test Plan: Added new tests that require bringing in non-sparse changes as part of the merge.  Tests both the merge and rebase scenarios, using both normal checkouts and profiles.

Reviewers: sid0, pyd, lcharignon, rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D1982951

Signature: t1:1982951:1428636508:e5bcf4e6fbd635d49ff1ce7a90e9b5e1378537c9
2015-04-09 17:17:03 -07:00
Durham Goode
2cc36eb05c sparse: fix rebasing new sparse profiles
Summary:
Previously, hg update would fail if your sparse profile was not present in the
destination of the update. This had the affect of preventing users from rebasing
newly created sparse profiles.  Let's allow it (with a warning). This will allow
them to perform the rebase as long as all of the files they've changed exist in
the other sparse rules they have enabled. If they have no others, the sparse
profile will revert to a full checkout.

Test Plan: Added a test

Reviewers: rmcelroy, pyd, lcharignon, sid0

Reviewed By: sid0

Differential Revision: https://phabricator.fb.com/D1967834

Signature: t1:1967834:1428106927:04ef3a91a0f9f57f0a917d3a48e62e5e38341264
2015-04-03 16:45:36 -07:00
Durham Goode
b638332657 Update sparse to match upstream
Upstream Mercurial has changed the return value of merge.calculateupdates in two
ways: 1) actions is now a file->action mapping instead of a
actiontype->list-of-files mapping, 2) it now returns actions, diverge,
renamedelete where the last two are just used for displaying to the user and can
be pretty much ignored by the sparse extension.
2015-01-06 11:38:33 -08:00
Durham Goode
08d5465b17 sparse: add sparse checkout extension
Summary:
Adds a sparse checkout extension that allows you to checkout just part of the
working copy.  This only affects the working copy, it does not affect history,
or what is pushed and pulled from the server.

The basic api is:

hg sparse --include PATTERN...  # add a pattern to the sparse checkout
hg sparse --exclude PATTERN...  # excludes files from the sparse checkout
hg sparse --delete PATTERN...   # deletes an include/exclude rule
hg sparse --enable-profile      # enables a predefined sparse profile
hg sparse --disable-profile     # disables a predefined sparse profile
hg sparse --reset               # makes the repository full again
hg sparse --refresh             # refreshes the working copy if .hg/sparse was
modified manually
hg sparse                       # show the current sparse rules

Test Plan:
Added tests. Ran them. Also deploy it to a couple users for a bit
without major issues.

Reviewers: pyd, sid0, rmcelroy, davidsp, mpm

Subscribers: mitrandir, akushner

Differential Revision: https://phabricator.fb.com/D1698824
2014-12-01 11:02:08 -08:00