Commit Graph

45 Commits

Author SHA1 Message Date
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
Jun Wu
99386e40fd inhibit: update existing code to work with the rewritten version
Summary:
debuginhibit was removed since we no longer have a separate inhibit state.

smartlog hack about changing "o" to "x" was removed since "obsolete()"
revset is correct and the hack is unnecessary now.

directaccess was removed from tests since inhibit does not depend on it.

`- obsolete()` was added to some revsets to avoid divergence and other
surprises.

Use `inhibit.revive` API in infinitepush and reset to revive changesets
properly.

Remove various hacky code that mangle inhibit state in corner cases.

Most test changes are `o` changed to `x` in output since we draw
`obsolete()` state correctly now. `test-infinitepush-backup-remotefilelog.t`
change was because output could be `bytes/sec` instead of `KB/sec`.

Test Plan: arc unit

Reviewers: #mercurial, kulshrax

Reviewed By: kulshrax

Subscribers: kulshrax, medson, mjpieters

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

Signature: t1:5391361:1499722618:d3c1cf629f0c59ecdf1dfd5e653c1eb6176646b8
2017-07-10 15:45:31 -07:00
Stanislau Hlebik
cad3f2d0a3 infinitepush: run debugfillinfinitepushmetadata in the background
Summary:
Final part: launching debugfillinfinitepushmetadata in the background. We
intentionally don't wait for it's completion in order not to slow down pushes.

Test Plan: arc unit

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mitrandir, quark, mjpieters, medson, #sourcecontrol

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

Tasks: 19103180

Signature: t1:5265325:1497886939:6c306c08b240373ea43a7fc868b17ef776258cf9
2017-06-20 05:40:01 -07:00
Stanislau Hlebik
da308cc725 infinitepush: add metadatafilelimit option
Summary:
Add an option to limit the number of file entries in the metadata field. This
is to avoid huge codemods to eat up all the space.

Depends on D5255883

Test Plan: arc unit

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, mjpieters, medson, #sourcecontrol

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

Tasks: 19103180

Signature: t1:5264202:1497630109:05d684db34578e309e0bbad314165e66d1f23ce9
2017-06-19 01:27:31 -07:00
Stanislau Hlebik
55ece1e4b0 infinitepush: support many nodes in debugfillinfinitepushmetadata
Summary:
We may want to fill infinitepush metadata for many commits at once.
Let's make it possible to pass many nodes to debugfillinfinitepushmetadata

Depends on D5255670

Test Plan: arc unit

Reviewers: #mercurial, mitrandir, quark

Reviewed By: quark

Subscribers: mitrandir, mjpieters, medson, #sourcecontrol

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

Tasks: 19103180

Signature: t1:5255883:1497629860:26332e3cc115881bca158664014ce48087d99215
2017-06-19 01:27:31 -07:00
Stanislau Hlebik
c7d835d417 infinitepush: record copies and changed status to metadata
Summary:
I've forgot to add it in the previous diff. We also want to know copies
information and status (added, modified, removed).

Test Plan: arc unit

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters, medson, azich, #sourcecontrol

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

Tasks: 19103180

Signature: t1:5255664:1497542963:b552c07d261067f426d7af7a29d2f02c1917394c
2017-06-19 01:27:31 -07:00
Jun Wu
4a936cee21 codemod: remove extpath in tests
Summary:
Previously, the following pattern is common in our tests:

```
   $ extpath=`dirname $TESTDIR`
   $ cp $extpath/hgext3rd/name.py $TESTTMP # use $TESTTMP substitution in message
   $ cat >> $HGRCPATH<<EOF
   > [extensions]
   > name=$TESTTMP/name.py
   > EOF
```

Now, it gets simplified to:

```
   $ cat >> $HGRCPATH<<EOF
   > [extensions]
   > name=$TESTDIR/../hgext3rd/name.py
   > EOF
```

This removes unnecessary `dirname` and `cp`.

Also fixed a regex that does not match `bytes`:

```
-  transferred 268 bytes in [\d.]+ seconds \([\d.]+ KB/sec\) (re)
+  transferred 268 bytes in 0.3 seconds (939 bytes/sec)
```

Test Plan: arc unit

Reviewers: #mercurial, phillco

Reviewed By: phillco

Subscribers: medson, mjpieters

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

