author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
Sat, 19 Jan 2008 18:01:16 -0200 | |
changeset 5903 | bf20995f1ac3 |
parent 5902 | 98f8dec8f437 |
child 5904 | ad5f97e08e1b |
permissions | -rw-r--r-- |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
1 |
# repair.py - functions for repository repair for mercurial |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 |
# |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
3 |
# Copyright 2005, 2006 Chris Mason <mason@suse.com> |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
4 |
# Copyright 2007 Matt Mackall |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
5 |
# |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
6 |
# This software may be used and distributed according to the terms |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
7 |
# of the GNU General Public License, incorporated herein by reference. |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
8 |
|
5899
d7388ad85511
repair.py: use node.* directly
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5898
diff
changeset
|
9 |
import changegroup, os |
d7388ad85511
repair.py: use node.* directly
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5898
diff
changeset
|
10 |
from node import * |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
11 |
|
5900
1206e3dfc906
repair.py: nodes are nodes, revs are revs
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5899
diff
changeset
|
12 |
def strip(ui, repo, node, backup="all"): |
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
13 |
def limitheads(cl, stop): |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
14 |
"""return the list of all nodes that have no children""" |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
15 |
p = {} |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
16 |
h = [] |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
17 |
stoprev = 0 |
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
18 |
if stop in cl.nodemap: |
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
19 |
stoprev = cl.rev(stop) |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
20 |
|
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
21 |
for r in xrange(cl.count() - 1, -1, -1): |
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
22 |
n = cl.node(r) |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
23 |
if n not in p: |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
24 |
h.append(n) |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
25 |
if n == stop: |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
26 |
break |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
27 |
if r < stoprev: |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
28 |
break |
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
29 |
for pn in cl.parents(n): |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
30 |
p[pn] = 1 |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
31 |
return h |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
32 |
|
5900
1206e3dfc906
repair.py: nodes are nodes, revs are revs
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5899
diff
changeset
|
33 |
def bundle(repo, bases, heads, node, suffix): |
5903
bf20995f1ac3
repair.py: add a docstring to bundle; use repo.ui
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5902
diff
changeset
|
34 |
"""create a bundle with the specified revisions as a backup""" |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
35 |
cg = repo.changegroupsubset(bases, heads, 'strip') |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
36 |
backupdir = repo.join("strip-backup") |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
37 |
if not os.path.isdir(backupdir): |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
38 |
os.mkdir(backupdir) |
5900
1206e3dfc906
repair.py: nodes are nodes, revs are revs
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5899
diff
changeset
|
39 |
name = os.path.join(backupdir, "%s-%s" % (short(node), suffix)) |
5903
bf20995f1ac3
repair.py: add a docstring to bundle; use repo.ui
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5902
diff
changeset
|
40 |
repo.ui.warn("saving bundle to %s\n" % name) |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
41 |
return changegroup.writebundle(cg, name, "HG10BZ") |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
42 |
|
5902
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
43 |
def collectfilenodes(repo, striprev): |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
44 |
"""find out the first node that should be stripped from each filelog""" |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
45 |
mm = repo.changectx(striprev).manifest() |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
46 |
filenodes = {} |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
47 |
|
5900
1206e3dfc906
repair.py: nodes are nodes, revs are revs
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5899
diff
changeset
|
48 |
for x in xrange(striprev, repo.changelog.count()): |
5902
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
49 |
for name in repo.changectx(x).files(): |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
50 |
if name in filenodes: |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
51 |
continue |
5902
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
52 |
filenodes[name] = mm.get(name) |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
53 |
|
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
54 |
return filenodes |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
55 |
|
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
56 |
def stripall(repo, striprev, filenodes): |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
57 |
"""strip the requested nodes from the filelogs""" |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
58 |
# we go in two steps here so the strip loop happens in a |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
59 |
# sensible order. When stripping many files, this helps keep |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
60 |
# our disk access patterns under control. |
5902
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
61 |
|
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
62 |
files = filenodes.keys() |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
63 |
files.sort() |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
64 |
for name in files: |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
65 |
f = repo.file(name) |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
66 |
fnode = filenodes[name] |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
67 |
frev = 0 |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
68 |
if fnode is not None and fnode in f.nodemap: |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
69 |
frev = f.rev(fnode) |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
70 |
f.strip(frev, striprev) |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
71 |
|
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
72 |
cl = repo.changelog |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
73 |
# TODO delete the undo files, and handle undo of merge sets |
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
74 |
pp = cl.parents(node) |
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
75 |
striprev = cl.rev(node) |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
76 |
|
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
77 |
# save is a list of all the branches we are truncating away |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
78 |
# that we actually want to keep. changegroup will be used |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
79 |
# to preserve them and add them back after the truncate |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
80 |
saveheads = [] |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
81 |
savebases = {} |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
82 |
|
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
83 |
heads = limitheads(cl, node) |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
84 |
seen = {} |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
85 |
|
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
86 |
# search through all the heads, finding those where the revision |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
87 |
# we want to strip away is an ancestor. Also look for merges |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
88 |
# that might be turned into new heads by the strip. |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
89 |
while heads: |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
90 |
h = heads.pop() |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
91 |
n = h |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
92 |
while True: |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
93 |
seen[n] = 1 |
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
94 |
pp = cl.parents(n) |
5899
d7388ad85511
repair.py: use node.* directly
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5898
diff
changeset
|
95 |
if pp[1] != nullid: |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
96 |
for p in pp: |
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
97 |
if cl.rev(p) > striprev and p not in seen: |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
98 |
heads.append(p) |
5899
d7388ad85511
repair.py: use node.* directly
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5898
diff
changeset
|
99 |
if pp[0] == nullid: |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
100 |
break |
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
101 |
if cl.rev(pp[0]) < striprev: |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
102 |
break |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
103 |
n = pp[0] |
5900
1206e3dfc906
repair.py: nodes are nodes, revs are revs
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5899
diff
changeset
|
104 |
if n == node: |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
105 |
break |
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
106 |
r = cl.reachable(h, node) |
5900
1206e3dfc906
repair.py: nodes are nodes, revs are revs
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5899
diff
changeset
|
107 |
if node not in r: |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
108 |
saveheads.append(h) |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
109 |
for x in r: |
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
110 |
if cl.rev(x) > striprev: |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
111 |
savebases[x] = 1 |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
112 |
|
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
113 |
# create a changegroup for all the branches we need to keep |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
114 |
if backup == "all": |
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
115 |
bundle(repo, [node], cl.heads(), node, 'backup') |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
116 |
if saveheads: |
5900
1206e3dfc906
repair.py: nodes are nodes, revs are revs
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5899
diff
changeset
|
117 |
chgrpfile = bundle(repo, savebases.keys(), saveheads, node, 'temp') |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
118 |
|
5902
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
119 |
filenodes = collectfilenodes(repo, striprev) |
98f8dec8f437
repair.py: split stripall into two functions; clean it up a bit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5901
diff
changeset
|
120 |
stripall(repo, striprev, filenodes) |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
121 |
|
5901
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
122 |
change = cl.read(node) |
16f4129c19ac
repair.py: rename chlog to cl
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5900
diff
changeset
|
123 |
cl.strip(striprev, striprev) |
5900
1206e3dfc906
repair.py: nodes are nodes, revs are revs
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5899
diff
changeset
|
124 |
repo.manifest.strip(repo.manifest.rev(change[0]), striprev) |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
125 |
if saveheads: |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
126 |
ui.status("adding branch\n") |
5898
52cfe86ebe55
repair.py: don't import commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4702
diff
changeset
|
127 |
f = open(chgrpfile, "rb") |
52cfe86ebe55
repair.py: don't import commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4702
diff
changeset
|
128 |
gen = changegroup.readbundle(f, chgrpfile) |
52cfe86ebe55
repair.py: don't import commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4702
diff
changeset
|
129 |
repo.addchangegroup(gen, 'strip', 'bundle:' + chgrpfile) |
52cfe86ebe55
repair.py: don't import commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4702
diff
changeset
|
130 |
f.close() |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
131 |
if backup != "strip": |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
132 |
os.unlink(chgrpfile) |
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
133 |