Commit Graph

1426 Commits

Author SHA1 Message Date
Stanislau Hlebik
7ebdf0f427 infinitepush: remove some unused options
Summary:
Infinitepush has too many options and many of them are unused or has never
been changed from the default value. Let's remove some of them.

Test Plan: Run infinitepush tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D141
2017-07-20 01:20:59 -07:00
Stanislau Hlebik
214387fb21 infinitepush: re-enable lfs support
Summary:
D17 was reverted because it broke creating bundle for non-general delta repos.
The reason is the following: D17 made infinitepush extension override
changegroup.supportedoutgoingversion() function and discard '01' version.
For non-general delta repositories it resulted in broken `hg bundle ...`
command.
`abort: repository does not support bundle version 01`

This diff fixes it by not overriding supportedoutgoingversion(). Instead
getscratchbranchpart() has its own logic of selecting changegroup version.

Test Plan:
Run unit-test
Run `hg bundle -r . --base .^ somefile` in non-general delta repo,
make sure it works fine.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D81
2017-07-20 01:14:35 -07:00
Felix Merk
782636d475 undo: file corruption handling
Basic file corruption handling: if file is corrupted, we nuke our history.
Downside is that we won't be able to undo furter back in case of a corruption,
but considering corruption this is expected.

Differential Revision: https://phab.mercurial-scm.org/D111
2017-07-19 17:49:21 -07:00
Felix Merk
82603807d7 undo: meaningful obs markers for undos
Makes obs markers for undos more meaningful.  When an undo performs a strict one
to one change, the written obs marker reflects that and the user even gets a
helpful ui message in smartlog.  One to many undos do not support such obs
markers (currently) because we can't tell splits and divergence apart easily.

Differential Revision: https://phab.mercurial-scm.org/D108
2017-07-19 17:49:21 -07:00
Felix Merk
0077b01e13 undo: add --keep to maintian working copy changes
Allow user to keep working copy changes after undo, mimicking unamend and
uncommit behavior.  As discussed at the team lunch, this allows undo to remain
ignorant of what command the user has run while conforming to user expectations.
In the future this could be done in a smarter way where we properly restore hg
status dynamically.

Differential Revision: https://phab.mercurial-scm.org/D55
2017-07-19 17:49:21 -07:00
Felix Merk
b86893cb84 undo: adds -f flag and gap edge case handling
Prevents users from accidentally crossing gaps in their history and adds an
overwride.  In most cases undoing across a gap isn't desired as the connection
between the pre and post states is unkown.  While undoing across a gap is not
destructive or inherently risky, it is inherently confusing to the user since
we don't know how many and what commands where run.  Furthermore, there is no
guarantee that the pre and post states of a gap are actually connected in any
sane way.

Differential Revision: https://phab.mercurial-scm.org/D53
2017-07-19 17:49:21 -07:00
Felix Merk
1fd69b2cab undo: implements relative undo, hg redo and tests
Implements, and makes default relative undos and adds redos.  A relative undo
behaves differently only if you haven't performend any repo changing operations
since your previous undo or redo, in which case you operate relative to that
undo/redo.  This means that a second undo will not undo the previous undo but
instead bring you furter back.

Differential Revision: https://phab.mercurial-scm.org/D52
2017-07-19 17:49:21 -07:00
Felix Merk
683f74bc3b undo: bare bones undo without tests
Adds undo command that changes working copy parent, bookmarks and
visible draft commits to a previous repo state.

Differential Revision: https://phab.mercurial-scm.org/D51
2017-07-19 17:49:21 -07:00
Adam Simpkins
6a5431e1a3 phabstatus: query conduit more efficiently for "hg log"
Summary:
Update the phabstatus code to peek ahead at revisions to be logged by
`hg log` and `hg log --graph` and query phabricator for multiple revisions at
once, rather than having to query them one at a time.

Previously it had special integration with the smartlog where it could do this
for smartlog, but not for the normal "hg log" command.

Wrapping the revset iterator this way feels somewhat hacky, but this seems like
the best way to achieve the desired results without upstream changes.  (In an
ideal world we would perhaps update the log code to process things in an
asynchronous fashion, to better support templates that may take a non-trivial
amount time to render.  Ideally the revset query would be processed in parallel
with template rendering.)

