Commit Graph

117 Commits

Author SHA1 Message Date
stash@fb.com
d36fb477cb infinitepush: fix the build
Summary:
On macos sshpeer flushes remote output later and it causes tests to fail. Let's
add a call to cleanup() to make sure the output is flushed.

This diff also makes remotefilelog test more robust.

Test Plan: Run tests on macos

Reviewers: #mercurial, tja, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4721276:1489669109:4ce59f4a1d224d57dbb7c1eb341c4e6a659d2e8c
2017-03-16 08:35:15 -07:00
Stanislau Hlebik
6b7e94a53f infinitepush: add --all option to debugcheckbackup
Summary:
By default debugcheckbackup checks only one backup for the user.
With --all option it checks all backups for the user from all host/reporoots

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4700993:1489548921:800d08f420acc8ef4f807ffd17b31837dbb3fe82
2017-03-16 02:22:39 -07:00
Stanislau Hlebik
3553b5e9bb infinitepush: do not restore bookmark if node is not present
Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4700979:1489548965:bab126d96adc827be84a2fc8939f6c03b0ef6599
2017-03-16 02:22:39 -07:00
Stanislau Hlebik
280028dd61 infinitepush: add maxheadstobackup option
Summary:
Backing up very big repo can cause problems. And very often old commits are
not necessary at all. Let's add a config option to limit the number of heads
that are being backed up.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4700965:1489549163:4e2c121f01debd7b495486a1f3b062926873399d
2017-03-16 02:22:39 -07:00
Stanislau Hlebik
2faa6709ca infinitepush: change backup state file format
Summary:
Previously we saved bookmark hash and revision number as state of
the last backup. Storing last backed up revision is error-prone. I saw
a few corrupted backups where bookmarks pointed to non-backed up
nodes. Also this approach puts more pressure on mysql bundle index.
On every backup it first deletes all existing backup bookmarks and then it
writes new bookmarks. Even if user changed one head or one bookmark
(and that is the usual case) current approach still deletes bookmarks first
and then rewrites them.

Instead let's store all backed up heads and bookmarks locally in json format.
Json was chosen because it's simple and human-readable. Then during backup
let's compare last backed up state to the current state of the repo, and send
to the server only the difference.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4700930:1489613249:a34369bf53e0718c22258304493dfa27b578857f
2017-03-16 02:22:39 -07:00
Stanislau Hlebik
897faf2d06 infinitepush: refactor and rename _getbackupstate
Summary:
Let's rename _getbackupstate() to _downloadbackupstate() because it actually
downloads it from the server. Also return class instead of tuple

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4713633:1489612870:3439a6a99ef311bf96784b3b1e53d7e9b94c0713
2017-03-16 02:22:39 -07:00
Stanislau Hlebik
5ee9ad7feb infinitepush: add timestamp to the logs
Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 16474976

Signature: t1:4700897:1489550188:1c6346ff158cec32df92934b585fc9cb983397c6
2017-03-16 02:20:02 -07:00
Stanislau Hlebik
314a434baf infinitepush: better client-side logging
Summary: New logging will have rotation and will separate different users and repos

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 16474976

Signature: t1:4689191:1489172091:d304d4b19ae6cf52f86c11f442fa760b50d1fdf9
2017-03-14 02:13:16 -07:00
Stanislau Hlebik
ddf10d0f6e infinitepush: add debugwaitbackup command
Summary:
For now these command will be used in test because
`wait_for_background_backup.py` tied to the backup state file. And every change
to this file requires change to wait_for_background_backup.py. Let's create
simple internal backup command.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4667056:1489024344:6c43241e42b7c418baa4e1542f303239ba887c45
2017-03-13 01:35:30 -07:00
Stanislau Hlebik
af7ad809cc infinitepush: add lock for backup command
Summary:
There can be multiple backup processes running at the same time. Since these
processes can be quite heavy it makes sense to limit them. Let's use lock file
to do that.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4667020:1489170813:f2a685b1c224c553d3ee004d89d3eeeca816e824
2017-03-13 01:32:32 -07:00
Stanislau Hlebik
2d7e54cf5a infinitepush: rename nodes to hexnodes
Summary: These are actually hexnodes

Test Plan: arc unit

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4667011:1488991240:e0ba5e0bd58f753235e600ed31858bb565c62e73
2017-03-11 09:22:50 -08:00
Stanislau Hlebik
4c84f339fa infinitepush: add debugcheckbackup
Summary:
Command that checks that every head and bookmark node is present in the
bundlestore

Test Plan: arc unit

Reviewers: #mercurial

Subscribers: #sourcecontrol

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

