# HG changeset patch # User Pierre-Yves David # Date 2014-10-07 07:09:50 # Node ID d7b114493315322b3bdce1af78ce453d2c5178bc # Parent e4eb4bfc3616386acc73eed3fb30975127294593 repair: use `first` instead of direct indexing This makes it compatible with all smartset classes. diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -24,7 +24,14 @@ def addbranchrevs(lrepo, other, branches peer = other.peer() # a courtesy to callers using a localrepo for other hashbranch, branches = branches if not hashbranch and not branches: - return revs or None, revs and revs[0] or None + x = revs or None + if util.safehasattr(revs, 'first'): + y = revs.first() + elif revs: + y = revs[0] + else: + y = None + return x, y revs = revs and list(revs) or [] if not peer.capable('branchmap'): if branches: diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -99,7 +99,7 @@ def strip(ui, repo, nodelist, backup=Tru # is much faster newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip) if newbmtarget: - newbmtarget = repo[newbmtarget[0]].node() + newbmtarget = repo[newbmtarget.first()].node() else: newbmtarget = '.'