Test Plan:
Confirmed existing tests still pass, and manually tested various combinations
of `hg log`, `hg log --graph` and `hg smartlog`

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D80
2017-07-19 12:34:46 -07:00
Jun Wu
6ed0a1e206 smartlog: only count visible successors
Invisible successors could be confusing. Therefore only show visible
successors.

Differential Revision: https://phab.mercurial-scm.org/D149
2017-07-19 10:43:01 -07:00
Fano Yong
050a2705e7 pushrebase.py modification to skip cache when _data is not found
Summary: pushrebase.py modification to skip cache when _data is not found

Test Plan: hg-dev rt pushrebase*

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mitrandir, medson, mjpieters, #mercurial

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

Tasks: 19603920

Tags: hg

Signature: t1:5367059:1500457213:d9870e1af74a4e27c1be2b08f440dc5e3f905947

Blame Revision: n/a
2017-07-19 09:09:04 -07:00
Ryan McElroy
167a834fdb undo: replace delta with base in test output
Summary:
I haven't tracked down where this change came from, but it looks fairly
benign and straightforward to fix.

Test Plan: The test now passes

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Differential Revision: https://phab.mercurial-scm.org/D147
2017-07-19 07:08:21 -07:00
Ryan McElroy
7cb6b2b906 pushrebase: update test after working copy update change
Summary: D123 failed to update this test as well

Test Plan: Run the test; it now passes

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Differential Revision: https://phab.mercurial-scm.org/D146
2017-07-19 07:08:21 -07:00
Ryan McElroy
f95c4e8f49 drop: fix check-code failures
Summary: These issues broke test-check-code-hg.t

Test Plan: test-check-code-hg.t now passes

Reviewers: #fbhgext, stash, simonfar

Reviewed By: #fbhgext, stash, simonfar

Differential Revision: https://phab.mercurial-scm.org/D145
2017-07-19 07:08:21 -07:00
Ola Kopczynska-Dobosz
379f8596da Adding drop command
Summary: Adding a drop extension which drops specified commit from the stack.

Test Plan: Unit tests which are part of this diff and manual testing.

Reviewers: durham, gshanbhag, #mercurial, kulshrax

Reviewed By: kulshrax

Subscribers: mitrandir, quark, #mercurial, phillco, avig, medson, mjpieters

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

Tasks: 19602078

Signature: t1:5346014:1500438430:b38acce97940fdeb7103ae70844cce71fdd79698
2017-07-18 21:57:03 -07:00
Arun Kulshreshtha
79baca1fcf fbamend: add --clean flag to hg prev/next
Summary: This patch adds a `--clean` flag to `hg prev` and `next` that discards any pending changes, similar to `hg update --clean`.

Test Plan: See included test changes.

Reviewers: #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D140
2017-07-18 20:13:25 -07:00
Jun Wu
0e6e370774 hiddenoverride: avoid race condition updating the state file
Previously there is a race condition:

    origpinned = loadpinnednodes(repo)
    newpinned = ....
    with repo.lock(): # the lock might be taken by process X
        # get the lock after some time. at this time, the state file might
        # be updated by process X but we are not aware of it.
        savepinnednodes(...) # process X's change gets discarded

This patch solves that by making the write function takes a delta instead of
full content, and apply that delta inside a lock. Using repo lock is
expensive so we use a single-file lightweight flock instead.

Differential Revision: https://phab.mercurial-scm.org/D139
2017-07-18 16:07:33 -07:00
Jun Wu
2211d677b5 pushrebase: move working copy parent
When pushing the current changeset like `hg push -r . --to x`, try to update
the working copy parent.