Signature: t1:5270897:1497663052:bf860a0b480c751b1e4b53cebf6526193f0f6652
2017-06-16 18:31:25 -07:00
Jun Wu
be7ac42b50 codemod: replace evolve by fbamend
Summary:
Now that fbamend has most of the features we want. Replace evolve
used by tests.

Minor changes are made to some extensions to make test pass:
- reset: drop commit reviving support (was provided by "hg touch")
- smartlog: do not assume who provides "allsuccessors" revset
- fbamend: return 1 on "nothing changed"
- fbamend: write operation data for split and fold
- fbamend: do not print incompatibility notice
- fbamend: do not disable itself when rebase is not enabled
- inhibit: remove `bookmark -D` option - use `prune -B` instead

Test Plan: arc unit

Reviewers: #mercurial, stash

Reviewed By: stash

Subscribers: stash, mjpieters, medson

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

Signature: t1:5258813:1497604051:0c7334f9a6554cf31aaaaa2a4995b17d4e445847
2017-06-16 15:50:01 -07:00
Stanislau Hlebik
0d9f759213 infinitepush: add debugfillinfinitepushmetadata method
Summary:
Special command that fills optional metadata about infinitepush nodes. For now
it's info about changed files + info about how many lines were
added/removed. Since information is saved in json format it's easily
extensible.

It's a separate command so that we will be able to run it asynchronously:
during infinitepush push separate `hg debugfillinfinitepushmetadata` process
will be started. Push process won't wait for `debugfillinfinitepushmetadata`
process.

sqlindexapi will be implemented in the next diffs.

Test Plan: arc unit

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, mjpieters, medson, azich, #sourcecontrol

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

Tasks: 19103180

Signature: t1:5237547:1497397211:569d1ffe3be37c8d14fb7e07e42cd085ad5686d4
2017-06-15 05:19:37 -07:00
Jun Wu
01a471b159 codemod: use vendored directaccess and inhibit extension in tests
Summary:
This diff makes the tests use the vendored directaccess and inhibit instead the
foreign ones.

Test Plan: arc unit

Reviewers: #mercurial, sid0

Reviewed By: sid0

Subscribers: mjpieters

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

Signature: t1:5142981:1496173851:3a8f3a1c689711dbef517c893bf72c90ab144761
2017-05-30 12:56:40 -07:00
Stanislau Hlebik
e094644fb2 infinitepush: wrap findcommonincoming if nodes are requested
Summary:
Previously we don't set findcommonincoming to True, and that bug was unnoticed
because we send this info anyway in server-side `getbundlechunks()` function.

But next diff in the stack uses a fast path server-side which won't work if
fincommonincoming is not set to True.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4770830:1490719209:c251002d992e244580b7dbfeca0c30dff95734d2
2017-03-29 03:10:12 -07:00
Stanislau Hlebik
fa1919b5db infinitepush: simplify --list-remote option
Summary:
Previously --list-remote wasn't user friendly. User have to always specify a
pattern, and specifying * just won't work because of bash globbing. Also
it wasn't possible to specify many patterns at once.
This diff allows specifying many patterns, it allows to not specify
patterns at all and also it allows to specify default scratch patterns to fetch
if no patterns were specified. This is useful if there are many auto-generated
bookmarks under the same scratch bookmark pattern.

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Signature: t1:4605548:1487934838:066a12c28dda16fa8f90674d736d21345631ef7e
2017-02-24 05:41:53 -08:00
Stanislau Hlebik
6087449988 infinitepush: do one listkeyspatterns request for all scratch bookmarks
Summary:
listkeyspatterns support batching. Let's use and avoid making many network
calls to the hg server.

I had to modify tests because scratchbookmarks are passed to the listkeyspatterns,
and scratchbookmarks is dict and the order of the keys is unpredictable.
Because of it bundles from the server will be sent in unpredictable order, and log
output may be different.

Test Plan: arc unit

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4590914:1487788586:dd5ba0dd41b0cd19f790755d7b3c1fc5ba4ade61
2017-02-23 04:25:02 -08:00
Stanislau Hlebik
bf1907bb0e infinitepush: fix tests
Summary:
1196262099b5ff1f8529afc8055b1bc2c7e41658 upstream change cause test to fail
Fix it

Test Plan: arc unit

Reviewers: #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

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

