Mercurial > hg
changeset 18514:2a1fac3650a5 stable
rebase: delete divergent bookmarks on destination (issue3685)
Similar to merge, divergent bookmarks are only deleted when the bookmark is on
the destination parent.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 30 Jan 2013 16:08:32 -0800 |
parents | 37ce336ab2dd |
children | bf8bbbf4aa45 f01df0ff3aa2 |
files | hgext/rebase.py tests/test-rebase-bookmarks.t |
diffstat | 2 files changed, 25 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/rebase.py Wed Jan 30 15:35:00 2013 -0800 +++ b/hgext/rebase.py Wed Jan 30 16:08:32 2013 -0800 @@ -316,7 +316,7 @@ clearrebased(ui, repo, state, skipped, collapsedas) if currentbookmarks: - updatebookmarks(repo, nstate, currentbookmarks, **opts) + updatebookmarks(repo, dest, nstate, currentbookmarks) clearstatus(repo) ui.note(_("rebase completed\n")) @@ -493,13 +493,15 @@ mq.seriesdirty = True mq.savedirty() -def updatebookmarks(repo, nstate, originalbookmarks, **opts): - 'Move bookmarks to their correct changesets' +def updatebookmarks(repo, dest, nstate, originalbookmarks): + 'Move bookmarks to their correct changesets, and delete divergent ones' + destnode = dest.node() marks = repo._bookmarks for k, v in originalbookmarks.iteritems(): if v in nstate: # update the bookmarks for revs that have moved marks[k] = nstate[v] + bookmarks.deletedivergent(repo, [destnode], k) marks.write()
--- a/tests/test-rebase-bookmarks.t Wed Jan 30 15:35:00 2013 -0800 +++ b/tests/test-rebase-bookmarks.t Wed Jan 30 16:08:32 2013 -0800 @@ -56,17 +56,35 @@ $ cd a1 $ hg up -q Z +Test deleting divergent bookmarks from dest (issue3685) + + $ hg book -r 3 Z@diverge + +... and also test that bookmarks not on dest or not being moved aren't deleted + + $ hg book -r 3 X@diverge + $ hg book -r 0 Y@diverge + + $ hg tglog + o 3: 'D' bookmarks: W X@diverge Z@diverge + | + | @ 2: 'C' bookmarks: Y Z + | | + | o 1: 'B' bookmarks: X + |/ + o 0: 'A' bookmarks: Y@diverge + $ hg rebase -s Y -d 3 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) $ hg tglog @ 3: 'C' bookmarks: Y Z | - o 2: 'D' bookmarks: W + o 2: 'D' bookmarks: W X@diverge | | o 1: 'B' bookmarks: X |/ - o 0: 'A' bookmarks: + o 0: 'A' bookmarks: Y@diverge Keep bookmarks to the correct rebased changeset