Patchwork [6,of,6,V3] commands: use bookmarks.validdest instead of duplicating logic

mail settings
Submitter Sean Farley
Date Jan. 16, 2014, 12:34 a.m.
Message ID <2eb8f8974a88c824686f.1389832461@laptop.local>
Download mbox | patch
Permalink /patch/3337/
State Superseded
Commit 2cfb720592feb329eb5597100c3fc5dd48bafb15
Headers show


Sean Farley - Jan. 16, 2014, 12:34 a.m.
# HG changeset patch
# User Sean Farley <>
# Date 1389830113 21600
#      Wed Jan 15 17:55:13 2014 -0600
# Node ID 2eb8f8974a88c824686fbf4ba9e1034b02cfbd65
# Parent  87fdc623c818bb7b7ed930d5e06f6ce122c6d1a3
commands: use bookmarks.validdest instead of duplicating logic

Now that has grown a validdest method that even handles successor
changesets, we use that instead of duplicating the logic in


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -832,16 +832,14 @@  def bookmark(ui, repo, *names, **opts):
                 # that contains a divergent bookmark
                 if bmctx.rev() not in anc and target in divs:
                     bookmarks.deletedivergent(repo, [target], mark)
-                # consider successor changesets as well
-                foreground = obsolete.foreground(repo, [marks[mark]])
                 deletefrom = [b for b in divs
                               if repo[b].rev() in anc or b == target]
                 bookmarks.deletedivergent(repo, deletefrom, mark)
-                if bmctx.rev() in anc or target in foreground:
+                if bookmarks.validdest(repo, bmctx, repo[target]):
                     ui.status(_("moving bookmark '%s' forward from %s\n") %
                               (mark, short(bmctx.node())))
             raise util.Abort(_("bookmark '%s' already exists "
                                "(use -f to force)") % mark)