mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
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
This commit is contained in:
parent
763e41cee8
commit
1f65684b71
@ -515,18 +515,31 @@ def _update(orig, ui, repo, node=None, rev=None, **opts):
|
||||
raise error.Abort(_("please specify just one revision"))
|
||||
|
||||
if not opts.get('date') and (rev or node) not in repo:
|
||||
mayberemotenode = rev or node
|
||||
if len(mayberemotenode) == 40 and _maybehash(mayberemotenode):
|
||||
mayberemote = rev or node
|
||||
dopull = False
|
||||
kwargs = {}
|
||||
if _scratchbranchmatcher(mayberemote):
|
||||
dopull = True
|
||||
kwargs['bookmark'] = [mayberemote]
|
||||
elif len(mayberemote) == 40 and _maybehash(mayberemote):
|
||||
dopull = True
|
||||
kwargs['rev'] = [mayberemote]
|
||||
|
||||
if dopull:
|
||||
ui.warn(
|
||||
_("'%s' does not exist locally - looking for it " +
|
||||
"remotely...\n") % mayberemotenode)
|
||||
"remotely...\n") % mayberemote)
|
||||
# Try pulling node from remote repo
|
||||
try:
|
||||
commands.pull(ui, repo, rev=[mayberemotenode])
|
||||
cmdname = '^pull'
|
||||
pullcmd = commands.table[cmdname][0]
|
||||
pullopts = dict(opt[1:3] for opt in commands.table[cmdname][1])
|
||||
pullopts.update(kwargs)
|
||||
pullcmd(ui, repo, **pullopts)
|
||||
except Exception:
|
||||
ui.warn(_('pull failed: %s\n') % sys.exc_info()[1])
|
||||
else:
|
||||
ui.warn(_("'%s' found remotely\n") % mayberemotenode)
|
||||
ui.warn(_("'%s' found remotely\n") % mayberemote)
|
||||
return orig(ui, repo, node, rev, **opts)
|
||||
|
||||
def _pull(orig, ui, repo, source="default", **opts):
|
||||
|
@ -701,3 +701,32 @@ Trying to pull from bad path
|
||||
pull failed: repository $TESTTMP/client2/badpath not found
|
||||
abort: unknown revision 'c70aee6da07d7cdb9897375473690df3a8563339'!
|
||||
[255]
|
||||
|
||||
Strip commit and pull it using hg update with bookmark name
|
||||
$ hg strip -q d8fde0ddfc96
|
||||
$ hg book -d scratch/mybranch
|
||||
$ hg up scratch/mybranch
|
||||
'scratch/mybranch' does not exist locally - looking for it remotely...
|
||||
pulling from ssh://user@dummy/repo
|
||||
searching for changes
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 1 changes to 2 files
|
||||
(run 'hg update' to get a working copy)
|
||||
'scratch/mybranch' found remotely
|
||||
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
||||
(activating bookmark scratch/mybranch)
|
||||
$ hg log -G -T '{desc} {phase} {bookmarks} {node|short}'
|
||||
@ testpullbycommithash2 draft scratch/mybranch d8fde0ddfc96
|
||||
|
|
||||
| o publiccommit public scratch/scratchontopofpublic a79b6597f322
|
||||
| |
|
||||
o | testpullbycommithash1 draft 33910bfe6ffe
|
||||
|/
|
||||
| o scratchsecondpart draft scratch/secondpart 8db3891c220e
|
||||
|/
|
||||
| o scratchfirstpart draft scratch/firstpart 176993b87e39
|
||||
|/
|
||||
o initialcommit public 67145f466344
|
||||
|
||||
|
@ -36,7 +36,7 @@ Make pull and check that scratch commit is not pulled
|
||||
$ hg pull
|
||||
pulling from ssh://user@dummy/server
|
||||
no changes found
|
||||
$ hg up scratch/book
|
||||
$ hg log -r scratch/book
|
||||
abort: unknown revision 'scratch/book'!
|
||||
[255]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user