Mercurial > hg
comparison hgext/rebase.py @ 36475:7b84b737352d
py3: replace str() calls with their preferred bytes equivalent
Differential Revision: https://phab.mercurial-scm.org/D2499
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 28 Feb 2018 21:42:37 +0530 |
parents | 0b57596253b8 |
children | a6e9a360ccd8 |
comparison
equal
deleted
inserted
replaced
36474:d139eb308358 | 36475:7b84b737352d |
---|---|
917 if destf: | 917 if destf: |
918 # --base does not support multiple destinations | 918 # --base does not support multiple destinations |
919 dest = scmutil.revsingle(repo, destf) | 919 dest = scmutil.revsingle(repo, destf) |
920 else: | 920 else: |
921 dest = repo[_destrebase(repo, base, destspace=destspace)] | 921 dest = repo[_destrebase(repo, base, destspace=destspace)] |
922 destf = str(dest) | 922 destf = bytes(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.rev()).first() | 927 bp = repo.revs('ancestor(%d, %d)', b, dest.rev()).first() |
949 elif not repo.revs('%ld - ::%d', base, dest.rev()): | 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(bytes(repo[r]) for r in base), |
955 dest)) | 955 dest)) |
956 else: | 956 else: |
957 ui.status(_('nothing to rebase - working ' | 957 ui.status(_('nothing to rebase - working ' |
958 'directory parent is already an ' | 958 'directory parent is already an ' |
959 'ancestor of destination %s\n') % dest) | 959 'ancestor of destination %s\n') % dest) |
960 else: # can it happen? | 960 else: # can it happen? |
961 ui.status(_('nothing to rebase from %s to %s\n') % | 961 ui.status(_('nothing to rebase from %s to %s\n') % |
962 ('+'.join(str(repo[r]) for r in base), dest)) | 962 ('+'.join(bytes(repo[r]) for r in base), dest)) |
963 return None | 963 return None |
964 # If rebasing the working copy parent, force in-memory merge to be off. | 964 # If rebasing the working copy parent, force in-memory merge to be off. |
965 # | 965 # |
966 # This is because the extra work of checking out the newly rebased commit | 966 # This is because the extra work of checking out the newly rebased commit |
967 # outweights the benefits of rebasing in-memory, and executing an extra | 967 # outweights the benefits of rebasing in-memory, and executing an extra |
979 cmdutil.checkunfinished(repo) | 979 cmdutil.checkunfinished(repo) |
980 cmdutil.bailifchanged(repo) | 980 cmdutil.bailifchanged(repo) |
981 | 981 |
982 if not destf: | 982 if not destf: |
983 dest = repo[_destrebase(repo, rebaseset, destspace=destspace)] | 983 dest = repo[_destrebase(repo, rebaseset, destspace=destspace)] |
984 destf = str(dest) | 984 destf = bytes(dest) |
985 | 985 |
986 allsrc = revsetlang.formatspec('%ld', rebaseset) | 986 allsrc = revsetlang.formatspec('%ld', rebaseset) |
987 alias = {'ALLSRC': allsrc} | 987 alias = {'ALLSRC': allsrc} |
988 | 988 |
989 if dest is None: | 989 if dest is None: |
1037 if len(parents) == 1: | 1037 if len(parents) == 1: |
1038 return parents.pop() | 1038 return parents.pop() |
1039 raise error.Abort(_('unable to collapse on top of %s, there is more ' | 1039 raise error.Abort(_('unable to collapse on top of %s, there is more ' |
1040 'than one external parent: %s') % | 1040 'than one external parent: %s') % |
1041 (max(destancestors), | 1041 (max(destancestors), |
1042 ', '.join(str(p) for p in sorted(parents)))) | 1042 ', '.join("%d" % p for p in sorted(parents)))) |
1043 | 1043 |
1044 def concludememorynode(repo, rev, p1, p2, wctx=None, | 1044 def concludememorynode(repo, rev, p1, p2, wctx=None, |
1045 commitmsg=None, editor=None, extrafn=None, | 1045 commitmsg=None, editor=None, extrafn=None, |
1046 keepbranches=False, date=None): | 1046 keepbranches=False, date=None): |
1047 '''Commit the memory changes with parents p1 and p2. Reuse commit info from | 1047 '''Commit the memory changes with parents p1 and p2. Reuse commit info from |
1231 divergenceok = ui.configbool('experimental', | 1231 divergenceok = ui.configbool('experimental', |
1232 'evolution.allowdivergence') | 1232 'evolution.allowdivergence') |
1233 divergencebasecandidates = rebaseobsrevs - rebaseobsskipped | 1233 divergencebasecandidates = rebaseobsrevs - rebaseobsskipped |
1234 | 1234 |
1235 if divergencebasecandidates and not divergenceok: | 1235 if divergencebasecandidates and not divergenceok: |
1236 divhashes = (str(repo[r]) | 1236 divhashes = (bytes(repo[r]) |
1237 for r in divergencebasecandidates) | 1237 for r in divergencebasecandidates) |
1238 msg = _("this rebase will cause " | 1238 msg = _("this rebase will cause " |
1239 "divergences from: %s") | 1239 "divergences from: %s") |
1240 h = _("to force the rebase please set " | 1240 h = _("to force the rebase please set " |
1241 "experimental.evolution.allowdivergence=True") | 1241 "experimental.evolution.allowdivergence=True") |
1468 | 1468 |
1469 # We must start import from the newest revision | 1469 # We must start import from the newest revision |
1470 for rev in sorted(mqrebase, reverse=True): | 1470 for rev in sorted(mqrebase, reverse=True): |
1471 if rev not in skipped: | 1471 if rev not in skipped: |
1472 name, isgit = mqrebase[rev] | 1472 name, isgit = mqrebase[rev] |
1473 repo.ui.note(_('updating mq patch %s to %s:%s\n') % | 1473 repo.ui.note(_('updating mq patch %s to %d:%s\n') % |
1474 (name, state[rev], repo[state[rev]])) | 1474 (name, state[rev], repo[state[rev]])) |
1475 mq.qimport(repo, (), patchname=name, git=isgit, | 1475 mq.qimport(repo, (), patchname=name, git=isgit, |
1476 rev=[str(state[rev])]) | 1476 rev=["%d" % state[rev]]) |
1477 else: | 1477 else: |
1478 # Rebased and skipped | 1478 # Rebased and skipped |
1479 skippedpatches.add(mqrebase[rev][0]) | 1479 skippedpatches.add(mqrebase[rev][0]) |
1480 | 1480 |
1481 # Patches were either applied and rebased and imported in | 1481 # Patches were either applied and rebased and imported in |
1552 dstates = [s for r, s in state.items() if s >= 0 and s != destmap[r]] | 1552 dstates = [s for r, s in state.items() if s >= 0 and s != destmap[r]] |
1553 immutable = [d for d in dstates if not repo[d].mutable()] | 1553 immutable = [d for d in dstates if not repo[d].mutable()] |
1554 cleanup = True | 1554 cleanup = True |
1555 if immutable: | 1555 if immutable: |
1556 repo.ui.warn(_("warning: can't clean up public changesets %s\n") | 1556 repo.ui.warn(_("warning: can't clean up public changesets %s\n") |
1557 % ', '.join(str(repo[r]) for r in immutable), | 1557 % ', '.join(bytes(repo[r]) for r in immutable), |
1558 hint=_("see 'hg help phases' for details")) | 1558 hint=_("see 'hg help phases' for details")) |
1559 cleanup = False | 1559 cleanup = False |
1560 | 1560 |
1561 descendants = set() | 1561 descendants = set() |
1562 if dstates: | 1562 if dstates: |