comparison hgext/rebase.py @ 36405:0b57596253b8

rebase: use ctx.rev() instead of %d % ctx Weaning away from basectx.__int__. Differential Revision: https://phab.mercurial-scm.org/D2427
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 24 Feb 2018 11:07:07 -0800
parents 7b86aa31b004
children 7b84b737352d
comparison
equal deleted inserted replaced
36404:6905c4ec312c 36405:0b57596253b8
922 destf = str(dest) 922 destf = str(dest)
923 923
924 roots = [] # selected children of branching points 924 roots = [] # selected children of branching points
925 bpbase = {} # {branchingpoint: [origbase]} 925 bpbase = {} # {branchingpoint: [origbase]}
926 for b in base: # group bases by branching points 926 for b in base: # group bases by branching points
927 bp = repo.revs('ancestor(%d, %d)', b, dest).first() 927 bp = repo.revs('ancestor(%d, %d)', b, dest.rev()).first()
928 bpbase[bp] = bpbase.get(bp, []) + [b] 928 bpbase[bp] = bpbase.get(bp, []) + [b]
929 if None in bpbase: 929 if None in bpbase:
930 # emulate the old behavior, showing "nothing to rebase" (a better 930 # emulate the old behavior, showing "nothing to rebase" (a better
931 # behavior may be abort with "cannot find branching point" error) 931 # behavior may be abort with "cannot find branching point" error)
932 bpbase.clear() 932 bpbase.clear()
944 ui.status(_('nothing to rebase - %s is both "base"' 944 ui.status(_('nothing to rebase - %s is both "base"'
945 ' and destination\n') % dest) 945 ' and destination\n') % dest)
946 else: 946 else:
947 ui.status(_('nothing to rebase - working directory ' 947 ui.status(_('nothing to rebase - working directory '
948 'parent is also destination\n')) 948 'parent is also destination\n'))
949 elif not repo.revs('%ld - ::%d', base, dest): 949 elif not repo.revs('%ld - ::%d', base, dest.rev()):
950 if basef: 950 if basef:
951 ui.status(_('nothing to rebase - "base" %s is ' 951 ui.status(_('nothing to rebase - "base" %s is '
952 'already an ancestor of destination ' 952 'already an ancestor of destination '
953 '%s\n') % 953 '%s\n') %
954 ('+'.join(str(repo[r]) for r in base), 954 ('+'.join(str(repo[r]) for r in base),