evolve: make most line lenghts 80 characters or less stable
authorAngel Ezquerra <angel.ezquerra@gmail.com>
Tue, 29 Apr 2014 22:25:57 +0200
branchstable
changeset 949 2b2a4ab0eb68
parent 948 b2b3d5aa16bc
child 950 cf4dcf49d998
child 965 cd24a87e3042
child 966 35492ab5b33b
evolve: make most line lenghts 80 characters or less There are still a few lines that are above 80 characters in length. Those have not been changed because doing so would make the code a bit less clear.
hgext/evolve.py
--- a/hgext/evolve.py	Tue Apr 29 22:25:48 2014 +0200
+++ b/hgext/evolve.py	Tue Apr 29 22:25:57 2014 +0200
@@ -352,9 +352,11 @@
     if ui.config('alias', 'olog', None) is None:
         ui.setconfig('alias', 'olog', "log -r 'precursors(.)' --hidden")
     if ui.config('alias', 'odiff', None) is None:
-        ui.setconfig('alias', 'odiff', "diff --hidden --rev 'limit(precursors(.),1)' --rev .")
+        ui.setconfig('alias', 'odiff',
+            "diff --hidden --rev 'limit(precursors(.),1)' --rev .")
     if ui.config('alias', 'grab', None) is None:
-        ui.setconfig('alias', 'grab', "! $HG rebase --dest . --rev $@ && $HG up tip")
+        ui.setconfig('alias', 'grab',
+            "! $HG rebase --dest . --rev $@ && $HG up tip")
 
 
 ### Troubled revset symbol
@@ -560,9 +562,12 @@
     # workaround phase stupidity
     #phases._filterunknown(ui, repo.changelog, repo._phasecache.phaseroots)
     filtered = repo.changelog.filteredrevs
-    newunstables = len(set(getrevs(repo, 'unstable')) - filtered) - priorunstables
-    newbumpeds = len(set(getrevs(repo, 'bumped')) - filtered) - priorbumpeds
-    newdivergents = len(set(getrevs(repo, 'divergent')) - filtered) - priordivergents
+    newunstables = \
+        len(set(getrevs(repo, 'unstable')) - filtered) - priorunstables
+    newbumpeds = \
+        len(set(getrevs(repo, 'bumped')) - filtered) - priorbumpeds
+    newdivergents = \
+        len(set(getrevs(repo, 'divergent')) - filtered) - priordivergents
     if newunstables > 0:
         ui.warn(_('%i new unstable changesets\n') % newunstables)
     if newbumpeds > 0:
@@ -743,7 +748,8 @@
             raise util.Abort(_('tried to relocate a node on top of itself'),
                              hint=_("This shouldn't happen. If you still "
                                     "need to move changesets, please do so "
-                                    "manually with nothing to rebase - working directory parent is also destination"))
+                                    "manually with nothing to rebase - working "
+                                    "directory parent is also destination"))
 
         rebase = extensions.find('rebase')
         # dummy state to trick rebase node
@@ -857,7 +863,8 @@
 
 
 @command('^evolve|stabilize|solve',
-    [('n', 'dry-run', False, 'do not perform actions, just print what would be done'),
+    [('n', 'dry-run', False,
+        'do not perform actions, just print what would be done'),
     ('A', 'any', False, 'evolve any troubled changeset'),
     ('a', 'all', False, 'evolve all troubled changesets'),
     ('c', 'continue', False, 'continue an interrupted evolution'), ],
@@ -902,7 +909,8 @@
     tr = _picknexttroubled(ui, repo, anyopt or allopt)
     if tr is None:
         if repo['.'].obsolete():
-            displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
+            displayer = cmdutil.show_changeset(
+                ui, repo, {'template': shorttemplate})
             successors = set()
 
             for successorsset in obsolete.successorssets(repo, repo['.'].node()):
@@ -1074,7 +1082,8 @@
         except MergeFailure:
             repo.opener.write('graftstate', orig.hex() + '\n')
             repo.ui.write_err(_('evolve failed!\n'))
-            repo.ui.write_err(_('fix conflict and run "hg evolve --continue"\n'))
+            repo.ui.write_err(
+                _('fix conflict and run "hg evolve --continue"\n'))
             raise
         finally:
             lock.release()
@@ -1118,7 +1127,8 @@
             try:
                 if not list(repo.set('parents(%d) and parents(%d)', bumped, prec)):
                     # Need to rebase the changeset at the right place
-                    repo.ui.status(_('rebasing to destination parent: %s\n') % prec.p1())
+                    repo.ui.status(
+                        _('rebasing to destination parent: %s\n') % prec.p1())
                     try:
                         tmpid = relocate(repo, bumped, prec.p1())
                         if tmpid is not None:
@@ -1127,7 +1137,8 @@
                     except MergeFailure:
                         repo.opener.write('graftstate', bumped.hex() + '\n')
                         repo.ui.write_err(_('evolution failed!\n'))
-                        repo.ui.write_err(_('fix conflict and run "hg evolve --continue"\n'))
+                        repo.ui.write_err(
+                            _('fix conflict and run "hg evolve --continue"\n'))
                         raise
                 # Create the new commit context
                 repo.ui.status(_('computing new diff\n'))
@@ -1201,21 +1212,21 @@
     other = others[0]
     if divergent.phase() <= phases.public:
         raise util.Abort("we can't resolve this conflict from the public side",
-                         hint="%s is public, try from %s" % (divergent, other))
+                    hint="%s is public, try from %s" % (divergent, other))
     if len(other.parents()) > 1:
         raise util.Abort("divergent changeset can't be a merge (yet)",
-                          hint="You have to fallback to solving this by hand...\n"
-                               "| This probably means redoing the merge and using "
-                               "| `hg prune` to kill older version.")
+                    hint="You have to fallback to solving this by hand...\n"
+                         "| This probably means redoing the merge and using "
+                         "| `hg prune` to kill older version.")
     if other.p1() not in divergent.parents():
         raise util.Abort("parents are not common (not handled yet)",
-                         hint="| %(d)s, %(o)s are not based on the same changeset."
-                              "| With the current state of its implementation, "
-                              "| evolve does not work in that case.\n"
-                              "| rebase one of them next to the other and run "
-                              "| this command again.\n"
-                              "| - either: hg rebase -dest 'p1(%(d)s)' -r %(o)s"
-                              "| - or:     hg rebase -dest 'p1(%(d)s)' -r %(o)s"
+                    hint="| %(d)s, %(o)s are not based on the same changeset."
+                         "| With the current state of its implementation, "
+                         "| evolve does not work in that case.\n"
+                         "| rebase one of them next to the other and run "
+                         "| this command again.\n"
+                         "| - either: hg rebase -dest 'p1(%(d)s)' -r %(o)s"
+                         "| - or:     hg rebase -dest 'p1(%(d)s)' -r %(o)s"
                               % {'d': divergent, 'o': other})
 
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
@@ -1364,7 +1375,8 @@
     else:
         for c in children:
             displayer.show(c)
-        ui.warn(_('multiple non-obsolete children, explicitly update to one\n'))
+        ui.warn(_('multiple non-obsolete children, '
+            'explicitly update to one of them\n'))
         return 1
 
 def _reachablefrombookmark(repo, revs, mark):
@@ -1477,7 +1489,8 @@
             raise util.Abort(msg)
 
         if biject and len(sucs) != len(precs):
-            msg = "Can't use %d successors for %d precursors" % (len(sucs), len(precs))
+            msg = "Can't use %d successors for %d precursors" \
+                % (len(sucs), len(precs))
             raise util.Abort(msg)
 
         relations = [(p, sucs) for p in precs]