Signature: t1:4581218:1487366936:330f5982edcd03e7e8f4b4a514ea3b285713795b
2017-02-17 13:30:24 -08:00
Stanislau Hlebik
1f65684b71 infinitepush: pull bookmark during update
Summary:
Currently infinitepush pulls only unknown nodes.
Let's also pull non-existing scratch bookmark during update.

Test Plan: arc unit

Reviewers: durham, rmcelroy, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Signature: t1:4564626:1487171677:d25db859ff35805f8ffc7741bc14abbc8d84dac3
2017-02-15 09:33:44 -08:00
Stanislau Hlebik
3c186b1ee4 infinitepush: pull node during update
Summary:
Let's pull node during update if not found locally.
This is a part of selectivepull functionality.
See remotenames extensions for details about selectivepull.

Test Plan: arc unit

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: indragie, mjpieters, sergeyb

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

Tasks: 12479658

Signature: t1:4536129:1486667537:3d1df30cb5d1db0dd7451756102ccafee20789d5
2017-02-10 00:20:54 -08:00
Stanislau Hlebik
f0a4c560a1 infinitepush: use --non-forward-move option instead of --force
Summary: --force option is scary, let's use --non-forward-move instead.

Test Plan: Run `test-infinitepush-*`

Reviewers: durham, rmcelroy, mitrandir, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4362055:1482426570:b57748835f5ec3b6916b9d29d67b7c3d9582a6e2
2016-12-22 09:20:49 -08:00
Stanislau Hlebik
db0892583c infinitepush: send cg v2
Test Plan: Run `test-infinitepush-*`

Reviewers: durham, rmcelroy, mitrandir, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4299163:1481212693:21120d98330b9a4fa0aced0523cc389eaa54551b
2016-12-15 10:02:59 -08:00
Stanislau Hlebik
c014561bb5 infinitepush: accept different cg versions server-side
Summary:
infinitepush has been storing bundle1 with changegroups v1. Turned out that in
some cases generated bundles can become huge because v1 changegroups don't
support generaldelta. It makes sense to support all changegroup versions (v1 for BC,
v2 for new infinitepush bundles, and maybe later we'll switch to v3).
To do this we have to store bundle2 instead of bundle1 because bundle1
supports only changegroups v1.

Test Plan: Run `test-infinitepush-*`

Reviewers: rmcelroy, mitrandir, quark, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4299151:1481564714:810be69447d0b35aa57328c60aab72ad374e994d
2016-12-13 06:32:31 -08:00
Stanislau Hlebik
83c0fd8ccd infinitepush: support pull from many scratch bookmarks
Summary:
We could've avoided creating this diff if bundlerepo supported many bundles.
Unfortunately it doesn't. Adding support requires changes in upstream mercurial and it can take a lot of time.
This implementation wraps `listkeys` to set phases properly and `exchange._changegrouppart` to send more
than one bundle at a time.
It has unsolved problem with phases. For example in this situation


  # Publishing server creates commit A (it is marked as draft on the server).
  # Client pulls commit A from publishing server (in this case commit A is marked on the client but it's still draft on the server).
  # Another client make pull from scratch bookmark. Commit A will be draft on client because we delete publishing = True from listkeys.

We assume that this case is quite rare.

Test Plan: Run `test-infinitepush-*`

Reviewers: mitrandir, rmcelroy, quark, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4074889:1480446669:97e7f1d8ad23d457d7984a4cde0efb2b6e89eb2e
2016-12-06 07:41:04 -08:00
Stanislau Hlebik
565b70f23e infinitepush: support bundle with many heads
Summary:
During `hg backup` bundle with many heads may be pushed. Let's support it too.
Many heads bundle is not allowed only when we are pushing it with `--to`
because in this case we don't know the node for the bookmark.

Test Plan: Run `test-infinitepush-*`

Reviewers: rmcelroy, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4175280:1479231056:fb0c47a7752319d77a6cfc83a29c57e9e2dced16
2016-11-21 00:48:09 -08:00
Stanislau Hlebik
fd8f0625ef infinitepush: add hg backup command
Summary:
Backups all new non-extinct [1] commits to bundlestore.

When it is called for the first time `hg backup` will backup all draft
visible commits. Next backups will save only new commits since the last
backup (it is recorded in `.hg/store/infinitepushbackuptip`[2]).

It's an initial implementation. Later the following features will be added:
1) It will be called automatically whenever user creates or strips commits
or even creates or deletes bookmarks
2) It will also save all local bookmarks and all local heads
(probably only visible).

