Mercurial > evolve
changeset 3467:41ce24cf288d
utility: move MultipleSuccessorsError from __init__.py
The MultipleSuccessorsError is required in multiple modules in upcoming patches,
so let's move it to utility first.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 19 Jan 2018 17:29:48 +0530 |
parents | 0a8e3130ad00 |
children | a3052824101d |
files | hgext3rd/evolve/__init__.py hgext3rd/evolve/utility.py |
diffstat | 2 files changed, 13 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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