Differential Revision: https://phab.mercurial-scm.org/D123
2017-07-18 12:16:04 -07:00
Durham Goode
18d20087f4 treemanifest: fix historypack corruption bug
Summary:
The history pack writer had a bug where if the same node was added to the
mutablehistorypack N times, it would write out that it had N entries, but then
it would only write a single entry. This caused corruption (the length value
didn't match the actual number of entries) that broke repack.

This primarily affected users who used the old version of treemanifest (where
trees were converted on the client side). The new version of treemanifest only
seems to repro this in rare cases, like when rebasing multiple commits that
create the same trees.

Test Plan: Added a test. It failed before and passes after.

Reviewers: #fbhgext, mitrandir

Reviewed By: #fbhgext, mitrandir

Subscribers: akushner

Differential Revision: https://phab.mercurial-scm.org/D128
2017-07-18 11:30:12 -07:00
Jun Wu
c1a9fbc79e undo: move undolog to vfs and mark as lock-safe
The upstream has added some warning around repo.svfs/vfs write operations
without taking locks. For undo, we don't want to take the repo lock (since
that means read-only operations like `hg log` will be blocked by another
`hg commit`). So undo has its own locking and own transaction (for lower
overhead). Therefore move all files we may write (including lock and
transaction files) to `.hg/undolog` and whitelist the directory at
`localrepository._wlockfreeprefix` to bypass the checks.

Differential Revision: https://phab.mercurial-scm.org/D112
2017-07-18 11:30:05 -07:00
Ryan McElroy
8e7158bec1 obsolete: update tests with new debugobsolete message
Summary:
Upstream change 6ddb2645abf5dced7e8e4612c8cf9d11cbf468f6 made
the debugobsolete command print out the number of changes it obsoleted.

Test Plan: run the tests

Reviewers: #fbhgext, mitrandir

Reviewed By: #fbhgext, mitrandir

Differential Revision: https://phab.mercurial-scm.org/D133
2017-07-18 10:09:28 -07:00
Ryan McElroy
99095f0b2e pushrebase: update test with fixed remotenames output
Summary:
Remotenames no longer emits this devel-warn (once some in-flight
patches are accepted, at least).

Test Plan: run the test

Reviewers: #fbhgext, mitrandir

Reviewed By: #fbhgext, mitrandir

Differential Revision: https://phab.mercurial-scm.org/D132
2017-07-18 10:09:28 -07:00
Ryan McElroy
7a5f7434d2 config: do not pass defaults to registered config items
Summary: This prevents some recently-introduced devel-warnings from breaking the tests.

Test Plan: fewer devel-warns while running tests

Reviewers: #fbhgext, mitrandir

Reviewed By: #fbhgext, mitrandir

Differential Revision: https://phab.mercurial-scm.org/D131
2017-07-18 10:09:28 -07:00
Ryan McElroy
55611588d1 bookmarks: use new applychanges api in all extensions
Summary: This eliminates the recently-added devel-warnings.

Test Plan: fewer `devel-warn`s during tests

Reviewers: #fbhgext, mitrandir

Reviewed By: #fbhgext, mitrandir

Differential Revision: https://phab.mercurial-scm.org/D130
2017-07-18 10:09:28 -07:00
Mark Thomas
9d389170da copytrace: add fast copytracing for amends 2017-07-18 08:52:20 +01:00
Felix Merk
4fdf562a93 undo: improved performance and prep for hg undo
Implements lighttransaction(repo) which improves performance of hg undo and
prevents infinite loops caused by hooks that run true hg commands.  Also adds
_getrevlog and _invertindex commands, factoring out code that will be reused.
Changes output for gaps when typing hg debugundohistory -l for slightly
better ui and clearer testing. Lastly, changes lock from repo lock to new
undolog lock and tests this.  In the future, with some changes to undo.log,
we may be able to take the lock later, bypassing the need to take it for
read-only operations.

Differential Revision: https://phab.mercurial-scm.org/D50
2017-07-17 13:18:54 -07:00
Durham Goode
81db9c874e tests: remove hard coded line from tests
Replace it with a glob
2017-07-17 04:07:27 -07:00
Stanislau Hlebik
196a16380c fastpartialmatch: fix devel.warn
Summary:
Upstream hg recently introduced new developer warning if files inside .hg are
modified without taking a lock. The usual fix is to add file in
localrepository._wlockfreeprefix list, but it doesn't work for "needrebuild"
fastpartialmatch file because it's stored inside .hg/store.
So to get rid of developer warning let's move needrebuild file to .hg/.
And since we are detecting that partial index needs to be rebuilt in revlog class,
I also had to wrap `runcommand()` and create needrebuild file there, because
`runcommand()` has vfs object, while revlog class doesn't.

Test Plan: Run tests

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D99
2017-07-17 04:03:15 -07:00
Durham Goode
bfe9c37568 tests: fix test devel-warning
Summary:
This test writes file to the vfs to indicate a hook is done. We need to tell
Mercurial that this file is ok to write outside a lock.

Test Plan: Test now passes

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D101
2017-07-17 04:02:43 -07:00
Mihails Smolins
9a121651cc remotefilelog: enable background prefetch for pull
Summary:
Previously prefetch on pull ran in foreground. Now it can run in background
if specified. Optionally background prefetch can be followed by background
repack.

Test Plan: Added a test case

Reviewers: simonfar, durham

Reviewed By: simonfar

Subscribers: medson, mjpieters, #mercurial

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

Tasks: 19727343

Signature: t1:5406626:1500059334:207b4100cca536cbe33f6c6dfad596d03a6fa14f
2017-07-17 03:04:22 -07:00
Sen Li
b974a7cf2c adding hg amend --to option so it amends to a specific commit
Summary: adding hg amend --to option so it can amends to a specific commit

Test Plan: will add a test for this

Reviewers: juehui, durham

Reviewed By: durham

Subscribers: medson, mjpieters

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

Signature: t1:5396805:1499986779:d555d75c636e37adbe484b5b77c1844fcacfdc86
2017-07-14 12:06:22 -07:00
Durham Goode
e3a87e44e3 pushrebase: add pack files to storage during hooks
Summary:
Hooks should run with awareness of the tree pack data, so we need to pass the
temporary pack location as part of the hook environment.

Test Plan: Added a test

Reviewers: #fbhgext, simpkins

Reviewed By: #fbhgext, simpkins

Subscribers: simpkins

Differential Revision: https://phab.mercurial-scm.org/D8
2017-07-14 11:47:12 -07:00
Durham Goode
e1b7318640 pushrebase: add config for switching to treemanifest reading
Summary:
Adds functionality and a test for when clients pushes a tree pack to the server
without any flat manifest data, and the server writes the correct flat and tree
manifests during pushrebase.

Test Plan: Added tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Subscribers: phillco, quark, dsp

Differential Revision: https://phab.mercurial-scm.org/D5
2017-07-14 11:47:12 -07:00
Durham Goode
937ee01b7d sparse: fix interaction with treemanifest
Summary:
Treemanifest relies on the matcher visitdir function, which was not implemented
in our special sparse matchers. Long term we should migrate to using the core
sparse extension. For now let's just implement visitdir().

Test Plan: Added a test. Previously the test would throw a big exception.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D84
2017-07-14 11:13:39 -07:00
Durham Goode
dc09e58efc treemanifest: allow using manifest nodes as base nodes during pack fetch
Summary:
When requesting trees from the server, the client sends a list of manifest nodes
it wants and base nodes it has, then the server sends back any parts of the tree
that are in the desired manifests but not in the base nodes. If no base nodes
are sent, then the server tries to pick appropriate base nodes from the list of
manifests being requested.

Previously, when requesting manifest X, it would only try to pick X^ as the base
node (assuming X^ was in the request set). This meant that if you requested X
and X^^, it wouldn't realize they were very similar and instead it would send
the entire X and entire X^^ trees (with lots of duplication).

With this patch, it will always use the previously requested manifest as the
base node for the next manifest, if no base nodes are specified. So requests X
and X^^ will return the minimal set of nodes.

Test Plan: Added a test.  It fails before and passes afterwards

Reviewers: #fbhgext, simpkins

Reviewed By: #fbhgext, simpkins

Differential Revision: https://phab.mercurial-scm.org/D75
2017-07-14 10:34:12 -07:00
Durham Goode
3102e456ab infinitepush: backout lfs fix
Summary: This broke hg bundle on non-generaldelta repositories.

Test Plan: Ran the tests

Reviewers: #fbhgext, stash, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D74
2017-07-13 13:53:40 -07:00
Jun Wu
0b38d6d44e hiddenoverride: unhide permanently by bookmark and working parent
We want these behaviors:

  - Checking out an obsoleted revision makes it visible even if another
    revision was checked out later
  - Putting a bookmark on an obsoleted revision makes it visible even if the
    bookmark was removed later
  - Strip/prune could make them hidden again