Note: calling `pushcmd` directly does not set default values for opts. That means that `--to` will be None and `_scratchbranchmatcher` will throw exception. Let's add a check to ensure that `--to` is never None.

[1] I also want to backup extinct commits (i.e. obsolete invisible commits).
But it will require bigger changes in discovery algorithm, so I'd leave it
for later.
[2] The name is a bit verbose. But I want to keep `infinitepush` part to make
it easier to debug problems.

Test Plan: Run `test-infinitepush-*`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4147651:1479229440:3eb38880c14f18e9a2fb4eaba44bedf079bca506
2016-11-16 02:13:17 -08:00
Stanislau Hlebik
1b8b5987b2 infinitepush: overwrite bundle for old revs
Summary:
Previously if bundle has contained nodes that are already saved in bundlestore
then we wouldn't update bundleid value for these nodes.
That means that we can never delete a bundle because there will always be a
node that points to it.

I suggest to always update bundleid value for all nodes in the bundle.

Test Plan: Run `test-infinitepush-*`

Reviewers: durham, mitrandir, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4130662:1478565392:682fe39c5832d5edc84c84541f0ba6c1f2e1daf8
2016-11-08 02:27:25 -08:00
Stanislau Hlebik
f4f6b2411a infinitepush: inhibit pulled revs
Summary:
Pulling scratch commits that were stripped before results in
abort: 00changelog.i@c153241c1ea22cbce8a229dccdf7f46de827d962: filtered node!

The reason is that upstream pull does
checkout = str(repo.changelog.rev(checkout))

and it fails if revision is filtered.
I suggest to inhibit filtered revisions that are present in the local repo.
It makes sense because if user tries to pull scratch branch he or she
probably expects to see them in the repo even though these revisions were
stripped before.

Also we can avoid doing any pull if all revisions are present in the repo.
I decided not to do this because it complicates code (for example,
we need to ensure that bookmarks are updated correctly) and it doesn't give
any significant benefits.

Test Plan: arc unit

Reviewers: durham, rmcelroy, mitrandir

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677
2016-11-01 03:42:26 -07:00
Stanislau Hlebik
cf1214923e infinitepush: disable pushes to svn repo
Summary:
During infinitepush test we noticed that `hg push -r . --to SCRATCHBRANCH`
fails with stack trace in www. This is expected because infinitepush doesn't work
with svn servers. But it's better to print a nice error message instead of stack trace.

Test Plan:
Try to push to scratch bookmark from www without specifying path:
stash@dev1918 ~/www (344c6bf) $ hg push -r . --to hack/durhamstash
abort: infinite push does not work with svn repo
(Did you forget to `hg push default`?)
[Exit: 255]

Got nice error instead of stack trace.

Push to scratch bookmark from www with path specified works fine

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4103745:1477950448:14b5ae8484f3e65cb88c83b2628f73f3a670b1a0
2016-11-01 01:50:34 -07:00
Stanislau Hlebik
005a9ace91 infinitepush: bookmarks remote-list
Summary:
Add an option to list remote and scratch bookmarks by pattern.
Only very simple pattern is allowed: either the literal string
or a prefix (like 'scratch/stash/*'). It was made intentionally
to make sure that pattern requests are fast in mysql.

Mysql tests will be added to the integration tests

Test Plan: Run `test-infinitepush-*`

Reviewers: mitrandir, andrasbelo, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4074409:1477500968:e91cd2505d61a2f1db30c7f00cdcfc949e433507
2016-10-26 10:03:35 -07:00
Stanislau Hlebik
6086c2f0cb infinitepush fix: pass dest to the orig
Test Plan: Run `test-infinitepush-*`

Reviewers: durham, mitrandir, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4081739:1477498757:7e105e400fd99e0a6dcb80165a2ed9d9c6d1a548
2016-10-26 09:29:23 -07:00
Stanislau Hlebik
c15797e1dd infinitepush: ignore scranch branch if not set
Summary:
If `branchpattern` is not set then it matches empty bookmark.
It causes regressions like this t13808497. Let's ignore empty `branchpattern`

Test Plan: Run `test-infinitepush-*`

