Patchwork [6,of,8] rebase: refactoring to avoid repetition of expression

login
register
mail settings
Submitter Laurent Charignon
Date Nov. 19, 2015, 1:46 p.m.
Message ID <1061df69f49fd4391263.1447940784@waste.org>
Download mbox | patch
Permalink /patch/11513/
State Accepted
Commit 4223fc58f952cd93592e3cd7302adb11a9136933
Headers show

Comments

Laurent Charignon - Nov. 19, 2015, 1:46 p.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1447891086 28800
#      Wed Nov 18 15:58:06 2015 -0800
# Node ID 1061df69f49fd43912633816e67601024d98d0ce
# Parent  237b66d6e2aca1eff4ad1e58299cd4413ce157bb
rebase: refactoring to avoid repetition of expression

This patch removes the repetition of "(revignored, revprecursor, revpruned)"
and replaces its occurences with the more legible "revskipped".

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -34,6 +34,7 @@ 
 revprecursor = -4
 # plain prune (no successor)
 revpruned = -5
+revskipped = (revignored, revprecursor, revpruned)
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
@@ -681,7 +682,7 @@ 
     elif p1n in state:
         if state[p1n] == nullmerge:
             p1 = target
-        elif state[p1n] in (revignored, revprecursor, revpruned):
+        elif state[p1n] in revskipped:
             p1 = nearestrebased(repo, p1n, state)
             if p1 is None:
                 p1 = target
@@ -697,7 +698,7 @@ 
         if p2n in state:
             if p1 == target: # p1n in targetancestors or external
                 p1 = state[p2n]
-            elif state[p2n] in (revignored, revprecursor, revpruned):
+            elif state[p2n] in revskipped:
                 p2 = nearestrebased(repo, p2n, state)
                 if p2 is None:
                     # no ancestors rebased yet, detach