Tasks: 15389402
2017-03-07 01:21:44 -08:00
Stanislau Hlebik
fcf0eb5724 infinitepush: move common restore functionality from pullbackup
Summary: This functionality will be used in command to check backup consistency

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4658433:1488828061:49aa5bfeba922d617cf1aab393f5e9f598aa33a4
2017-03-07 01:21:44 -08:00
Stanislau Hlebik
e3fa685103 infinitepush: rename node* to hexnode*
Summary: These are actually hexnodes, not nodes

Test Plan: arc unit

Reviewers: #mercurial, durham, mjpieters

Reviewed By: durham, mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4658432:1488828083:957018757fbe7031183bd54734702d4b67465fd8
2017-03-07 01:21:44 -08:00
Stanislau Hlebik
71158d5a7f infinitepush: first ask for hostname, then for reporoot
Summary:
This small change makes a way better user experience. Users usually have one
big repo per host, but they may have many hosts (for example, laptop and
devserver). If we ask for reporoot first then it's very likely that next
`pullbackup` invocation will fail because there will be ambigious hosts.
Let's switch the order.

Test Plan: arc unit

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4649946:1488561645:330590fcf1dcd4af7fb572c5d4ccfd8a5ab78c60
2017-03-06 00:56:18 -08:00
Stanislau Hlebik
1aa37581ea infinitepush: pass dest to pull function
Summary: Previously dest wasn't passed to pull command. This diff fixes it.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4643461:1488501956:4684805c618d55edcf4ee1ae13d34a87e92150e6
2017-03-06 00:50:30 -08:00
Stanislau Hlebik
9a343a289b infinitepush: add user cmd-line option
Summary: Option to specify whose backup to restore

Test Plan: arc unit

Reviewers: #mercurial

Subscribers: #sourcecontrol

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

Tasks: 15389402
2017-03-06 00:44:18 -08:00
Stanislau Hlebik
6218797f5c infinitepush: pass username instead of ui
Summary:
Next diff will add special option to specify whose backup to restore.
This diff does a necessary refactoring

Test Plan: arc unit

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4650282:1488562203:632a8c84d6d537663bd7d94ce9dfd18a4498ccfb
2017-03-06 00:44:18 -08:00
Stanislau Hlebik
666f7299d3 infinitepush: reuse bundlerepo
Summary:
This diff is part of the series to avoid downloading the same bundle
a few times.

Finally reuse the same bundlerepo.

Test Plan: arc unit

Reviewers: #mercurial

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402
2017-03-06 00:40:49 -08:00
Stanislau Hlebik
29031ff4a1 infinitepush: close all bundlerepos at once
Summary:
This diff is part of the series to avoid downloading the same bundle
a few times.

Now close all bundlerepos at once not one by one. This is necessary because
bundlerepos will be reused.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4612089:1488501776:e9fc2863adebc69bf44fa5dcb1610612027508f6
2017-03-06 00:40:49 -08:00
Stanislau Hlebik
c615f4e1d8 infinitepush: small refactoring
Summary:
This diff is part of the series to avoid downloading the same bundle
a few times.

Test Plan: arc unti

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4612073:1487955965:03af1a25acc21d0b6d913a60dd5ef82fa7f033ad
2017-03-06 00:40:49 -08:00
Stanislau Hlebik
ce7e4ac2e0 infinitepush: use util.getuser() instead of ui.username()
Summary:
There are a couple of reasons to avoid using ui.username():
1) If config option ui.username is set on the server then it will use it
instead of the name of the user that does push
2) It prints confusing warning `no username found, using '....' instead`
3) In some cases it fails (probably because it calls socket.getfqdn() which
does network request).

Let's use simple util.getuser() function and set username to 'unknown' if
it fails.

Test Plan: arc unit

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: azich, mjpieters, #sourcecontrol

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

Signature: t1:4642457:1488458040:5dfac435bf44dfa6ab7725d2f5800963e8c860ec
2017-03-02 04:47:21 -08: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
adc7118a2b infinitepush: use unwrapfunction
Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Signature: t1:4605190:1487934139:b9cc591e7ceb70b9a8350ae82400ede3e6603402
2017-02-24 05:35:30 -08:00
Stanislau Hlebik
7dbfae7df1 infinitepush: skip secret commits during backup
Summary:
discovery.findcommonoutgoing() explicitly skips secret commits. Because of it
we also need to skip bookmarks that point to secret commits, otherwise they
will point to non-existent nodes.

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4611393:1487933210:72e79923c944b13204f4cde64d415076703bbe47
2017-02-24 05:33:15 -08:00
Stanislau Hlebik
295880f660 infinitepush: add docs for config options
Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters

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

Signature: t1:4590918:1487682839:fb65d327f49d2cf5922b995889fe6de7f0bb24ea
2017-02-23 04:25:02 -08:00
Stanislau Hlebik
6d667d9cc2 infinitepush: get rid of useless variable
Summary:
hasscratchbookmarks is True if scratchbookmarks is not empty and vice-versa.
No need to use this variable

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters

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

Signature: t1:4590917:1487682597:c2a6e0accbd8e539a885dd11e6819986e57d24df
2017-02-23 04:25:02 -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
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
f5752faf6f infinitepush: renaming
Test Plan: arc unit

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D4564630
2017-02-15 09:34:08 -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
884b93b864 infinitepush: fix string formatting
Summary: Pass one parameter instead of two.

Test Plan: arc unit

Reviewers: #sourcecontrol, andrasbelo

Reviewed By: andrasbelo

Subscribers: andrasbelo, mjpieters

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

Signature: t1:4507175:1486121145:4d4f72514a42c8f854b2b7ef03694b0cb82a3030
2017-02-03 07:10:53 -08:00
Stanislau Hlebik
e6f821ac7d infinitepush: add locktimeout
Summary:
Default lock timeout value is very small (around couple of secs).
Let's set it for something bigger by default

Test Plan: arc unit

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 15389402

Signature: t1:4435236:1484880747:d46276a82782ef551cda0165dea686f267c13ff9
2017-01-24 10:32:44 -08:00
Stanislau Hlebik
de42ed040d infinitepush: log bundlesize server-side
Test Plan: Run `test-infinitepush-*`

Reviewers: durham, mitrandir, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters, #sourcecontrol

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

Signature: t1:4392126:1484067479:089df33d8a1d682fdd3a6393bbc30e8c7147e104
2017-01-10 09:25:46 -08:00
Stanislau Hlebik
0e50fa2aa0 infinitepush: wrap deltaparent function
Summary:
On a big repo with many old heads bundle that is sent to the server can become
big (in some cases even 500 Mb). That looks like a waste of bundlestore space
and will probably make backup and restore slower. Most of the space is taken
by manifest deltas because it prefers to diff manifest against previous commit
in the bundle. There are two possible approaches to reduce the size:
1) Send many small bundles (for example, one bundle per head)
2) Wrap deltaparent function and diff against actual parent previous commit in the bundle.

I chose the second approach for the following reasons:
1) It's easier to implement (main reason)
2) Many bundles probably means slower restore because there will be many requests to the bundlestore instead of just one

With this diff bundle size was reduced from 500 Mb to 8 Mb.

It can potentially increase CPU usage. I'm not sure how bad is it and will investigate it more.

Test Plan: Run `test-infinitepush-*`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: simpkins, mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4384053:1483664446:62ec30fad433e8d279758926199a8330cb73ed2b
2017-01-09 01:42:02 -08:00
Stanislau Hlebik
486dcee7f9 infinitepush: do not backup nodes if there are no filelogs client and server
Summary:
If client pulled a commit without filelogs (because of remotefilelog) and
this commit was later stripped on the server, then attempt to backup this
commit fails because of missing filelogs. It's a rare issue but unfortunately
it happens sometimes. To fix it let's exclude from the backup all the
commits and their descendants that doesn't have all necessary filelogs.

Test Plan: Run infinitepush tests

Reviewers: mitrandir, rmcelroy, durham

Reviewed By: rmcelroy

Subscribers: mjpieters, #sourcecontrol

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

Signature: t1:4365747:1483466164:560cdf5cd2369cd2603dfd0fe6b30d7a70951f00
2017-01-09 01:40:02 -08:00
Stanislau Hlebik
3fb0fd4e22 infinitepush: remove unused code
Test Plan: Run `test-infinitepush-*`

Reviewers: durham, mitrandir, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters, #sourcecontrol

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

Signature: t1:4387358:1483725059:8627e5651bae83fc535b69eca50aeeb4fdb5f673
2017-01-09 01:35:05 -08:00
Stanislau Hlebik
d79a6edd00 infinitepush: backupcommands refactoring
Summary:
`pushbackup` command became huge. This diff splits it into a few
smaller functions

Test Plan: Run `test-infinitepush-*`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4384008:1483659549:a97b63a38b702a55d19cf6b47a6fd6b2547b9168
2017-01-06 04:21:23 -08:00
Stanislau Hlebik
2ac4b441e0 infinitepush: refactoring
Summary: __init__.py became huge and I suggest to split it

