mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
pull: merge bookmark updates and imports
We do all the things in one go now, updating existing bookmark, adding new ones, and overwriting the ones explicitly specified for --bookmark. This impacts the tests by removing some duplicated or unnecessary output.
This commit is contained in:
parent
3cfceb8bab
commit
23ce37ca7e
@ -358,6 +358,7 @@ def updatefromremote(ui, repo, remotemarks, path, explicit=()):
|
||||
if ui.configbool('ui', 'quietbookmarkmove', False):
|
||||
status = warn = ui.debug
|
||||
|
||||
explicit = set(explicit)
|
||||
changed = []
|
||||
for b, scid, dcid in addsrc:
|
||||
if scid in repo: # add remote bookmarks for changes we already have
|
||||
@ -366,23 +367,30 @@ def updatefromremote(ui, repo, remotemarks, path, explicit=()):
|
||||
for b, scid, dcid in advsrc:
|
||||
changed.append((b, bin(scid), status,
|
||||
_("updating bookmark %s\n") % (b)))
|
||||
# remove normal movement from explicit set
|
||||
explicit.difference_update(d[0] for d in changed)
|
||||
|
||||
for b, scid, dcid in diverge:
|
||||
db = _diverge(ui, b, path, localmarks)
|
||||
changed.append((db, bin(scid), warn,
|
||||
_("divergent bookmark %s stored as %s\n") % (b, db)))
|
||||
if b in explicit:
|
||||
explicit.discard(b)
|
||||
changed.append((b, bin(scid), status,
|
||||
_("importing bookmark %s\n") % (b, b)))
|
||||
else:
|
||||
db = _diverge(ui, b, path, localmarks)
|
||||
changed.append((db, bin(scid), warn,
|
||||
_("divergent bookmark %s stored as %s\n")
|
||||
% (b, db)))
|
||||
for b, scid, dcid in adddst + advdst:
|
||||
if b in explicit:
|
||||
explicit.discard(b)
|
||||
changed.append((b, bin(scid), status,
|
||||
_("importing bookmark %s\n") % (b, b)))
|
||||
|
||||
if changed:
|
||||
for b, node, writer, msg in sorted(changed):
|
||||
localmarks[b] = node
|
||||
writer(msg)
|
||||
localmarks.write()
|
||||
# update specified bookmarks
|
||||
if explicit:
|
||||
marks = repo._bookmarks
|
||||
for b in explicit:
|
||||
# explicit pull overrides local bookmark if any
|
||||
repo.ui.status(_("importing bookmark %s\n") % b)
|
||||
marks[b] = repo[remotemarks[b]].node()
|
||||
marks.write()
|
||||
|
||||
def diff(ui, dst, src):
|
||||
ui.status(_("searching for changed bookmarks\n"))
|
||||
|
@ -61,7 +61,6 @@ import bookmark by name
|
||||
$ hg pull -B X ../a
|
||||
pulling from ../a
|
||||
no changes found
|
||||
importing bookmark X
|
||||
$ hg bookmark
|
||||
X 0:4e3505fd9583
|
||||
* Y 0:4e3505fd9583
|
||||
@ -373,7 +372,6 @@ hgweb
|
||||
adding remote bookmark Z
|
||||
adding remote bookmark foo
|
||||
adding remote bookmark foobar
|
||||
importing bookmark Z
|
||||
$ hg clone http://localhost:$HGPORT/ cloned-bookmarks
|
||||
requesting all changes
|
||||
adding changesets
|
||||
|
@ -906,7 +906,6 @@ pull over ssh
|
||||
added 1 changesets with 1 changes to 1 files (+1 heads)
|
||||
1 new obsolescence markers
|
||||
updating bookmark book_02de
|
||||
importing bookmark book_02de
|
||||
(run 'hg heads' to see heads, 'hg merge' to merge)
|
||||
$ hg -R other debugobsolete
|
||||
1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
|
||||
@ -928,7 +927,6 @@ pull over http
|
||||
added 1 changesets with 1 changes to 1 files (+1 heads)
|
||||
1 new obsolescence markers
|
||||
updating bookmark book_42cc
|
||||
importing bookmark book_42cc
|
||||
(run 'hg heads .' to see heads, 'hg merge' to merge)
|
||||
$ cat main-error.log
|
||||
$ hg -R other debugobsolete
|
||||
|
@ -200,7 +200,6 @@ listkeys hook
|
||||
no changes found
|
||||
listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
|
||||
adding remote bookmark bar
|
||||
importing bookmark bar
|
||||
$ cd ../a
|
||||
|
||||
test that prepushkey can prevent incoming keys
|
||||
|
@ -197,7 +197,6 @@ test pushkeys and bookmarks
|
||||
pulling from ssh://user@dummy/remote
|
||||
no changes found
|
||||
updating bookmark foo
|
||||
importing bookmark foo
|
||||
$ hg book -d foo
|
||||
$ hg push -B foo
|
||||
pushing to ssh://user@dummy/remote
|
||||
|
Loading…
Reference in New Issue
Block a user