Reviewers: mitrandir, rmcelroy, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4031365:1476755541:3d3781ef92f1701500d74ce7b98b4d82b5a1228e
2016-10-18 01:21:18 -07:00
stash
b421695c98 infinitepush: do not require mysql for tests
Summary:
Tests doesn't require mysql since it uses fileindexapi.
Let's move sqlindexapi and fileindexapi to different files and include
only necessary file.

Test Plan: Run test-infinitepush-*

Reviewers: durham, simonfar, quark

Reviewed By: quark

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4029460:1476709161:556f80605db9bd3c18dce1e16e996b13bbe96229
2016-10-17 14:23:56 +01:00
Stanislau Hlebik
4b61f94df6 infinitepush: create separate remotenames test
Summary:
Fix infinitepush tests for Mac. Let's split test in two.
Now if remotenames extension is unavailable most of the tests will still run.

Test Plan: Run `python run-tests.py test-infinitepush-*`

Reviewers: simonfar, durham, rmcelroy, mitrandir, quark

Reviewed By: quark

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4029394:1476706777:95473f493e10d3f7f21f4679976b33d75d8821f2
2016-10-17 05:36:26 -07:00
Stanislau Hlebik
8bdaa46014 infinitepush: set scratch bookmark locally during push
Summary:
Previously `--to` bookmark was not set locally.
This diff fixes it by setting this bookmark to the head after push happened.
This is correct because it's guaranteed that we'll push only one head.

Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: durham, rmcelroy, mitrandir

Subscribers: mjpieters

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

Tasks: 12479677
2016-10-13 00:11:56 -07:00
Stanislau Hlebik
a4b6a2a1bb infinitepush: better error message
Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:4001218:1476227692:c60b3def4e82911a40fe577bc44cf7d24cba9438
2016-10-12 02:57:53 -07:00
Stanislau Hlebik
f1e2014203 infinitepush: add option to force non-fast-forward push
Summary:
Non-fast-forward pushes were disallowed. But having a
mutable shared history for scratch branches is a very
nice feature. Let's use --force option to force
non-fast forward push.

Test Plan: Run test-infinitepush-bundlestore.t

Reviewers: durham, rmcelroy, mitrandir

Subscribers: mjpieters

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

Tasks: 12479677
2016-10-10 03:48:21 -07:00
Stanislau Hlebik
4731550d0f infinitepush: output bookmark hash in tests
Summary:
Simple test improvement: output scratch bookmark name
together with scratch bookmark hash

Test Plan: Run test-infinitepush-bundlestore.t

Reviewers: durham, rmcelroy, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3994805:1476112139:a02c78dd8a117f99251e71827224bb368532052b
2016-10-10 08:37:04 -07:00
Stanislau Hlebik
d63ba71acf infinitepush: remove defaults
Summary: I think it's better throw if misconfigured then silently proceed

Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: durham, mitrandir, quark, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3967202:1475581664:9d7b3e21fce48a49eda35bde473915cb64dfdfa0
2016-10-04 04:52:31 -07:00
Stanislau Hlebik
e42fe1fdc5 infinitepush: do not require mysql.connector to be present on client
Summary:
Previously error was thrown if mysql.connector wasn't present on client hosts.
But there is no need for mysql.connector to be installed on clients.
Remove global imports to fix it and create bundlestore() only for server repo.

P. S.
Changes in test is required because bundlestore() is not created if
infinitepush.server=True is not present in config.

Test Plan:
Uninstall mysql.connector: `sudo yum remove mysql-connector-python`
Enable infinitepush extension in any repo and run any hg command (hg st,
for example). Make sure it doesn't throw exceptions.

Install mysql.connector: `sudo yum install mysql-connector-python`.
Run `test-infinitepush-bundlestore.t`

Reviewers: durham, mitrandir, quark, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3967189:1475581802:fbaafceac298242d0a449267ec0d68e290c3f262
2016-10-04 04:52:03 -07:00
Stanislau Hlebik
ddd4873227 infinitepush: temp remotenames fix
Summary:
Hack to fix interaction with remotenames. Remotenames push '--to' bookmark to the server but we don't want to push scratch bookmark to the server. Let's delete '--to' and '--create' and also set allow_anon to True (because if --to is not set remotenames will think that we are pushing anonymoush head).


Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: durham, mitrandir, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3937202:1475170335:fa4d39e1e17bea67b62b99dfc4cd2ffa4e5d6bea
2016-10-02 05:13:06 -07:00
Stanislau Hlebik
387f18b269 infinitepush: fix push of scratch bookmark on existing commit
Summary:
It's possible to push new scratch bookmark which points to existing scratch
commit. Previously it has failed with a stack trace.

