Show More
@@ -15,10 +15,15 b' from mercurial import (' | |||
|
15 | 15 | |
|
16 | 16 | from hgext import rebase |
|
17 | 17 | |
|
18 | try: | |
|
19 | xrange | |
|
20 | except NameError: | |
|
21 | xrange = range | |
|
22 | ||
|
18 | 23 | cmdtable = {} |
|
19 | 24 | command = registrar.command(cmdtable) |
|
20 | 25 | |
|
21 | @command('debugbruterebase') | |
|
26 | @command(b'debugbruterebase') | |
|
22 | 27 | def debugbruterebase(ui, repo, source, dest): |
|
23 | 28 | """for every non-empty subset of source, run rebase -r subset -d dest |
|
24 | 29 | |
@@ -33,28 +38,28 b' def debugbruterebase(ui, repo, source, d' | |||
|
33 | 38 | def getdesc(rev): |
|
34 | 39 | result = cl.changelogrevision(rev).description |
|
35 | 40 | if rev >= repolen: |
|
36 | result += "'" | |
|
41 | result += b"'" | |
|
37 | 42 | return result |
|
38 | 43 | |
|
39 | 44 | for i in xrange(1, 2 ** len(srevs)): |
|
40 | 45 | subset = [rev for j, rev in enumerate(srevs) if i & (1 << j) != 0] |
|
41 | spec = revsetlang.formatspec('%ld', subset) | |
|
42 | tr = repo.transaction('rebase') | |
|
46 | spec = revsetlang.formatspec(b'%ld', subset) | |
|
47 | tr = repo.transaction(b'rebase') | |
|
43 | 48 | tr.report = lambda x: 0 # hide "transaction abort" |
|
44 | 49 | |
|
45 | 50 | ui.pushbuffer() |
|
46 | 51 | try: |
|
47 | 52 | rebase.rebase(ui, repo, dest=dest, rev=[spec]) |
|
48 | 53 | except error.Abort as ex: |
|
49 | summary = 'ABORT: %s' % ex | |
|
54 | summary = b'ABORT: %s' % ex | |
|
50 | 55 | except Exception as ex: |
|
51 | summary = 'CRASH: %s' % ex | |
|
56 | summary = b'CRASH: %s' % ex | |
|
52 | 57 | else: |
|
53 | 58 | # short summary about new nodes |
|
54 | 59 | cl = repo.changelog |
|
55 | 60 | descs = [] |
|
56 | 61 | for rev in xrange(repolen, len(repo)): |
|
57 | desc = '%s:' % getdesc(rev) | |
|
62 | desc = b'%s:' % getdesc(rev) | |
|
58 | 63 | for prev in cl.parentrevs(rev): |
|
59 | 64 | if prev > -1: |
|
60 | 65 | desc += getdesc(prev) |
@@ -62,8 +67,8 b' def debugbruterebase(ui, repo, source, d' | |||
|
62 | 67 | descs.sort() |
|
63 | 68 | summary = ' '.join(descs) |
|
64 | 69 | ui.popbuffer() |
|
65 | repo.vfs.tryunlink('rebasestate') | |
|
70 | repo.vfs.tryunlink(b'rebasestate') | |
|
66 | 71 | |
|
67 | subsetdesc = ''.join(getdesc(rev) for rev in subset) | |
|
68 | ui.write(('%s: %s\n') % (subsetdesc.rjust(len(srevs)), summary)) | |
|
72 | subsetdesc = b''.join(getdesc(rev) for rev in subset) | |
|
73 | ui.write((b'%s: %s\n') % (subsetdesc.rjust(len(srevs)), summary)) | |
|
69 | 74 | tr.abort() |
General Comments 0
You need to be logged in to leave comments.
Login now