comparison mercurial/hg.py @ 22818:d7b114493315

repair: use `first` instead of direct indexing This makes it compatible with all smartset classes.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 07 Oct 2014 00:09:50 -0700
parents ef62c66bee1b
children 2be7d5ebd4d0
comparison
equal deleted inserted replaced
22817:e4eb4bfc3616 22818:d7b114493315
22 22
23 def addbranchrevs(lrepo, other, branches, revs): 23 def addbranchrevs(lrepo, other, branches, revs):
24 peer = other.peer() # a courtesy to callers using a localrepo for other 24 peer = other.peer() # a courtesy to callers using a localrepo for other
25 hashbranch, branches = branches 25 hashbranch, branches = branches
26 if not hashbranch and not branches: 26 if not hashbranch and not branches:
27 return revs or None, revs and revs[0] or None 27 x = revs or None
28 if util.safehasattr(revs, 'first'):
29 y = revs.first()
30 elif revs:
31 y = revs[0]
32 else:
33 y = None
34 return x, y
28 revs = revs and list(revs) or [] 35 revs = revs and list(revs) or []
29 if not peer.capable('branchmap'): 36 if not peer.capable('branchmap'):
30 if branches: 37 if branches:
31 raise util.Abort(_("remote branch lookup not supported")) 38 raise util.Abort(_("remote branch lookup not supported"))
32 revs.append(hashbranch) 39 revs.append(hashbranch)