[PATCH 2 of 2 evolve-ext] resolves 6028: return return (False, None) instead of return (False, '')

James Reynolds james.glenn.reynolds at gmail.com
Tue Dec 4 16:11:14 EST 2018


# HG changeset patch
# User James Reynolds <james.glenn.reynolds at gmail.com>
# Date 1543952045 18000
#      Tue Dec 04 14:34:05 2018 -0500
# Branch stable
# Node ID 6ea3ff2517b9ebf12f0678f28c9942c45c5924ce
# Parent  91aec886fc8701398182ab83adcdc04c86735c1d
# EXP-Topic issue6028
resolves 6028: return return (False, None) instead of return (False, '')
 - repo[] no longer takes an emptry string

diff -r 91aec886fc87 -r 6ea3ff2517b9 hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Tue Dec 04 14:56:19 2018 -0500
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Dec 04 14:34:05 2018 -0500
@@ -61,7 +61,7 @@
         bool: a boolean value indicating whether the instability was solved
         newnode: if bool is True, then the newnode of the resultant commit
                  formed. newnode can be node, when resolution led to no new
-                 commit. If bool is False, this is ''.
+                 commit. If bool is False, this is None.
     """
     displayer = None
     if stacktmplt:
@@ -101,7 +101,7 @@
         bool: a boolean value indicating whether the instability was solved
         newnode: if bool is True, then the newnode of the resultant commit
                  formed. newnode can be node, when resolution led to no new
-                 commit. If bool is False, this is ''.
+                 commit. If bool is False, this is None.
     """
     pctx = orig.p1()
     keepbranch = orig.p1().branch() != orig.branch()
@@ -125,7 +125,7 @@
 
     if not pctx.obsolete():
         ui.warn(_("cannot solve instability of %s, skipping\n") % orig)
-        return (False, '')
+        return (False, None)
     obs = pctx
     newer = obsutil.successorssets(repo, obs.node())
     # search of a parent which is not killed
@@ -139,7 +139,7 @@
         msg = _("skipping %s: divergent rewriting. can't choose "
                 "destination\n") % obs
         ui.write_err(msg)
-        return (False, '')
+        return (False, None)
     targets = newer[0]
     assert targets
     if len(targets) > 1:
@@ -157,7 +157,7 @@
                         "ambiguous destination: "
                         "parent split across two branches\n")
                 ui.write_err(msg)
-                return (False, '')
+                return (False, None)
             target = repo[selectedrev]
         else:
             target = repo[heads.first()]
@@ -177,7 +177,7 @@
     todo = 'hg rebase -r %s -d %s\n' % (orig, target)
     if dryrun:
         repo.ui.write(todo)
-        return (False, '')
+        return (False, None)
     else:
         repo.ui.note(todo)
         if progresscb:
@@ -201,7 +201,7 @@
         bool: a boolean value indicating whether the instability was solved
         newnode: if bool is True, then the newnode of the resultant commit
                  formed. newnode can be node, when resolution led to no new
-                 commit. If bool is False, this is ''.
+                 commit. If bool is False, this is None.
     """
     repo = repo.unfiltered()
     bumped = repo[bumped.rev()]
@@ -209,14 +209,14 @@
     if len(bumped.parents()) > 1:
         msg = _('skipping %s : we do not handle merge yet\n') % bumped
         ui.write_err(msg)
-        return (False, '')
+        return (False, None)
     prec = repo.set('last(allprecursors(%d) and public())', bumped.rev()).next()
     # For now we deny target merge
     if len(prec.parents()) > 1:
         msg = _('skipping: %s: public version is a merge, '
                 'this is not handled yet\n') % prec
         ui.write_err(msg)
-        return (False, '')
+        return (False, None)
 
     if not ui.quiet or confirm:
         repo.ui.write(_('recreate:'), label='evolve.operation')
@@ -232,7 +232,7 @@
         repo.ui.write(('hg revert --all --rev %s;\n' % bumped))
         repo.ui.write(('hg commit --msg "%s update to %s"\n' %
                        (TROUBLES['PHASEDIVERGENT'], bumped)))
-        return (False, '')
+        return (False, None)
     if progresscb:
         progresscb()
     tmpctx = bumped
@@ -343,7 +343,7 @@
         bool: a boolean value indicating whether the instability was solved
         newnode: if bool is True, then the newnode of the resultant commit
                  formed. newnode can be node, when resolution led to no new
-                 commit. If bool is False, this is ''.
+                 commit. If bool is False, this is None.
     """
     repo = repo.unfiltered()
     divergent = repo[divergent.rev()]
@@ -376,7 +376,7 @@
                 "| You should contact your local evolution Guru for help.\n"
                 ) % (divergent, TROUBLES['CONTENTDIVERGENT'], othersstr)
         ui.write_err(msg)
-        return (False, '')
+        return (False, None)
     other = others[0]
     evolvestate['other-divergent'] = other.node()
     evolvestate['base'] = base.node()
@@ -390,7 +390,7 @@
                  "| This probably means redoing the merge and using \n"
                  "| `hg prune` to kill older version.\n")
         ui.write_err(hint)
-        return (False, '')
+        return (False, None)
 
     otherp1 = other.p1().rev()
     divp1 = divergent.p1().rev()
@@ -450,7 +450,7 @@
                  ) % {'d': divergent, 'o': other}
         ui.write_err(msg)
         ui.write_err(hint)
-        return (False, '')
+        return (False, None)
 
     if not ui.quiet or confirm:
         ui.write(_('merge:'), label='evolve.operation')
@@ -470,7 +470,7 @@
         ui.write(('hg revert --all --rev tip &&\n'))
         ui.write(('hg commit -m "`hg log -r %s --template={desc}`";\n'
                  % divergent))
-        return (False, '')
+        return (False, None)
 
     evolvestate['resolutionparent'] = resolutionparent
     # relocate the other divergent if required


More information about the Mercurial-devel mailing list