Unfortunately it still doesn't allow to push scratch bookmark that points
to non-scratch commit. It requires more complex changes so
it will be fixed later if necessary.

Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3936728:1475078059:ac4588e086b0344070a90f806b6f518c6e187c3b
2016-10-02 03:05:50 -07:00
Stanislau Hlebik
ba3ebe099e infinitepush: fix interaction with pushrebase
Summary:
infinitepush bundle2 part should be run before pushrebase bundle2 part. This is a bit tricky since both pushrebase and infinitepush change the `extensions._order` and both of them try to load before bundle2 `changeset` part.

I suggest to load before 'changeset' or pushrebase part whichever is earlier. Then we have two situations:
1) pushrebase comes first. It sets it's part before 'changeset' part, then infinitepush sets it's part before pushrebase part.
2) infinitepush comes first. It sets part before 'changeset' and pushrebase part, then pushrebase sets it's part before 'changeset' part. Since infinitepush part comes before 'changeset' part it still be before pushrebase part.

This solution is not robust but it should be fine for now. The proper solution requires changes upstream that will introduce dependencies between bundle2 parts.

Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3930697:1475079064:1b5851df4d2067ec21ec01e7510ddf83ff1684ad
2016-10-02 02:54:03 -07:00
Stanislau Hlebik
24be1a2da5 infinitepush: add bundle-store option to push
Summary:
--bundle-store option makes push go to bundle store
even if bookmark is not specified or bookmark doesn't match scratch branch pattern.
The main reason for the `--bundle-store` is to be able to push not a scratch bookmark, but a scratch commit, for example, `hg push -r . --bundle-store`.
It will be useful when we will save all the local commits in the bundlestore.

To do this:
1) Wrap `discovery.checkheads()` to allow push to scratch branch even if new head is created.
2) Make scratchbranchpat params advisory because now bookmark may not be specified.

Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: mitrandir, rmcelroy, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3862665:1475077612:7e02a5bdc1da28161e45029b1e3a38fe8223a305
2016-09-28 13:17:25 -07:00
Jun Wu
fb6df93955 test-infinitepush: check mysql module before running tests
Summary:
`mysql` is required for the test. Otherwise it would error out:

```
   $ hg init repo
+  abort: No module named mysql!
+  [255]
   $ cd repo
```

Test Plan: Remove mysql python package and run the test, make sure it's skipped.

Reviewers: stash, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D3925440
2016-09-26 19:40:29 +01:00
Stanislau Hlebik
21b475a2f0 infinitepush: lint fixes
Summary:
Remove generic exception.
Remove trailing whitespace.
Remove unused import

#accept2ship

Test Plan: Run `test-check-code-hg.t` and `test-infinitepush-bundlestore.t`

Reviewers: #sourcecontrol, ttung, jeroenv

Reviewed By: jeroenv

Subscribers: mjpieters

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

Signature: t1:3876225:1474015261:adff2496c4e36f19e3315856f1a0102eb7e9dc7e
2016-09-16 01:45:33 -07:00
Stanislau Hlebik
754b5a4518 infinitepush: allow pulling one scratch and many non-scratch boomarks at the same time
Summary:
There is no point in disallowing it.
The next step is to allow to fetch arbitrary many scratch bookmarks with one command.

Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: durham, rmcelroy, mitrandir

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

Tasks: 12479677
2016-09-13 02:34:55 -07:00
Stanislau Hlebik
936dff7c8b infinitepush: record scratch bookmark changes after the pull
Summary:
scratchbookmarks are not automatically pulled (because they are not showed in
listkeys). Let's record them after the actual pull. It introduces a race
condition. But this race condition is unlikely and shouldn't be harmful.

Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: mjpieters, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3835414:1473703998:554c890be50f732f34b2793160ee1abb26561e39
2016-09-13 02:34:55 -07:00
Stanislau Hlebik
48389f12cc infinitepush: move integration test to the rool level directory
Differential Revision: https://phabricator.intern.facebook.com/D3791446
2016-08-31 01:44:59 -07:00