Commit Graph

71 Commits

Author SHA1 Message Date
Mark Thomas
7098f7d4b5 pushrebase: check sources of renames when looking for conflicts
When checking the bundle contents against the revisions it is being rebased
over, include the sources of renames, as changes made in those files also
conflict with the bundle.

Differential Revision: https://phab.mercurial-scm.org/D1199
2017-10-26 02:47:39 -07:00
Stanislau Hlebik
808ae58590 pushrebase: handle pushing phases through separate bundle2 part
In 272dd7d8a1bb1b2e93697b5b65183b08c8bf0853 upstream hg commit phase pushes
started to use separate bundle2 part. Because of that:
1) pushkey hook is not called when updating phases.
2) pushkey bundle2 part doesn't process phases anymore, 'phase-heads' part do
it instead.

It caused breakages in pushrebase. This diff fixes it.

Test Plan:
Run tests test-pushrebase*  and test-treemanifest*

Differential Revision: https://phab.mercurial-scm.org/D1204
2017-10-23 10:36:16 -07:00
Jun Wu
ef11eb995c test-pushrebase: add a test case about modifying copy source
This is what happened to D1048 and D1050. Pushrebase should ideally check
the copy source in additional to modified files and block the push.

Differential Revision: https://phab.mercurial-scm.org/D1172
2017-10-20 17:15:01 -07:00
Jun Wu
090d0eb5b7 tests: update tests output
Upstream 4a405ffd8b20 ("transaction-summary: show the range of new revisions
upon pull/unbundle (BC)", 2017-10-12) has changed the output.
2017-10-17 13:05:18 -07:00
Durham Goode
20612dfe95 tests: update to match upstream changes
Upstream added a new capability about phase heads, so we need to update wire
protocol output.
2017-10-04 18:16:44 -07:00
Pulkit Goyal
c288e6c436 bundle2hooks: remove the extension from hgext3rd as it is moved to core
The ability to add hookargs to a bundleoperation object has been added to the
core from this extension.

Related commits are:
https://www.mercurial-scm.org/repo/hg-committed/rev/bf6a06e6310e
https://www.mercurial-scm.org/repo/hg-committed/rev/aa97e972460f

Differential Revision: https://phab.mercurial-scm.org/D364
2017-08-23 09:28:07 +05:30
Jun Wu
2e023a378c test-pushrebase: do not match detailed output of "running ..."
The debug output of "running ..." has been changed. Update our test
accordingly.
2017-08-08 15:12:11 -07:00
Jun Wu
c68b5e5cdb pushrebase: move bookmarks as well
Differential Revision: https://phab.mercurial-scm.org/D181
2017-07-27 12:33:43 -07:00
Jeroen Vaelen
f786cd6bdb pushrebase: fix typo
Test Plan: unit tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D177
2017-07-24 11:42:24 -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
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
Jun Wu
3d461ae600 check-ext: make checks stricter
Summary:
Enhance check-ext script to be more strict:

 - Only one foreign extension is allowed: `remotenames`
 - Require explicit path for in-repo extensions to avoid wrong extensions
   being tested

This would make the test more predicatable since system extensions
will be less likely to be imported. Explicit path is better than
setting `PYTHONPATH` since `hgext/name.py` could override
`hgext3rd/name.py` regardless of `PYTHONPATH`.

Test Plan: arc unit

Reviewers: phillco, durham, ikostia, #mercurial, stash

Reviewed By: stash

Subscribers: medson, mjpieters

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

Signature: t1:5271430:1497861776:7dd35ec7c522cd9b26aa0871cb4306b4f1b8993a
2017-06-19 08:02:38 -07:00
Olivier Trempe
7b57890313 pushrebase: make pretxnchangegroup and changegroup hook arguments consistent with mercurial hook documentation
Before this patch, the pretxnchangegroup 'node' argument would be the last
added node whereas mercurial documention specifies that it should be the first
new changeset. The 'node_last' argument has also been added to both
pretxnchangegroup and changegroup hooks as per mercurial documentation.
2017-06-14 16:29:16 -07:00
Olivier Trempe
e08fcc30c1 test-pushrebase: Enhance test to bring out hook arguments inconsistency in pretxnchangegroup hook
The 'node' argument points to the last new changeset. Mercurial documentation
state that it should be the first new changeset.

This will be fixed with the following changeset
2017-06-14 16:29:16 -07:00
Olivier Trempe
0e2e9efbc7 pushrebase: add node_onto argument to prepushrebase hook
This helps doing some validation before accepting a pushrebase.
For example, if you want to prevent users to accidentally pushrebase
changesets to the wrong branch by checking if all pushed changesets are
on the same branch as the destination (--to)
2017-06-13 16:32:25 -07:00
Stanislau Hlebik
db25e443da pushrebase: fix test
Logged message was changed in f0652919303c1e090e6c26517ec3b8a116cb7142
upstream.
2017-06-13 07:16:35 -07:00
Durham Goode
da7796c0fe fixtests: fix tests to work with upstream changes
Upstream has made some minor changes that affect the tests. Let's just update
the tests appropriately.
2017-05-16 09:40:27 -07:00
Jun Wu
d82b8b1495 pushrebase: do not require exchange for getting markers
Summary:
D4865150 and D4934720 aren't effective in our current setup. The direct
cause in the code is because the server couldn't find common marker version:

```
  # old server-side code, returns empty in our current setup
  obsolete.commonversion(bundle2.obsmarkersversion(reply.capabilities))
```

Upon investigation, it's because there is no `exchange` enabled client-side.

But we do want one-way (server->client) markers for the rebased commits, as
long as obsstore is enabled (createmarkers is set, without exchange).

The upstream expects the server to have obsstore enabled, and exchange
enabled, to send markers. Since we are generating markers without an
obsstore (see D4865150), we are on our own way. This diff makes it one step
further.

This diff adds an explicit parameter to the `b2x:rebase` part to tell the
server what obsmarker format the client supports so the server could make a
right decision without relying on the "standard" `reply.capabilities`, which
is affected by the exchange option.

Test Plan: Change the existing test, make sure the old code fails.

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters

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

Signature: t1:4997972:1493848751:14c29654b2e8246bd12a8de8820af5b3773e2fb7
2017-05-03 16:08:35 -07:00
Jun Wu
44c4a80415 pushrebase: deal with phase move correctly
Summary:
Previously we ignore "draft -> public" phase move, and new nodes returned by
the server may remain "draft" until the next pull. This diff records the
obsmarkers and updates phases of the new nodes correctly so they become
public without an extra hg pull.

Test Plan: Modified an existing testcase

Reviewers: #mercurial, durham, rmcelroy

Reviewed By: durham

Subscribers: durham, mjpieters

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

Signature: t1:4934720:1493076241:9b23da1140b68aece9e838c604e64611b3498794
2017-04-25 14:46:36 -07:00
Jun Wu
340750c4f4 pushrebase: send obsmarkers to client if client supports it
Summary:
Previously when the client has obsstore enabled, and the server has obsstore
disabled, clients won't get the obsmarkers, which is suboptimal. This diff
makes the server send obsmarkers in that case.

Practically, this means people will no longer need to run `strip` after landing
a diff in this repo.

Note: `test-pushrebase-manifests.t` is somehow flaky about the empty lines. I
guess they are not related to the change. But the test change is not 100%
reproducible.

Test Plan: Added a new test case

Reviewers: #mercurial, stash

Reviewed By: stash

Subscribers: rmcelroy, ikostia, stash, mjpieters

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

Signature: t1:4865150:1491895844:afbc3079a40a9a9fa9af1eab4eeaca91091e8d2d
2017-04-11 13:21:27 -07:00
Stanislau Hlebik
4cfa95492e pushrebase: fix tests
Summary:
7687edc2cef224a3a5ad4961e11073aa2ea73af8 added HG_HOOKNAME and HG_HOOKTYPE info
Let's update the test

Test Plan: arc unit

Reviewers: #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

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

Signature: t1:4826767:1491319207:a1c9e9af20cc237ff02bedcb9072f2c0816a1fbe
2017-04-04 08:36:10 -07:00
Durham Goode
43897284e2 test: fix osx compatibility
Summary:
Some recent commits introduced non-OSX compatible test output. This patch fixes
that.

- 'ls' has different output text and error codes for missing files on osx
- 'sync' just waits for an in memory write to be flushed to disk, which
  shouldn't actually be visible to any user land process, so it seems there's a
  deeper race condition here, like wait_for_background_backup.py not working
  correctly.  Adding a sleep here to work around it.

Test Plan: Ran the tests on linux and osx

Reviewers: stash, #mercurial, quark

Reviewed By: quark

Subscribers: quark, mjpieters

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

Signature: t1:4378618:1483477739:5cd8bf82368cc417fbc7ee22410e6d962ba10342
2017-01-03 13:09:31 -08:00
Stanislau Hlebik
b3cc0d5817 pushrebase: close bundle file
Summary: bundle file should be closed to ensure that all the temporary files were deleted

Test Plan: arc unit

Reviewers: #sourcecontrol, ikostia

Reviewed By: ikostia

Subscribers: mjpieters

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

Signature: t1:4377148:1483451990:2a1362d9e524a54ffedad8f2bc09fc622efe8ad4
2017-01-03 06:01:57 -08:00
Durham Goode
2e89e5591d pushrebase: fix handling merge commits where master is p2
Summary:
Previously, if during a pushrebaes a merge commit was rebased and the
parent commit that contained the original rebase destinations content (i.e.
master's content) was on the p2 side, it would all be thrown away.

This is because the pushrebase commit works by copying the destination-repo-p1, then
applying changes from the diff of the original-repo-p1 vs original-repo-commit.
Since all the rebase destination contents was in destination-repo-p2, it is all
lost here.

The solution is to track which commit is the latest one to contain the
destination bookmark contents, and make sure it is always p1 when rebasing merge
commits. This will ensure that the destination bookmark contents are preserved
all the way up to the new commit for that bookmark.

Test Plan:
Added a test. It fails before the change and passes after. Another
test was also affected, since the p1/p2 ordering is different.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Tasks: 15092414

Signature: t1:4336427:1481881555:a22b8c363f2f7a197cef192abf34bfca926ecdc2
2016-12-16 10:24:12 -08:00
Durham Goode
73c92dfa70 pushrebase: update test for upstream change
Upstream changed when http headers are advertised (75deec4e372a). So we need to
update our tests.
2016-12-15 14:16:00 -08:00
Jun Wu
9fea0c3f0c doc: replace "commit" where it is used as a noun with "changeset"
Summary:
"changeset" is a more official term and let's use it. Note that this patch
only changes documentation / i18n messages visible to the users and header
comment blocks to developers. Other places like comments in the code are
untouched.

With the "dialect" extension enabled, users will still see the more friendly
term - "commit".

Test Plan:
`arc unit`. Note the remotefilelog failure is probably unrelated - seems
related to ongoing / upcoming manifest refactoring upstream.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:3900394:1474470348:6a1b5691e2599cc47df18b227d56d1f9d3c7c906
2016-09-21 15:45:25 +01:00
Mateusz Kwapich
83606d1a5e pushrebase: fix tests
Summary:
We need to fix tests due to de-facto HG_URL variable semantics change in
https://selenic.com/hg/rev/a5fd89db5549

Test Plan: run-tests.py test-pushrebase.t

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:3771208:1472141889:562c84ca92b91d2dbe60decea53349f53a9676c4
2016-08-25 10:54:18 -07:00
Ryan McElroy
3682450721 tests: update pushrebase test with new string 2016-08-11 06:33:47 -07: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
58d4cb362d Fix graphmod-related test failures
Summary:
This change fixes up tests to track graphmod changes.

The change for the smartlog test is a temporary stop-gap measure, as smartlog
itself will be updated soon to track the changes in better ways.

Test Plan:
Run the test-suite, ignore unrelated failures in test-morestatus.t, test-mergedriver.t
and test-fastmanifest.t

Reviewers: #sourcecontrol, ttung

Subscribers: mjpieters

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

Tasks: 10804976
2016-04-19 11:19:20 +01:00
Tony Tung
7061c1092f store the pushvars in the bundle2 operation object
Summary:
The pushvars extension ensures that it precedes the hooks.
Unfortunately, that means pushrebase does not have access to the hook
variables unless it obtains the transaction.  If it does that, then the
prepushrebase step will have the lock, defeating the purpose of the hook.

By storing the pushvars in the operation, we can retrieve it without
starting the transaction.

Test Plan: passes the BYPASS_REVIEW test when it is moved to prepushrebase

Reviewers: #sourcecontrol, durham, lcharignon

Reviewed By: durham

Subscribers: durham, mitrandir

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

Tasks: 9872386

Signature: t1:2890191:1454526611:503a30015494eef467ad545b92077bf42cdd30d5
2016-02-18 21:32:11 -08:00
Tony Tung
c6681e3e6d [pushrebase] change the pushrebase tests to use the PYTHONPATH setup
Summary: Just a bit cleaner.  Also this makes it so pushrebase can source any hypothetically shared code.  Mostly because I'm too lazy to type bundle2hooks=PATH_OF_FILE.

Test Plan: same unit tests pass.

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: durham, mitrandir

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

Signature: t1:2903928:1454648999:81f6cc64f708dc4709640b2a214e1b3dbc11caa5
2016-02-04 22:47:14 -08:00
Laurent Charignon
f35e1510b0 cleanup: fix check-code warnings
Summary:
This diff is part of a series to cleanup fb-hgext and make it pass check-code.
Stop using aliases, fix the case of a variable and poorly designed warning for
export (see (r'export.*=', "don't export and assign at once"),)

Test Plan: all tests pass

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2812592
2016-01-07 18:30:24 -08:00
Laurent Charignon
7f96983d9e cleanup: make paths in tests comply with windows's paths
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/D2811930
2016-01-07 18:30:24 -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
Durham Goode
f6354f898a pushrebase: fix pushing merge commits with date rewriting on
Summary:
When pushing a rewritten merge commit, we were trying to look up it's original
parent in the current repo (which no longer had that commit). We need to look in
the bundle repo instead.

Test Plan: Added a test. Also tried it manually on one of the hg servers

Reviewers: #sourcecontrol, ttung, mitrandir

Reviewed By: mitrandir

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

Signature: t1:2763182:1450230086:c560d4b8bbfe5d5387e23c1cc2e09109f49f255b
2015-12-16 09:47:23 -08:00
Mateusz Kwapich
c0481c096d pushrebase: improve tests to include prepushkey hook
Test Plan: whoteststhetests

Reviewers: #sourcecontrol, rmcelroy, ttung

Reviewed By: rmcelroy

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

Signature: t1:2751233:1449882198:4695c63c5172fc8f20e123b3da055b41b59c07e2
2015-12-14 15:38:11 -08:00
Ryan McElroy
59ee01fd63 update extensions and tests for latest mercurial
Test Plan: ran against latest mercurial

Reviewers: #sourcecontrol, mitrandir

Reviewed By: mitrandir

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

Tasks: 9130498

Signature: t1:2667332:1447811419:24f642f3a4faa410b7aa9fdd650c1dc3a743d653
2015-11-17 17:54:31 -08:00
Eric Sumner
c35574b56c pushrebase: add HG_PENDING to test 2015-11-04 14:11:03 -08:00
Durham Goode
e5a235b61a pushrebase: improve error message for file conflicts
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
2015-10-28 18:19:20 -07:00
Durham Goode
a49358f7cc pushrebase: improve messages when pushing
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
2015-10-28 18:19:18 -07:00
Durham Goode
d15ddf0bfa pushrebase: make push -f go through pushrebase
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
2015-10-28 18:19:12 -07:00
Durham Goode
0a0b341080 pushrebase: add option for rewriting dates
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
2015-10-17 18:59:46 -07:00
Durham Goode
49e649fba6 pushrebase: add pre-lock hook
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
2015-10-05 18:56:46 -07:00
Durham Goode
a92b5a9582 pushrebase: fix tests 2015-10-05 19:20:15 -07:00
Christian Delahousse
df27ba12fe Dropped local run-tests in favour of using mercurial's own test runner
Summary:
To do so, we had to change some path variables and change the output of some
tests. Removed a few dependencies that provided by hg.

Test Plan:
Ran the tests. There was some ignorable output changed (about devel-warn) caused by other code not
related to this change.

Reviewers: #sourcecontrol, pyd, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, durham

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

Signature: t1:2499721:1443745230:9d4e53e83356807f3343c8343e28d10f1b9dc35f
2015-10-01 13:03:03 -07:00
Ryan McElroy
ba64067032 pushrebase: redo check heads elision to be on the client side
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
2015-10-01 11:15:37 -07:00
Ryan McElroy
28e4ce1306 pushrebase: turn off check:heads bundlepart during push
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
2015-09-27 15:45:31 -07:00
Durham Goode
e69ea77935 pushrebase: remove transaction spam from tests
Summary:
This tests were A) unreadable, and B) not deterministic. Let's remove all that
text and have a special test just for making sure the hook vars we care about
are present.

Also break the output into multiple lines for easier reading and diffing.

And fix a change in order for the remotenames test.

Test Plan: Ran the tests

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2479274
2015-09-24 20:03:02 -07:00
Eric Sumner
ae66dcdfae Make pushrebase set HG_NODE when it makes a commit
Test Plan: ran tests

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.fb.com/D2471540
2015-09-23 10:25:24 -07:00