Test Plan: Run `test-infinitepush-*`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4383661:1483659134:eaf3d7e217633895a65ad568831d9c21ea0f18d8
2017-01-06 04:15:16 -08:00
Stanislau Hlebik
1e60aa26a6 infinitepush: remove unused code
Test Plan: Run `test-infinitepush-*`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4383652:1483658724:5b3e92195c015cd11c88c89d778271c3e2ec88aa
2017-01-06 04:13:35 -08:00
Stanislau Hlebik
2326d2caae infinitepush: fix nothing to push bug
Summary:
`pushbackup` failed when there are hidden heads in the repo but no visible
heads (see test for example). This diff fixes it.

Test Plan: Run `test-infinitepush-*`

Reviewers: durham, mitrandir, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4365677:1483465909:fd1d96211909d3eeccab4fd17a364af4a1997f85
2017-01-04 00:51:45 -08:00
Durham Goode
bdb60ea581 infinitepush: use cross-platform friendly bash syntax
Summary:
The '&>>' operator only works in linux, not OSX. So let's replace it with a more
verbose equivalent.  'man bash' says these two are equivalent.

Test Plan:
Running the tests normally on OSX don't actually catch this, because
this particular test is skipped because it doesn't see that evolve is installed.
We need to run the tests with:

  PYTHONPATH=/opt/facebook/hg/lib/python2.7/site-packages/:/opt/homebrew/lib/python2.7/site-packages/ /opt/homebrew/opt/python27/bin/python2.7 ../../facebook-hg-rpms/hg-crew/tests/run-tests.py test-infinitepush-backup.t

To get coverage. And the test is now passing on OSX and linux.

Reviewers: stash, #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

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

Signature: t1:4379593:1483488383:ce8a045bbc29d719eafa372db56453b83f1d8df8
2017-01-03 16:08:36 -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
6d29203ee5 infinitepush: use dest parameter in background backups
Summary:
Default path was used during background backup even if non-default path was
passed on the command line. So `hg push somepath --background` is
equivalent to `hg push --background`. This is not correct and this diff fixes it


Test Plan: Run `test-infinitepush-*`

Reviewers: durham, rmcelroy, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4357295:1482330125:d2b043f8035046ab43667b4387bf642e53261681
2016-12-21 07:44:51 -08:00
Stanislau Hlebik
8c14ed67f3 infinitepush: add new fields to the log
Summary: Add `errormsg` and `reponame`

Test Plan: Run `test-infinitepush-*`

Reviewers: durham, rmcelroy, mitrandir, andrasbelo

Reviewed By: andrasbelo

Subscribers: andrasbelo, mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4339606:1482312794:15c04789ba03059c9a178d1adcf2bd09d9cf7b57
2016-12-21 01:41:44 -08:00
Durham Goode
08a77d4294 infinitepush: fix regex formating
In Python 2.6 we need to explicitly number all the '{}' format entries. This was
breaking the Centos6 build.
2016-12-16 17:29:04 -08:00
Stanislau Hlebik
feecb32f3a infinitepush: pullbackup command
Summary:
As the name suggest it will restore backup made by `hg pushbackup`.

If user has only one backup for the `dest` repo then it will be restored.
But user may have backed up many local repos that points to `dest` repo.
These local repos may reside on different hosts or in different
repo roots. It makes restore ambiguous; `--reporoot` and `--hostname`
options are used to disambiguate.

Example situation:
1) User has only one laptop with mercurial repo `repo` that was cloned
from remote server. He or she run `hg pushbackup`. Then laptop breaks
and user gets a new one, clones the `repo` again and runs `hg restore`.
It automatically restores the backup.
2) User has devserver and laptop and backups were made from both.
Then if user decides to switch devserver and run `hg restore` on the new
devserver he or she has to specify `--hostname`.


Future plans:
1) Add `--user` option to make it possible to restore another user's backup

Test Plan: Run `test-infinitepush-*`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4280832:1481565335:2a21ceafa2ff80242076a79693046514434afb40
2016-12-16 08:29:08 -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
06231c630a infinitepush: add cleanup
Summary:
`bundlerepo` should be closed to ensure that temp file is deleted.
`bundlerepo` creates temp file when bundle is compressed. This is *not* the
case in infinitepush (all our bundle are uncompressed). But seems that
upstream cg1unpacker.compressed() returns True even if bundle is uncompressed.

Also this diff makes `_getoutputbundleraw()` read output bundle in memory
instead of returning a generator. The reason for doing it is because generator
becomes invalid as soon as `bundlerepo` is closed.
This approach will obviously increase memory usage but it shouldn't be a
problem since bundles are small (no more than 10s Mb).

#thanks @quark for reporting it

Test Plan: Run `test-infinitepush-*`

Reviewers: durham, rmcelroy, mitrandir, quark

Reviewed By: quark

Subscribers: quark, mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4327186:1481738559:2c6b22c305da4d572da9de21dfdf1179f7281744
2016-12-14 12:26:30 -08:00