Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 20107:2ca325ea57fa stable
bookmarks: consider successor changesets when moving bookmark (issue4015)
Previously, this required -f because we didn't consider obsolete changesets
(and their children ... or successors of those children, etc.). We now use
obsolete.foreground to calculate acceptable changesets when advancing the
bookmark.
Test coverage has been added.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Wed, 06 Nov 2013 19:01:14 -0600 |
parents | 1dee888b22f7 |
children | af12f58e2aa0 aa192af94321 |
comparison
equal
deleted
inserted
replaced
20106:c33d9217e99d | 20107:2ca325ea57fa |
---|---|
834 # that contains a divergent bookmark | 834 # that contains a divergent bookmark |
835 if bmctx.rev() not in anc and target in divs: | 835 if bmctx.rev() not in anc and target in divs: |
836 bookmarks.deletedivergent(repo, [target], mark) | 836 bookmarks.deletedivergent(repo, [target], mark) |
837 return | 837 return |
838 | 838 |
839 # consider successor changesets as well | |
840 foreground = obsolete.foreground(repo, [marks[mark]]) | |
839 deletefrom = [b for b in divs | 841 deletefrom = [b for b in divs |
840 if repo[b].rev() in anc or b == target] | 842 if repo[b].rev() in anc or b == target] |
841 bookmarks.deletedivergent(repo, deletefrom, mark) | 843 bookmarks.deletedivergent(repo, deletefrom, mark) |
842 if bmctx.rev() in anc: | 844 if bmctx.rev() in anc or target in foreground: |
843 ui.status(_("moving bookmark '%s' forward from %s\n") % | 845 ui.status(_("moving bookmark '%s' forward from %s\n") % |
844 (mark, short(bmctx.node()))) | 846 (mark, short(bmctx.node()))) |
845 return | 847 return |
846 raise util.Abort(_("bookmark '%s' already exists " | 848 raise util.Abort(_("bookmark '%s' already exists " |
847 "(use -f to force)") % mark) | 849 "(use -f to force)") % mark) |