Commit Graph

28 Commits

Author SHA1 Message Date
Durham Goode
f762741367 pushrebase: generate tree pack parts during push
Summary:
We want to enable pushing tree packs during pushrebase, and eventually we can
stop including flat manifest information entirely. The first step is to generate
the tree packs during push. A future patch will handle the incoming parts.

Test Plan: Ran the tests. A future patch adds pack file handling to test this

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mitrandir, medson, mjpieters

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

Signature: t1:5329775:1499705168:43ea77c9a5c85c09b40910e102535d89a0504a4d
2017-07-10 15:53:12 -07:00
Adam Simpkins
13bd099e74 pushrebase: improve blocknonpushrebase error message
Summary:
Improve the error message from the blocknonpushrebase hook to inform the user
that they need the pushrebase extension enabled.

Previously the message indicated that you mush push using
`hg push --to <bookmark>`, but this is not sufficient.  Enabling the pushrebase
hook is the most important step here.  (The `--to` flag is not part of vanilla
mercurial, and is added by pushrebase, but other extensions like remotenames
also add a `--to` flag.)

Test Plan:
Added a unit tests for `hg push --to <bookmark>` with remotenames enabled but
pushrebase disabled.

Reviewers: #mercurial, davidsp, zhihuih

Reviewed By: zhihuih

Subscribers: quark, medson, mjpieters, net-systems-diffs@fb.com

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

Signature: t1:5276550:1497899421:3656bcc3e7358f97fc852e14307b34d8aa4d9951
2017-06-19 12:48:46 -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
602a765fe6 pushrebase: bring variable initialization closer to first usage 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
Phil Cohen
45b775ae72 pushrebase: exchange -> bundle2
Summary: Broken by an upstream refactor

Test Plan: Fixes test

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5149611
2017-05-30 13:13:36 -07:00
Durham Goode
e34660b057 commands: update to use registrar instead of cmdutil
Summary: Upstream has deprecated cmdutil.commands() in favor of registrar.commands()

Test Plan: Ran the tests

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

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

Signature: t1:5106486:1495485074:0e20f00622cc651e8c9dda837f84dd84cc51099e
2017-05-22 13:38:37 -07:00
Jun Wu
4131d4ebcd pushrebase: fix a typo in comment 2017-05-03 16:19:11 -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
4b467776ad pushrebase: accept arbitary keywords for _peerorrepo
Summary:
stateful chg will add a new parameter to repo initialization. This diff makes
sure pushrebase works with that change.

Test Plan: codereview

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters

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

Signature: t1:4978687:1493689190:7119205d76a8ac26dbf2bcf0be9c74ced9fc16b4
2017-05-01 19:11:08 -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
Phil Cohen
0e0f112b48 pushrebase: prepopulate the post-lock bundle manifest cache
Summary:
Previously we copied the old bundle dirmancache entries into the new bundle
dirmancache entries, but that missed any manifests that weren't already in the
cache. Since we have a list of bundle revs that are guaranteed to be needed
during the rebase, lets read them before the lock and force them into the cache
after the lock.

Test Plan:
Ran all pushrebase tests with a block like:

```
bundle.manifestlog[mfnode].read()
realmf = newdirmancache[''][mfnode].read()
if realmf.text() != mfdict.text():
     raise Exception("cache invalid")
```

...to verify the manifest we cached is the same as can be read from disk.

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters

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

Signature: t1:4774728:1490736995:6e20d69181b4df76aeb800ea246a0dae0a4b802d
2017-03-28 17:18:59 -07:00
Phil Cohen
5afc9c89dd pushrebase: set the manifest revlog fulltextcache
Summary:
This fetches the old master's full text before the lock is taken, and puts it in
the revlog._cache field so we don't have to read the full delta chain when we go
to read the latest master revision. This minimizes the amount of time we have to
spend processing the manifest during the first write.

Test Plan:
Ran all tests using a block like the following:

```
        for mfnode, mfdict in bundlerepocache.iteritems():
            bundle.manifestlog[mfnode].read()
            existing = newdirmancache[""][mfnode].read().text()
            new = mfdict.text()
            if new != existing:
                raise Exception("Cache failed")
```

...which raises if the data we were about to pull from the cache was different from what we were reading from the manifest before.

Reviewers: #mercurial, durham, rmcelroy

Reviewed By: durham

Subscribers: rmcelroy, quark, mjpieters

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

Signature: t1:4774716:1490735677:85bac79999d607f5554d090978d0ee6787f5e11c
2017-03-28 17:18:59 -07:00
Phil Cohen
948d47064a pushrebase: avoid diff'ing manifests for conflict detection
Summary:
Previously, pushrebase detected if it was ok to rebase a commit by diff'ing the
original common ancestor of the bundle and master with the new master. This
required reading both manifests. To improve performance, let's read the
changelog files list instead, which is much, much faster.

Merge commits don't have a files list that is representative of the actual diff,
so fall back to manifest diff in that case.

Test Plan: ran tests

Reviewers: #mercurial, stash, durham

Reviewed By: stash, durham

Subscribers: stash, mjpieters

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

Signature: t1:4774694:1490601056:18f78ab7c3e35a1beb2a7775160271a3311e38bb
2017-03-28 17:18:59 -07:00
Kostia Balytskyi
b6a03bd647 pushrebase: get page size form mmap instead of resource
Summary: `resource` is UNIX-only module, we can't use it if we want `pushrebase` to work on Windows. As we only use `getpagesize()`, we can also do `mmap.PAGESIZE` instead.

Test Plan: - apply change on Linux, see that they do not introduce any new failures

Reviewers: #sourcecontrol, durham, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:4762553:1490294453:fdcb2e9caa38f5d14eafc6ff36a1bb7d9429b6e9
2017-03-23 11:51:56 -07:00
Jun Wu
5404cd9a3c codemod: get rid of ui.backupconfig
Summary:
The upstream will remove `ui.backupconfig` soon(tm). Let's migrate our code
to `ui.configoverride` to avoid future breakages.

Test Plan: `arc unit`

Reviewers: #sourcecontrol, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:4734300:1489803960:a4101d6bc95ab62af67f0076b8e21f57cf926e13
2017-03-17 19:42:50 -07:00
Durham Goode
33a1d6afdc fix: update manifest.diff usages to handle match arg
Summary:
Upstream has added a new match argument to manifest.diff() and removed the
existing manifest.matches() function, so we need to update our internal usage.

A separate diff will update treemanifest to support the new diff() api.

Test Plan:
Ran the tests, some still fail because of the upstream changes, but
future patches fix those.

Reviewers: #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D4677002
2017-03-12 10:14:35 -08:00
Stanislau Hlebik
31e3ca4aa3 fb-hgext: make compatible to upstream changes
Summary:
c6cf3ac8c9bb811afa5b6eb5b69b29d128a7476a made revset API change.
This diff fixes our extensions

Test Plan: arc unit

Reviewers: #sourcecontrol, mjpieters, ikostia

Reviewed By: ikostia

Subscribers: mjpieters

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

Signature: t1:4604848:1487851636:1c7618e9050f607e2d8b47ed495a349b877ed48a
2017-02-23 04:08:18 -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
Stanislau Hlebik
5f58694748 unit-tests: fixes
Summary:
test-check-code.t was updated in core mercurial so we have to fix it in
fb-hgext

Test Plan: arc unit

Reviewers: #sourcecontrol, quark

Reviewed By: quark

Subscribers: quark, mjpieters

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

Signature: t1:4377208:1483451688:bc382cdab07c6d6127d67c902458a2ccfa1373d1
2017-01-03 05:59:55 -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
Jun Wu
f08e17d3ed testedwith: change testedwith to "ships-with-fb-hgext"
Summary:
Using `testedwith = 'internal'` is not a good habit [1]. Having it
auto-updated in batch would also introduce a lot of churn. This diff makes
them "ships-with-fb-hgext". If we do want to fill the ideal "testedwith"
information, we could put it in a centric place, like a "fbtestedwith"
extension rewriting those "ships-with-fb-hgext" on the fly.

Maybe having in-repo tags for tested Mercurial releases is also a good idea.

[1]: www.mercurial-scm.org/repo/hg/rev/2af1014c2534

Test Plan: `arc lint`

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4244689:1480440027:3dc18d017b48beba1176fbfd120351889259eb4b
2016-11-29 13:24:07 +00:00
Durham Goode
7a97fe8dca pushrebase: fix to work with new manifestlog
Summary:
Upstream has refactored the manifest class, so we need to update pushrebase to
work with the new structure. In particular, pushrebase takes advantage of the
manifest cache, so we need to carefully reconstruct the appropriate cache on the
bundle repo. We can't just .copy() it now because the cache contains manifestctx
instead of manifestdict, and the manifestctx contains a reference to the source
repo.

Test Plan: Ran the tests

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

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

Signature: t1:4180885:1479228506:a0ff114e158caab25da22f6116e5a4090f5515c0
2016-11-16 12:11:11 -08:00
Stanislau Hlebik
bbb7f15c99 pushrebase: cleanup
Summary: Remove unused imports + fix missing variable error in `_checkheads()`.

Test Plan: Added a new test.

Reviewers: quark, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:3862724:1474283118:deceacc683bb079eb7afb2ea34fb1e196f9bb18b
2016-09-26 01:48:13 -07: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
Ryan McElroy
6e5a7ab866 pushrebase: fix for upstream api change
Summary:
In upstream mercurial, 3d5e0fd41e0e changed discovery.outgoing() from taking a
changelog to taking the full repo object.

Test Plan: run tests, fewer stacktraces

Reviewers: #mercurial, ttung, durham, quark

Reviewed By: quark

Subscribers: mjpieters

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

Signature: t1:3819300:1473090807:fd0e4c2956fee4ad7d45051b6b7c5be481c766f1
2016-09-05 12:02:23 -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