utility: move MultipleSuccessorsError from __init__.py
The MultipleSuccessorsError is required in multiple modules in upcoming patches,
so let's move it to utility first.
--- a/hgext3rd/evolve/__init__.py Fri Jan 19 16:44:00 2018 +0530
+++ b/hgext3rd/evolve/__init__.py Fri Jan 19 17:29:48 2018 +0530
@@ -947,16 +947,6 @@
_deprecatealias('gup', 'next')
_deprecatealias('gdown', 'previous')
-class MultipleSuccessorsError(RuntimeError):
- """Exception raised by _singlesuccessor when multiple successor sets exists
-
- The object contains the list of successorssets in its 'successorssets'
- attribute to call to easily recover.
- """
-
- def __init__(self, successorssets):
- self.successorssets = successorssets
-
def _singlesuccessor(repo, p):
"""returns p (as rev) if not obsolete or its unique latest successors
@@ -975,7 +965,7 @@
obs = obs.parents()[0]
newer = compat.successorssets(repo, obs.node())
if len(newer) > 1 or len(newer[0]) > 1:
- raise MultipleSuccessorsError(newer)
+ raise utility.MultipleSuccessorsError(newer)
return repo[newer[0][0]].rev()
@@ -996,7 +986,7 @@
for p in repo[r].parents():
try:
succ = _singlesuccessor(repo, p)
- except MultipleSuccessorsError as exc:
+ except utility.MultipleSuccessorsError as exc:
dependencies[r] = exc.successorssets
continue
if succ in revs:
@@ -1164,7 +1154,7 @@
# no args and parent is obsolete, update to successors
try:
ctx = repo[_singlesuccessor(repo, repo['.'])]
- except MultipleSuccessorsError as exc:
+ except utility.MultipleSuccessorsError as exc:
repo.ui.write_err('parent is obsolete with multiple successors:\n')
for ln in exc.successorssets:
for n in ln:
--- a/hgext3rd/evolve/utility.py Fri Jan 19 16:44:00 2018 +0530
+++ b/hgext3rd/evolve/utility.py Fri Jan 19 17:29:48 2018 +0530
@@ -66,3 +66,13 @@
if maxrevs is not None and maxrevs < len(repo.unfiltered()):
return False
return True
+
+class MultipleSuccessorsError(RuntimeError):
+ """Exception raised by _singlesuccessor when multiple successor sets exists
+
+ The object contains the list of successorssets in its 'successorssets'
+ attribute to call to easily recover.
+ """
+
+ def __init__(self, successorssets):
+ self.successorssets = successorssets