This is basically a lightweight version of independent hidden.

Differential Revision: https://phab.mercurial-scm.org/D70
2017-07-13 11:04:56 -07:00
Yan Yan
8e95eaafb0 Let non-existing client fail the import early
Summary: Check if the client exists, and if not, exit the import. Added a test for non-regression.

Test Plan: running test-p4fastimport-import-badclient.t

Reviewers: davidsp

Reviewed By: davidsp

Subscribers: medson, mjpieters

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

Signature: t1:5405340:1499965824:394077f0d148be2e5fef15902c69703eaf360bbb
2017-07-13 10:18:39 -07:00
Adam Simpkins
4dfe0364a6 tests: fix 'if False' statements flagged by check-code
Summary:
The check-code test in the upstream mercurial repository was recently updated
to start complaining about "if False" statements.  Two locations in fb-hgext
had this issue.

These both look to be copy-and-pastes of the same function, unfortunately.
That should probably be cleaned up too, but I'll leave that for a separate diff
for now.

Test Plan: Confirmed the test-check-code test passes now.

Reviewers: #fbhgext, durham, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D71
2017-07-12 21:29:28 -07:00
stash@fb.com
35d988093a infinitepush: handle lfs correctly
Summary:
Make sure that infinitepush work fine with lfs. To achieve it we try to use
changegroup3 if it's available and also run prepush hook before infinitepush.

Test Plan: Run `arc unit`

Reviewers: #fbhgext, quark, dsp

Reviewed By: #fbhgext, dsp

Differential Revision: https://phab.mercurial-scm.org/D17
2017-07-12 09:52:03 -07:00
Durham Goode
79639557a1 datapack: allow 'long' for metadata types
Summary:
Previously the code required that sizes be of type int. Since python plays loose
with integer types, we also need to support long.

Test Plan:
The existing test-remotefilelog-repack-fast.t test was completely
broken. It only enabled fast datapacks for the server repo, not the clients.
Enabling it for the clients as well catches this issue and verifies the fix.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D54
2017-07-11 17:02:15 -07:00
Jun Wu
ce47fb8c56 modcheck: whitelist lz4revlog
Sometimes `test-check-*` were skipped. Upon investigation, it's because
`lz4revlog` was imported and `hg` printed warnings with `modcheck`. So let's
make `lz4revlog` whitelisted.

Differential Revision: https://phab.mercurial-scm.org/D49
2017-07-11 14:42:10 -07:00
Durham Goode
f1ac312e52 tests: enable rebase.singletransaction
Summary:
Upstream rolled back the single transaction rebase by default behavior.
We still want it, so let's enabled it for all our tests.

Test Plan: Ran the tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D47
2017-07-11 13:19:40 -07:00
Durham Goode
fb90f23b77 tests: update to match upstream backup file name change
Summary: Upstream made these changes. Let's follow along.

Test Plan: Ran the tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D46
2017-07-11 13:19:40 -07:00
Mateusz Kwapich
52b1c7b246 tests: add devel-warning to remotenames output
Summary: Will be tehre until remotenames are fixed

Reviewers: quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D45
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
fa73f071b8 tests: one new temaplate in the tests message
Summary:

Reviewers: quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D44
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
0a6fd21b21 tests: add messages about new obsoleted changestes
Summary:

Reviewers: quark

Reviewed By: quark

Differential Revision: https://phab.mercurial-scm.org/D43
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
f17c815273 tests: remove transaction aborts
Summary: Less transaction rollbacks is good, right?

Reviewers: quark

Reviewed By: quark

Differential Revision: https://phab.mercurial-scm.org/D42
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
8f554eb441 tests: adjust for new messages coming from the strip transaction
Summary:

Reviewers: quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D41
2017-07-11 09:44:53 -07:00
Mateusz Kwapich
760d982e3e tests: change the name of backup files
Summary: Looks like the upstream has changed it on us.

Reviewers: quark

Reviewed By: quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D40
2017-07-11 09:44:53 -07:00