Patchwork [2,of,4,V2] mergecmd: simplify conditional

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 22, 2015, 8:53 a.m.
Message ID <5364330da26eac96bc76.1442912003@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10571/
State Accepted
Headers show

Comments

Pierre-Yves David - Sept. 22, 2015, 8:53 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1442519092 25200
#      Thu Sep 17 12:44:52 2015 -0700
# Node ID 5364330da26eac96bc76e45bc84388506ac58aac
# Parent  a2c1596974fc6975f6f6a7e48b8bbb2682e52388
mergecmd: simplify conditional

The previous if test the same thing with 'if repo._activebookmark'. We make the
if/else logic clearer before a bigger refactoring.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4783,11 +4783,11 @@  def merge(ui, repo, node=None, **opts):
         elif len(bmheads) <= 1:
             raise util.Abort(_("no matching bookmark to merge - "
                 "please merge with an explicit rev or bookmark"),
                 hint=_("run 'hg heads' to see all heads"))
 
-    if not node and not repo._activebookmark:
+    elif not node:
         branch = repo[None].branch()
         bheads = repo.branchheads(branch)
         nbhs = [bh for bh in bheads if not repo[bh].bookmarks()]
 
         if len(nbhs) > 2: