Mercurial > hg-stable
diff mercurial/scmutil.py @ 32676:4bec8cce6a09
scmutil: pass ctx object to intrev()
This makes it slightly easier to sort basectx objects by key=scmutil.intrev.
We're most likely to have ctx objects where changectx/workingctx abstraction
is necessary, so this won't increase the abstraction overhead.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 03 Jun 2017 18:57:28 +0900 |
parents | 218ca8526ec0 |
children | 55ff67ffcead |
line wrap: on
line diff
--- a/mercurial/scmutil.py Sat Jun 03 14:05:52 2017 +0900 +++ b/mercurial/scmutil.py Sat Jun 03 18:57:28 2017 +0900 @@ -376,9 +376,10 @@ newdirs.append(d) dirs[:] = newdirs -def intrev(rev): - """Return integer for a given revision that can be used in comparison or +def intrev(ctx): + """Return integer for a given basectx that can be used in comparison or arithmetic operation""" + rev = ctx.rev() if rev is None: return wdirrev return rev @@ -466,7 +467,7 @@ return parents if repo.ui.debugflag: return [parents[0], repo['null']] - if parents[0].rev() >= intrev(ctx.rev()) - 1: + if parents[0].rev() >= intrev(ctx) - 1: return [] return parents