stack: return from behindcount() early
Reduces indentation.
--- a/hgext3rd/topic/stack.py Thu Sep 12 14:44:19 2019 +0700
+++ b/hgext3rd/topic/stack.py Thu Sep 12 15:22:50 2019 +0700
@@ -200,21 +200,21 @@
@util.propertycache
def behindcount(self):
+ if not self._revs:
+ return 0
deps, rdeps = self._dependencies
- if self._revs:
- minroot = [min(r for r in self._revs if not deps[r])]
- try:
- dest = destutil.destmerge(self._repo, action=b'rebase',
- sourceset=minroot,
- onheadcheck=False)
- return len(self._repo.revs(b"only(%d, %ld)", dest, minroot))
- except error.NoMergeDestAbort:
- return 0
- except error.ManyMergeDestAbort as exc:
- # XXX we should make it easier for upstream to provide the information
- self.behinderror = pycompat.bytestr(exc).split(b'-', 1)[0].rstrip()
- return -1
- return 0
+ minroot = [min(r for r in self._revs if not deps[r])]
+ try:
+ dest = destutil.destmerge(self._repo, action=b'rebase',
+ sourceset=minroot,
+ onheadcheck=False)
+ return len(self._repo.revs(b"only(%d, %ld)", dest, minroot))
+ except error.NoMergeDestAbort:
+ return 0
+ except error.ManyMergeDestAbort as exc:
+ # XXX we should make it easier for upstream to provide the information
+ self.behinderror = pycompat.bytestr(exc).split(b'-', 1)[0].rstrip()
+ return -1
@util.propertycache
def branches(self):