Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bookmarks.py @ 22659:798185707833
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.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sun, 28 Sep 2014 14:07:56 -0700 |
parents | a8f0d8e4c80a |
children | 6bd685d2a2de |
line wrap: on
line diff
--- a/mercurial/bookmarks.py Sun Sep 28 13:43:31 2014 -0700 +++ b/mercurial/bookmarks.py Sun Sep 28 14:07:56 2014 -0700 @@ -358,6 +358,7 @@ 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 @@ 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"))