Patchwork [4,of,6] pushbookmark: remove a <cond> and <val> or <other> construct

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 18, 2014, 9:50 p.m.
Message ID <35c3e0ecdddf3d777f48.1408398602@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5476/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 18, 2014, 9:50 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1408150695 25200
#      Fri Aug 15 17:58:15 2014 -0700
# Node ID 35c3e0ecdddf3d777f48f978788c5e418967f0f2
# Parent  032e5a4ffd4341b22f2135d26cd8172e64cabfb6
pushbookmark: remove a <cond> and <val> or <other> construct

We make the conditional explicit for the sake of readability.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -615,12 +615,14 @@  def _pushbookmark(pushop):
     """Update bookmark position on remote"""
     ui = pushop.ui
     repo = pushop.repo.unfiltered()
     remote = pushop.remote
     ui.debug("checking for updated bookmarks\n")
-    revnums = map(repo.changelog.rev, pushop.revs or [])
-    ancestors = repo.changelog.ancestors(revnums, inclusive=True)
+    ancestors = ()
+    if pushop.revs:
+        revnums = map(repo.changelog.rev, pushop.revs)
+        ancestors = repo.changelog.ancestors(revnums, inclusive=True)
     (addsrc, adddst, advsrc, advdst, diverge, differ, invalid
      ) = bookmarks.compare(repo, repo._bookmarks, remote.listkeys('bookmarks'),
                            srchex=hex)
 
     for b, scid, dcid in advsrc: