Summary:
If tracking was set up, 'hg push' was not invoking the pushrebase logic, like it
would if the user ran 'hg push --to master'.
This is required for us to unify all pushes through pushrebase, so we can move
the hooks out of the lock and into prepushrebase.
Test Plan: Added a test
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2635253
Summary:
Previously we did force pushes by passing a force argument to the server and
having the server ignore the onto arg. This was annoying because it meant we had
to stage our deploy (server must be able to handle the arg before we could allow
clients to send it).
The new behavior uses the existing onto arg and passes a marker to indicate that
no rebase should happen. Old pushrebase servers will handle this correctly,
since a failure to find a node is already treated as "don't try to rebase".
Test Plan:
Tested force push and non force push between old servers and new
clients, and new servers and old clients, and new servers and new clients.
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2598108
Summary:
When we take the lock, the old repo may become invalidated, so we need to
recreate the bundle repo. Otherwise it's possible that the master commit is not
present in the bundle repo.
Test Plan:
Ran the tests, but I'm not sure how to test this without having push
contention.
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2597823
Summary:
The previous implementation relied on the python serialization of lists. This
resulted in some truncation due to line length in some infrastructure.
This patch makes it prettier.
Test Plan: Tests
Reviewers: #sourcecontrol, mitrandir
Reviewed By: mitrandir
Subscribers: mitrandir
Differential Revision: https://phabricator.fb.com/D2594066
Signature: t1:2594066:1446079418:cd27cea1f44a9d432984b8dc37b547450ff076ab
Summary:
Previously the output just said "searching for changes" then "updating
bookmark", which was kind of terse. It also showed the "adding XX changesets"
output without any context, which is kind of scary to see "adding 100
changesets" when I'm only pushing one commit.
Now we mention how many commits we're pushing, what the hash range is, and how
many commits are being downloaded.
Test Plan: Ran ze tests
Reviewers: #sourcecontrol, mitrandir
Reviewed By: mitrandir
Subscribers: mitrandir
Differential Revision: https://phabricator.fb.com/D2594007
Signature: t1:2594007:1446081446:99b77f4982acafc1f1940ba07b094a27dd05e354
Summary:
This adds an option for blocking non-pushrebase pushes. This is important
because it allows us to force every push through the pushrebase logic and
therefore allows us to put all the hooks in the prepushrebase hook (so people
can't avoid those hooks).
This is important for performance, since running the hooks in prepushrebase
allows us to run them while outside the lock.
Test Plan: Added a test
Reviewers: #sourcecontrol, rmcelroy
Reviewed By: rmcelroy
Subscribers: rmcelroy
Differential Revision: https://phabricator.fb.com/D2593512
Signature: t1:2593512:1446076882:9f5ee5d8bccd884f34c8284fbacb7d6f8e96f62f
Summary:
Since pushrebase allows running hooks outside of the lock, we want to force all
pushes to go through pushrebase. Step #1 of that is making push --force go
through the pushrebase flow.
The initial version is pretty naive. A future version might avoid the whole
graft process for performance sake.
Test Plan:
Added a test that creates a new bookmark. I also tested the same test
doing a force push.
Reviewers: #sourcecontrol, rmcelroy
Reviewed By: rmcelroy
Subscribers: rmcelroy
Differential Revision: https://phabricator.fb.com/D2588894
Signature: t1:2588894:1446076583:12b58048742b112a5d7cab839204c6219414f9ee
Summary:
It's a nice property to have commits have increasing timestamps. Since we're
already rewriting commits during pushrebase, we can rewrite the timestamp to the
push time.
Test Plan: Added a test
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2554422
Summary:
This adds a hook before we take the lock that allows us to run some expensive
hooks without blocking the entire repo. This is useful for hooks that check the
contents of the bundle for certain info (like conflict markers), that won't be
affected by rebases.
Test Plan:
Added a test. Verified it passed when hg had lazy locks enabled for
unbundle, and failed with mercurial did not have lazy locks for unbundle.
Reviewers: pyd, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2511561
Summary:
The way pushrebase was changing the extension load order doesn't work if another
extension replaced the extension._order list. This patch fixes it.
Test Plan: Ran the tests
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2493153
Summary:
Also added an additional test to show a case that fails now (and should fail),
but would have succeeded with the previous code.
Test Plan: Additional unit test
Reviewers: #sourcecontrol, durham
Reviewed By: durham
Differential Revision: https://phabricator.fb.com/D2502396
Signature: t1:2502396:1443809922:18ec6697b7c135c37c10f7bdd9544901c4a54c99
Summary:
The old check moved the bookmark old node after the prepushkey hooks
had ran, bypassing the non-ff prevention logic. This moves the old node rewrite
to before the prepushkey hook and also checks that old node is moved in a
ff-only way.
Test Plan: updated unit test
Reviewers: #sourcecontrol, mitrandir
Reviewed By: mitrandir
Subscribers: durham
Differential Revision: https://phabricator.fb.com/D2499633
Signature: t1:2499633:1443733890:4c84150bd0f21adb97feb23e54727bb4e8be38cf
Summary:
By removing the part on the pushrebase client instead of ignoring it on the
pushrebase server, the server can still run this check for non-pushrebase
pushes so it will be safer against divergent heads.
Test Plan: Updated unit tests
Reviewers: #sourcecontrol, pyd, durham
Reviewed By: pyd, durham
Differential Revision: https://phabricator.fb.com/D2499115
Signature: t1:2499115:1443736440:001ceb79a4692abbd4c6b208124f6576f10f680c
Summary:
In pushrebase, we expect bookmarks to be moving after discovery but
before we grab the lock. With this patch, we rewrite the incoming bookmark
changes so that they do not fail if the bookmark moves after discovery.
Test Plan:
Wrote a new test to cover this behavior and verified that the test failed before
this change but works afterwards.
Reviewers: #sourcecontrol, durham
Reviewed By: durham
Subscribers: durham
Differential Revision: https://phabricator.fb.com/D2488675
Signature: t1:2488675:1443503039:660f88da9727a74f7c9a21f0767efb5d7379d16d
Summary:
This check was causing pushes to fail when heads change during a push, but that
is expected in pushrebase pushes.
Test Plan: ran existing tests
Reviewers: ericsumner, #sourcecontrol, durham
Reviewed By: #sourcecontrol, durham
Differential Revision: https://phabricator.fb.com/D2482254
Signature: t1:2482254:1443468591:23dc9ad24e1c7d3b3ec04be678d346dfed6d98a7
Summary:
This adds a hint to the bundle2 stream that indicates which manifests should be
read before starting the unbundle. This allows us to spend all the parse time
outside of the lock, thus increasing our commit throughput.
Test Plan:
Manually added it to a server and verified the total lock held time
went down. Also ran the tests.
Reviewers: #sourcecontrol, rmcelroy
Reviewed By: rmcelroy
Subscribers: rmcelroy
Differential Revision: https://phabricator.fb.com/D2485920
Signature: t1:2485920:1443483219:8626105814b511a34a410265310986f936d7c450
Summary:
As part of increasing our commit throughput, we want to allow precaching the
manifests before the lock is taken. This requires that we are able to use those
cache results from inside the bundle repo. So let's copy the cache data
structures into the bundle repo manifest cache.
Test Plan:
Ran it on a mercurial server along with some timers and verified we
got more cache hits.
Reviewers: pyd, #sourcecontrol, rmcelroy
Reviewed By: rmcelroy
Differential Revision: https://phabricator.fb.com/D2485911
Signature: t1:2485911:1443482960:c585f72383c72cd815448814a54d701fca71b1b7
Summary:
exchange.check_heads is used to verify that the server's heads haven't changed
between when the client does discovery and when it obtains the lock. With
pushrebase we want to allow concurrent pushes, so this is a scenario we want to
support.
So let's disable that check.
Test Plan: Ran the tests and verify that the wrapfunction call was hit.
Reviewers: ericsumner, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2419949
Summary:
It turns out commit.files() does not return all the affected files during a
merge commit. It only returns files which differ from both p1 and p2, so in a
merge commit where we accept the changes from p2, the changes were lost during
the rebase.
This fixes it by performing a manifest diff if we're grafting a merge commit.
Test Plan:
Updated the tests to check the file contents (this test would fail
before)
Reviewers: #sourcecontrol
Differential Revision: https://phabricator.fb.com/D2331586
Summary:
pushrebase doesn't support pushing non-fastward heads when remotenames is on
(since --to implies both remotenames and do a rebase). Long term we want --new
and --replace to indicate bookmark movements, but for now we can use the
existing -f to imply that we don't want a rebase to happen.
Test Plan: Added a test
Reviewers: #sourcecontrol, lcharignon
Reviewed By: #sourcecontrol, lcharignon
Subscribers: lcharignon
Differential Revision: https://phabricator.fb.com/D2307585
It is a best practice for Mercurial extensions to contain a "testedwith"
attribute to define which Mercurial versions they are compatible with.
The tests pass with Mercurial 3.4.1 (but not 3.3.3 - there are
references to missing symbols), so mark 3.4 as the only compatible
version.
Summary:
The tail check was flagging by mistake scenarios where the push was
possible. This patch adds one of these scenario.
Test Plan: Add new test and all former tests are passing
Reviewers: ericsumner, durham
Differential Revision: https://phabricator.fb.com/D2292866
Summary:
Before this patch, pushrebase was not supporting some cases of fast
forward push. This patch fixes the issue.
Test Plan:
Added a new test. Check that the test failed before and is fixed
with the code change.
Reviewers: durham
Differential Revision: https://phabricator.fb.com/D2279800
Summary:
Before this patch we were not recording all the information for file
copy, executable bit and link. This patch fixes the issue.
Test Plan: Add a new test with a copy
Reviewers: durham
Differential Revision: https://phabricator.fb.com/D2277575
Summary:
I saw this error when using pushrebase with fbsource on a commit
that deleted a file. We were trying to access it even if it was not in the
manifest.
Test Plan:
Modified the test
Before the code fix the new test fails with:
remote: abort: b@46a2df24e272: not found in manifest!
Reviewers: durham, ericsumner, pyd
Differential Revision: https://phabricator.fb.com/D2274792
Summary:
Previously pushrebase could not create new bookmarks, because the rebase target
did not exist. This fixes that.
Also fixes some output text to match the core Mercurial behavior, so tools can
rely on the text in certain cases.
Test Plan: Added a test
Reviewers: lcharignon, pyd, rmcelroy, ericsumner
Reviewed By: ericsumner
Differential Revision: https://phabricator.fb.com/D2240418
Signature: t1:2240418:1436895571:2f56298969e09490f6f5e6a44857eedc2bfcace4
Summary:
Remotenames wraps the push command and sometimes doesn't call the original
implementation. Since pushvars relies on being called as part of push, we need
to make sure pushvars wraps push after remotenames.
It turns out pushrebase's solution to this was broken as well, so fix it up too.
Test Plan:
Pushed to fbjava_test with and without the change. Verified I could
circumvent the reviewers hook only after the change.
Reviewers: akushner, rmcelroy, pyd
Differential Revision: https://phabricator.fb.com/D2220774
Summary:
This makes the pushrebase extension work with the remotenames extension. It does
a few things:
1) rename --onto to be --to for consistency
2) configures remotenames to allow non-fastforward pushes
3) changes the push wrapper to happen after remotenames is loaded
Test Plan: Added a test
Reviewers: pyd, rmcelroy, lcharignon, ericsumner
Reviewed By: ericsumner
Differential Revision: https://phabricator.fb.com/D2200222
Signature: t1:2200222:1435695629:a92d8b20d158aa40bad1f3963af0348b6680d52d
Summary:
This adds the ability to rebase changegroups that contain merge commits. It
works by identifying the maximum bundle root that is an ancestor of the desired
`onto` and rebases only things that are on top of that root.
Test Plan: Added a test
Reviewers: lcharignon, pyd, ericsumner
Reviewed By: ericsumner
Subscribers: rmcelroy
Differential Revision: https://phabricator.fb.com/D2194350
Signature: t1:2194350:1435695516:3a1f62bda7de0da9536a538da0bbb6deceb192f6
Summary:
Upstream has removed all the b2x flags, so let's do the same to pushrebase. Also
fixes pushrebase's use of manifest._intersectfiles() which has been removed
upstream (in favor of a matcher).
The tests had a bunch of hardcoded hooks which were very messy and became
impossible to maintain when upstream changed what args were passed. Let's just
get rid of all that noise.
Test Plan: Ran the tests
Reviewers: sid0, rmcelroy, lcharignon, ericsumner, pyd
Reviewed By: pyd
Differential Revision: https://phabricator.fb.com/D2003033
Signature: t1:2003033:1429832524:c0de8ebea7e6348ba9b55c109ca71bb3a301b625
Summary: The `intersectfiles` API changed.
Test Plan: ran the tests
Reviewers: ericsumner, #sourcecontrol
Reviewed By: ericsumner, #sourcecontrol
Differential Revision: https://phabricator.fb.com/D1966309
Tasks: 6619970
Signature: t1:1966309:1428086453:415a185b71af4812de2f5b6690a5337a5950aab6
Summary:
It turns out that bundlerepo uses the underlying phase boundaries, so the
added changesets show up with the same phase as their nearest ancestor that's
already in the repository. This behavior is confusing and inconsistent with
what happens when the bundle is actually applied: retracting the draft boundary
over the new commits.
This makes a copy of the phase cache so that changes in the bundlerepo don't
affect the real one and then retracts the draft boundary like would happen
when the bundle is applied normally.
If this general solution looks OK, I'll submit an upstream patch that makes
bundlerepo behave this way always, which will make it match the behavior that
would be seen when using ##hg unbundle##.
Test Plan: ##run-tests.py##
Reviewers: pyd, durham
Reviewed By: durham
Subscribers: calvinb, rmcelroy, daviser, mpm, davidsp, sid0, akushner, pyd, durham
Differential Revision: https://phabricator.fb.com/D1733166
Signature: t1:1733166:1420502423:f57e2fff8fe47293ecab1ac4f6efdd0507c9c7b5
Summary: Been working with js too long; python vars aren't None by default
Test Plan: ##run-tests.py##, and doing a traditional push w/ the extension enabled
Reviewers: durham, sid0, pyd
Subscribers: calvinb, mitrandir, rmcelroy, daviser, mpm, davidsp, sid0, akushner, pyd, durham
Differential Revision: https://phabricator.fb.com/D1743710
Summary:
@durin42 suggested that the extension might want to prevent processing of
obsolete commits. Given the current state of dealing with conflicting
obsolescence markers, this seems like a good idea.
Test Plan: ##run-tests.py##
Reviewers: pyd, durham
Reviewed By: durham
Subscribers: calvinb, mitrandir, rmcelroy, daviser, mpm, davidsp, sid0, akushner, pyd, durham
Differential Revision: https://phabricator.fb.com/D1740886
Signature: t1:1740886:1418686275:d505ff1de8fbce39eb4fbe3a2e6d368b4b14edb8
Summary:
Transferring the part data into a bundle file on disk for bundlerepo to read
is a self-contained operation
Test Plan: ##run_tests.py##
Reviewers: pyd, durham
Reviewed By: durham
Subscribers: calvinb, mitrandir, rmcelroy, daviser, mpm, davidsp, sid0, akushner, pyd, durham
Differential Revision: https://phabricator.fb.com/D1726767
Signature: t1:1726767:1418241560:8afac123afc847e61e6f46b6216d15b003024504
Summary: Update indentation to be more in-line with how hg does things
Test Plan: ##run-tests.py##
Reviewers: pyd, durham
Reviewed By: durham
Subscribers: akushner, sid0, davidsp, mpm, daviser, rmcelroy, mitrandir, calvinb
Differential Revision: https://phabricator.fb.com/D1726641
Signature: t1:1726641:1418086497:91cde84647f094e077966aea53668fead9c47a7a
Summary:
The rebase extension bypasses the changegroup processing hooks, so they need to
be called explicitly.
Test Plan: Added hooks to the existing test
Reviewers: pyd, durham
Reviewed By: durham
Subscribers: calvinb, mitrandir, rmcelroy, daviser, mpm, davidsp, sid0, akushner
Differential Revision: https://phabricator.fb.com/D1726408
Signature: t1:1726408:1418241039:4e51a6dcbf3134f12d55c8e902de9ca7086883d1
Summary:
Instead of always sending back a v1 changegroup, do the proper version
negotiation so we use the latest version supported by both client and server
Test Plan: ##run-tests.py##
Reviewers: durham, pyd
Reviewed By: pyd
Subscribers: akushner, sid0, davidsp, mpm, daviser, rmcelroy
Differential Revision: https://phabricator.fb.com/D1722669
Signature: t1:1722669:1417819262:6ab35f612fbb0dc5884caefc12e550d1d3eb0adf
Summary:
This information will be useful to any pushback extension; this is a first step
towards making it a separate extension
Test Plan: ##run-tests.py##
Reviewers: pyd, durham
Reviewed By: durham
Subscribers: akushner, sid0, davidsp, mpm, daviser, rmcelroy
Differential Revision: https://phabricator.fb.com/D1722350
Signature: t1:1722350:1417813202:a021aa449765bf49c0c2e1fe86cb90534c50fdad