Show More
@@ -1,1981 +1,1977 b'' | |||||
1 | # localrepo.py - read/write repository class for mercurial |
|
1 | # localrepo.py - read/write repository class for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
6 | # of the GNU General Public License, incorporated herein by reference. |
|
6 | # of the GNU General Public License, incorporated herein by reference. | |
7 |
|
7 | |||
8 | import os, util |
|
8 | import os, util | |
9 | import filelog, manifest, changelog, dirstate, repo |
|
9 | import filelog, manifest, changelog, dirstate, repo | |
10 | from node import * |
|
10 | from node import * | |
11 | from i18n import gettext as _ |
|
11 | from i18n import gettext as _ | |
12 | from demandload import * |
|
12 | from demandload import * | |
13 | demandload(globals(), "appendfile changegroup") |
|
13 | demandload(globals(), "appendfile changegroup") | |
14 | demandload(globals(), "re lock transaction tempfile stat mdiff errno ui revlog") |
|
14 | demandload(globals(), "re lock transaction tempfile stat mdiff errno ui revlog") | |
15 |
|
15 | |||
16 | class localrepository(object): |
|
16 | class localrepository(object): | |
17 | def __del__(self): |
|
17 | def __del__(self): | |
18 | self.transhandle = None |
|
18 | self.transhandle = None | |
19 | def __init__(self, parentui, path=None, create=0): |
|
19 | def __init__(self, parentui, path=None, create=0): | |
20 | if not path: |
|
20 | if not path: | |
21 | p = os.getcwd() |
|
21 | p = os.getcwd() | |
22 | while not os.path.isdir(os.path.join(p, ".hg")): |
|
22 | while not os.path.isdir(os.path.join(p, ".hg")): | |
23 | oldp = p |
|
23 | oldp = p | |
24 | p = os.path.dirname(p) |
|
24 | p = os.path.dirname(p) | |
25 | if p == oldp: |
|
25 | if p == oldp: | |
26 | raise repo.RepoError(_("no repo found")) |
|
26 | raise repo.RepoError(_("no repo found")) | |
27 | path = p |
|
27 | path = p | |
28 | self.path = os.path.join(path, ".hg") |
|
28 | self.path = os.path.join(path, ".hg") | |
29 |
|
29 | |||
30 | if not create and not os.path.isdir(self.path): |
|
30 | if not create and not os.path.isdir(self.path): | |
31 | raise repo.RepoError(_("repository %s not found") % path) |
|
31 | raise repo.RepoError(_("repository %s not found") % path) | |
32 |
|
32 | |||
33 | self.root = os.path.abspath(path) |
|
33 | self.root = os.path.abspath(path) | |
34 | self.origroot = path |
|
34 | self.origroot = path | |
35 | self.ui = ui.ui(parentui=parentui) |
|
35 | self.ui = ui.ui(parentui=parentui) | |
36 | self.opener = util.opener(self.path) |
|
36 | self.opener = util.opener(self.path) | |
37 | self.wopener = util.opener(self.root) |
|
37 | self.wopener = util.opener(self.root) | |
38 |
|
38 | |||
39 | try: |
|
39 | try: | |
40 | self.ui.readconfig(self.join("hgrc"), self.root) |
|
40 | self.ui.readconfig(self.join("hgrc"), self.root) | |
41 | except IOError: |
|
41 | except IOError: | |
42 | pass |
|
42 | pass | |
43 |
|
43 | |||
44 | v = self.ui.revlogopts |
|
44 | v = self.ui.revlogopts | |
45 | self.revlogversion = int(v.get('format', 0)) |
|
45 | self.revlogversion = int(v.get('format', 0)) | |
46 | flags = 0 |
|
46 | flags = 0 | |
47 | for x in v.get('flags', "").split(): |
|
47 | for x in v.get('flags', "").split(): | |
48 | flags |= revlog.flagstr(x) |
|
48 | flags |= revlog.flagstr(x) | |
49 |
|
49 | |||
50 | v = self.revlogversion | flags |
|
50 | v = self.revlogversion | flags | |
51 | self.manifest = manifest.manifest(self.opener, v) |
|
51 | self.manifest = manifest.manifest(self.opener, v) | |
52 | self.changelog = changelog.changelog(self.opener, v) |
|
52 | self.changelog = changelog.changelog(self.opener, v) | |
53 |
|
53 | |||
54 | # the changelog might not have the inline index flag |
|
54 | # the changelog might not have the inline index flag | |
55 | # on. If the format of the changelog is the same as found in |
|
55 | # on. If the format of the changelog is the same as found in | |
56 | # .hgrc, apply any flags found in the .hgrc as well. |
|
56 | # .hgrc, apply any flags found in the .hgrc as well. | |
57 | # Otherwise, just version from the changelog |
|
57 | # Otherwise, just version from the changelog | |
58 | v = self.changelog.version |
|
58 | v = self.changelog.version | |
59 | if v == self.revlogversion: |
|
59 | if v == self.revlogversion: | |
60 | v |= flags |
|
60 | v |= flags | |
61 | self.revlogversion = v |
|
61 | self.revlogversion = v | |
62 |
|
62 | |||
63 | self.tagscache = None |
|
63 | self.tagscache = None | |
64 | self.nodetagscache = None |
|
64 | self.nodetagscache = None | |
65 | self.encodepats = None |
|
65 | self.encodepats = None | |
66 | self.decodepats = None |
|
66 | self.decodepats = None | |
67 | self.transhandle = None |
|
67 | self.transhandle = None | |
68 |
|
68 | |||
69 | if create: |
|
69 | if create: | |
70 | os.mkdir(self.path) |
|
70 | os.mkdir(self.path) | |
71 | os.mkdir(self.join("data")) |
|
71 | os.mkdir(self.join("data")) | |
72 |
|
72 | |||
73 | self.dirstate = dirstate.dirstate(self.opener, self.ui, self.root) |
|
73 | self.dirstate = dirstate.dirstate(self.opener, self.ui, self.root) | |
74 | def hook(self, name, throw=False, **args): |
|
74 | def hook(self, name, throw=False, **args): | |
75 | def runhook(name, cmd): |
|
75 | def runhook(name, cmd): | |
76 | self.ui.note(_("running hook %s: %s\n") % (name, cmd)) |
|
76 | self.ui.note(_("running hook %s: %s\n") % (name, cmd)) | |
77 | env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()] + |
|
77 | env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()] + | |
78 | [(k.upper(), v) for k, v in args.iteritems()]) |
|
78 | [(k.upper(), v) for k, v in args.iteritems()]) | |
79 | r = util.system(cmd, environ=env, cwd=self.root) |
|
79 | r = util.system(cmd, environ=env, cwd=self.root) | |
80 | if r: |
|
80 | if r: | |
81 | desc, r = util.explain_exit(r) |
|
81 | desc, r = util.explain_exit(r) | |
82 | if throw: |
|
82 | if throw: | |
83 | raise util.Abort(_('%s hook %s') % (name, desc)) |
|
83 | raise util.Abort(_('%s hook %s') % (name, desc)) | |
84 | self.ui.warn(_('error: %s hook %s\n') % (name, desc)) |
|
84 | self.ui.warn(_('error: %s hook %s\n') % (name, desc)) | |
85 | return False |
|
85 | return False | |
86 | return True |
|
86 | return True | |
87 |
|
87 | |||
88 | r = True |
|
88 | r = True | |
89 | hooks = [(hname, cmd) for hname, cmd in self.ui.configitems("hooks") |
|
89 | hooks = [(hname, cmd) for hname, cmd in self.ui.configitems("hooks") | |
90 | if hname.split(".", 1)[0] == name and cmd] |
|
90 | if hname.split(".", 1)[0] == name and cmd] | |
91 | hooks.sort() |
|
91 | hooks.sort() | |
92 | for hname, cmd in hooks: |
|
92 | for hname, cmd in hooks: | |
93 | r = runhook(hname, cmd) and r |
|
93 | r = runhook(hname, cmd) and r | |
94 | return r |
|
94 | return r | |
95 |
|
95 | |||
96 | def tags(self): |
|
96 | def tags(self): | |
97 | '''return a mapping of tag to node''' |
|
97 | '''return a mapping of tag to node''' | |
98 | if not self.tagscache: |
|
98 | if not self.tagscache: | |
99 | self.tagscache = {} |
|
99 | self.tagscache = {} | |
100 |
|
100 | |||
101 | def parsetag(line, context): |
|
101 | def parsetag(line, context): | |
102 | if not line: |
|
102 | if not line: | |
103 | return |
|
103 | return | |
104 | s = l.split(" ", 1) |
|
104 | s = l.split(" ", 1) | |
105 | if len(s) != 2: |
|
105 | if len(s) != 2: | |
106 | self.ui.warn(_("%s: ignoring invalid tag\n") % context) |
|
106 | self.ui.warn(_("%s: ignoring invalid tag\n") % context) | |
107 | return |
|
107 | return | |
108 | node, key = s |
|
108 | node, key = s | |
109 | try: |
|
109 | try: | |
110 | bin_n = bin(node) |
|
110 | bin_n = bin(node) | |
111 | except TypeError: |
|
111 | except TypeError: | |
112 | self.ui.warn(_("%s: ignoring invalid tag\n") % context) |
|
112 | self.ui.warn(_("%s: ignoring invalid tag\n") % context) | |
113 | return |
|
113 | return | |
114 | if bin_n not in self.changelog.nodemap: |
|
114 | if bin_n not in self.changelog.nodemap: | |
115 | self.ui.warn(_("%s: ignoring invalid tag\n") % context) |
|
115 | self.ui.warn(_("%s: ignoring invalid tag\n") % context) | |
116 | return |
|
116 | return | |
117 | self.tagscache[key.strip()] = bin_n |
|
117 | self.tagscache[key.strip()] = bin_n | |
118 |
|
118 | |||
119 | # read each head of the tags file, ending with the tip |
|
119 | # read each head of the tags file, ending with the tip | |
120 | # and add each tag found to the map, with "newer" ones |
|
120 | # and add each tag found to the map, with "newer" ones | |
121 | # taking precedence |
|
121 | # taking precedence | |
122 | fl = self.file(".hgtags") |
|
122 | fl = self.file(".hgtags") | |
123 | h = fl.heads() |
|
123 | h = fl.heads() | |
124 | h.reverse() |
|
124 | h.reverse() | |
125 | for r in h: |
|
125 | for r in h: | |
126 | count = 0 |
|
126 | count = 0 | |
127 | for l in fl.read(r).splitlines(): |
|
127 | for l in fl.read(r).splitlines(): | |
128 | count += 1 |
|
128 | count += 1 | |
129 | parsetag(l, ".hgtags:%d" % count) |
|
129 | parsetag(l, ".hgtags:%d" % count) | |
130 |
|
130 | |||
131 | try: |
|
131 | try: | |
132 | f = self.opener("localtags") |
|
132 | f = self.opener("localtags") | |
133 | count = 0 |
|
133 | count = 0 | |
134 | for l in f: |
|
134 | for l in f: | |
135 | count += 1 |
|
135 | count += 1 | |
136 | parsetag(l, "localtags:%d" % count) |
|
136 | parsetag(l, "localtags:%d" % count) | |
137 | except IOError: |
|
137 | except IOError: | |
138 | pass |
|
138 | pass | |
139 |
|
139 | |||
140 | self.tagscache['tip'] = self.changelog.tip() |
|
140 | self.tagscache['tip'] = self.changelog.tip() | |
141 |
|
141 | |||
142 | return self.tagscache |
|
142 | return self.tagscache | |
143 |
|
143 | |||
144 | def tagslist(self): |
|
144 | def tagslist(self): | |
145 | '''return a list of tags ordered by revision''' |
|
145 | '''return a list of tags ordered by revision''' | |
146 | l = [] |
|
146 | l = [] | |
147 | for t, n in self.tags().items(): |
|
147 | for t, n in self.tags().items(): | |
148 | try: |
|
148 | try: | |
149 | r = self.changelog.rev(n) |
|
149 | r = self.changelog.rev(n) | |
150 | except: |
|
150 | except: | |
151 | r = -2 # sort to the beginning of the list if unknown |
|
151 | r = -2 # sort to the beginning of the list if unknown | |
152 | l.append((r, t, n)) |
|
152 | l.append((r, t, n)) | |
153 | l.sort() |
|
153 | l.sort() | |
154 | return [(t, n) for r, t, n in l] |
|
154 | return [(t, n) for r, t, n in l] | |
155 |
|
155 | |||
156 | def nodetags(self, node): |
|
156 | def nodetags(self, node): | |
157 | '''return the tags associated with a node''' |
|
157 | '''return the tags associated with a node''' | |
158 | if not self.nodetagscache: |
|
158 | if not self.nodetagscache: | |
159 | self.nodetagscache = {} |
|
159 | self.nodetagscache = {} | |
160 | for t, n in self.tags().items(): |
|
160 | for t, n in self.tags().items(): | |
161 | self.nodetagscache.setdefault(n, []).append(t) |
|
161 | self.nodetagscache.setdefault(n, []).append(t) | |
162 | return self.nodetagscache.get(node, []) |
|
162 | return self.nodetagscache.get(node, []) | |
163 |
|
163 | |||
164 | def lookup(self, key): |
|
164 | def lookup(self, key): | |
165 | try: |
|
165 | try: | |
166 | return self.tags()[key] |
|
166 | return self.tags()[key] | |
167 | except KeyError: |
|
167 | except KeyError: | |
168 | try: |
|
168 | try: | |
169 | return self.changelog.lookup(key) |
|
169 | return self.changelog.lookup(key) | |
170 | except: |
|
170 | except: | |
171 | raise repo.RepoError(_("unknown revision '%s'") % key) |
|
171 | raise repo.RepoError(_("unknown revision '%s'") % key) | |
172 |
|
172 | |||
173 | def dev(self): |
|
173 | def dev(self): | |
174 | return os.stat(self.path).st_dev |
|
174 | return os.stat(self.path).st_dev | |
175 |
|
175 | |||
176 | def local(self): |
|
176 | def local(self): | |
177 | return True |
|
177 | return True | |
178 |
|
178 | |||
179 | def join(self, f): |
|
179 | def join(self, f): | |
180 | return os.path.join(self.path, f) |
|
180 | return os.path.join(self.path, f) | |
181 |
|
181 | |||
182 | def wjoin(self, f): |
|
182 | def wjoin(self, f): | |
183 | return os.path.join(self.root, f) |
|
183 | return os.path.join(self.root, f) | |
184 |
|
184 | |||
185 | def file(self, f): |
|
185 | def file(self, f): | |
186 | if f[0] == '/': |
|
186 | if f[0] == '/': | |
187 | f = f[1:] |
|
187 | f = f[1:] | |
188 | return filelog.filelog(self.opener, f, self.revlogversion) |
|
188 | return filelog.filelog(self.opener, f, self.revlogversion) | |
189 |
|
189 | |||
190 | def getcwd(self): |
|
190 | def getcwd(self): | |
191 | return self.dirstate.getcwd() |
|
191 | return self.dirstate.getcwd() | |
192 |
|
192 | |||
193 | def wfile(self, f, mode='r'): |
|
193 | def wfile(self, f, mode='r'): | |
194 | return self.wopener(f, mode) |
|
194 | return self.wopener(f, mode) | |
195 |
|
195 | |||
196 | def wread(self, filename): |
|
196 | def wread(self, filename): | |
197 | if self.encodepats == None: |
|
197 | if self.encodepats == None: | |
198 | l = [] |
|
198 | l = [] | |
199 | for pat, cmd in self.ui.configitems("encode"): |
|
199 | for pat, cmd in self.ui.configitems("encode"): | |
200 | mf = util.matcher(self.root, "", [pat], [], [])[1] |
|
200 | mf = util.matcher(self.root, "", [pat], [], [])[1] | |
201 | l.append((mf, cmd)) |
|
201 | l.append((mf, cmd)) | |
202 | self.encodepats = l |
|
202 | self.encodepats = l | |
203 |
|
203 | |||
204 | data = self.wopener(filename, 'r').read() |
|
204 | data = self.wopener(filename, 'r').read() | |
205 |
|
205 | |||
206 | for mf, cmd in self.encodepats: |
|
206 | for mf, cmd in self.encodepats: | |
207 | if mf(filename): |
|
207 | if mf(filename): | |
208 | self.ui.debug(_("filtering %s through %s\n") % (filename, cmd)) |
|
208 | self.ui.debug(_("filtering %s through %s\n") % (filename, cmd)) | |
209 | data = util.filter(data, cmd) |
|
209 | data = util.filter(data, cmd) | |
210 | break |
|
210 | break | |
211 |
|
211 | |||
212 | return data |
|
212 | return data | |
213 |
|
213 | |||
214 | def wwrite(self, filename, data, fd=None): |
|
214 | def wwrite(self, filename, data, fd=None): | |
215 | if self.decodepats == None: |
|
215 | if self.decodepats == None: | |
216 | l = [] |
|
216 | l = [] | |
217 | for pat, cmd in self.ui.configitems("decode"): |
|
217 | for pat, cmd in self.ui.configitems("decode"): | |
218 | mf = util.matcher(self.root, "", [pat], [], [])[1] |
|
218 | mf = util.matcher(self.root, "", [pat], [], [])[1] | |
219 | l.append((mf, cmd)) |
|
219 | l.append((mf, cmd)) | |
220 | self.decodepats = l |
|
220 | self.decodepats = l | |
221 |
|
221 | |||
222 | for mf, cmd in self.decodepats: |
|
222 | for mf, cmd in self.decodepats: | |
223 | if mf(filename): |
|
223 | if mf(filename): | |
224 | self.ui.debug(_("filtering %s through %s\n") % (filename, cmd)) |
|
224 | self.ui.debug(_("filtering %s through %s\n") % (filename, cmd)) | |
225 | data = util.filter(data, cmd) |
|
225 | data = util.filter(data, cmd) | |
226 | break |
|
226 | break | |
227 |
|
227 | |||
228 | if fd: |
|
228 | if fd: | |
229 | return fd.write(data) |
|
229 | return fd.write(data) | |
230 | return self.wopener(filename, 'w').write(data) |
|
230 | return self.wopener(filename, 'w').write(data) | |
231 |
|
231 | |||
232 | def transaction(self): |
|
232 | def transaction(self): | |
233 | tr = self.transhandle |
|
233 | tr = self.transhandle | |
234 | if tr != None and tr.running(): |
|
234 | if tr != None and tr.running(): | |
235 | return tr.nest() |
|
235 | return tr.nest() | |
236 |
|
236 | |||
237 | # save dirstate for undo |
|
237 | # save dirstate for undo | |
238 | try: |
|
238 | try: | |
239 | ds = self.opener("dirstate").read() |
|
239 | ds = self.opener("dirstate").read() | |
240 | except IOError: |
|
240 | except IOError: | |
241 | ds = "" |
|
241 | ds = "" | |
242 | self.opener("journal.dirstate", "w").write(ds) |
|
242 | self.opener("journal.dirstate", "w").write(ds) | |
243 |
|
243 | |||
244 | tr = transaction.transaction(self.ui.warn, self.opener, |
|
244 | tr = transaction.transaction(self.ui.warn, self.opener, | |
245 | self.join("journal"), |
|
245 | self.join("journal"), | |
246 | aftertrans(self.path)) |
|
246 | aftertrans(self.path)) | |
247 | self.transhandle = tr |
|
247 | self.transhandle = tr | |
248 | return tr |
|
248 | return tr | |
249 |
|
249 | |||
250 | def recover(self): |
|
250 | def recover(self): | |
251 | l = self.lock() |
|
251 | l = self.lock() | |
252 | if os.path.exists(self.join("journal")): |
|
252 | if os.path.exists(self.join("journal")): | |
253 | self.ui.status(_("rolling back interrupted transaction\n")) |
|
253 | self.ui.status(_("rolling back interrupted transaction\n")) | |
254 | transaction.rollback(self.opener, self.join("journal")) |
|
254 | transaction.rollback(self.opener, self.join("journal")) | |
255 | self.reload() |
|
255 | self.reload() | |
256 | return True |
|
256 | return True | |
257 | else: |
|
257 | else: | |
258 | self.ui.warn(_("no interrupted transaction available\n")) |
|
258 | self.ui.warn(_("no interrupted transaction available\n")) | |
259 | return False |
|
259 | return False | |
260 |
|
260 | |||
261 | def undo(self, wlock=None): |
|
261 | def undo(self, wlock=None): | |
262 | if not wlock: |
|
262 | if not wlock: | |
263 | wlock = self.wlock() |
|
263 | wlock = self.wlock() | |
264 | l = self.lock() |
|
264 | l = self.lock() | |
265 | if os.path.exists(self.join("undo")): |
|
265 | if os.path.exists(self.join("undo")): | |
266 | self.ui.status(_("rolling back last transaction\n")) |
|
266 | self.ui.status(_("rolling back last transaction\n")) | |
267 | transaction.rollback(self.opener, self.join("undo")) |
|
267 | transaction.rollback(self.opener, self.join("undo")) | |
268 | util.rename(self.join("undo.dirstate"), self.join("dirstate")) |
|
268 | util.rename(self.join("undo.dirstate"), self.join("dirstate")) | |
269 | self.reload() |
|
269 | self.reload() | |
270 | self.wreload() |
|
270 | self.wreload() | |
271 | else: |
|
271 | else: | |
272 | self.ui.warn(_("no undo information available\n")) |
|
272 | self.ui.warn(_("no undo information available\n")) | |
273 |
|
273 | |||
274 | def wreload(self): |
|
274 | def wreload(self): | |
275 | self.dirstate.read() |
|
275 | self.dirstate.read() | |
276 |
|
276 | |||
277 | def reload(self): |
|
277 | def reload(self): | |
278 | self.changelog.load() |
|
278 | self.changelog.load() | |
279 | self.manifest.load() |
|
279 | self.manifest.load() | |
280 | self.tagscache = None |
|
280 | self.tagscache = None | |
281 | self.nodetagscache = None |
|
281 | self.nodetagscache = None | |
282 |
|
282 | |||
283 | def do_lock(self, lockname, wait, releasefn=None, acquirefn=None, |
|
283 | def do_lock(self, lockname, wait, releasefn=None, acquirefn=None, | |
284 | desc=None): |
|
284 | desc=None): | |
285 | try: |
|
285 | try: | |
286 | l = lock.lock(self.join(lockname), 0, releasefn, desc=desc) |
|
286 | l = lock.lock(self.join(lockname), 0, releasefn, desc=desc) | |
287 | except lock.LockHeld, inst: |
|
287 | except lock.LockHeld, inst: | |
288 | if not wait: |
|
288 | if not wait: | |
289 | raise |
|
289 | raise | |
290 | self.ui.warn(_("waiting for lock on %s held by %s\n") % |
|
290 | self.ui.warn(_("waiting for lock on %s held by %s\n") % | |
291 | (desc, inst.args[0])) |
|
291 | (desc, inst.args[0])) | |
292 | # default to 600 seconds timeout |
|
292 | # default to 600 seconds timeout | |
293 | l = lock.lock(self.join(lockname), |
|
293 | l = lock.lock(self.join(lockname), | |
294 | int(self.ui.config("ui", "timeout") or 600), |
|
294 | int(self.ui.config("ui", "timeout") or 600), | |
295 | releasefn, desc=desc) |
|
295 | releasefn, desc=desc) | |
296 | if acquirefn: |
|
296 | if acquirefn: | |
297 | acquirefn() |
|
297 | acquirefn() | |
298 | return l |
|
298 | return l | |
299 |
|
299 | |||
300 | def lock(self, wait=1): |
|
300 | def lock(self, wait=1): | |
301 | return self.do_lock("lock", wait, acquirefn=self.reload, |
|
301 | return self.do_lock("lock", wait, acquirefn=self.reload, | |
302 | desc=_('repository %s') % self.origroot) |
|
302 | desc=_('repository %s') % self.origroot) | |
303 |
|
303 | |||
304 | def wlock(self, wait=1): |
|
304 | def wlock(self, wait=1): | |
305 | return self.do_lock("wlock", wait, self.dirstate.write, |
|
305 | return self.do_lock("wlock", wait, self.dirstate.write, | |
306 | self.wreload, |
|
306 | self.wreload, | |
307 | desc=_('working directory of %s') % self.origroot) |
|
307 | desc=_('working directory of %s') % self.origroot) | |
308 |
|
308 | |||
309 | def checkfilemerge(self, filename, text, filelog, manifest1, manifest2): |
|
309 | def checkfilemerge(self, filename, text, filelog, manifest1, manifest2): | |
310 | "determine whether a new filenode is needed" |
|
310 | "determine whether a new filenode is needed" | |
311 | fp1 = manifest1.get(filename, nullid) |
|
311 | fp1 = manifest1.get(filename, nullid) | |
312 | fp2 = manifest2.get(filename, nullid) |
|
312 | fp2 = manifest2.get(filename, nullid) | |
313 |
|
313 | |||
314 | if fp2 != nullid: |
|
314 | if fp2 != nullid: | |
315 | # is one parent an ancestor of the other? |
|
315 | # is one parent an ancestor of the other? | |
316 | fpa = filelog.ancestor(fp1, fp2) |
|
316 | fpa = filelog.ancestor(fp1, fp2) | |
317 | if fpa == fp1: |
|
317 | if fpa == fp1: | |
318 | fp1, fp2 = fp2, nullid |
|
318 | fp1, fp2 = fp2, nullid | |
319 | elif fpa == fp2: |
|
319 | elif fpa == fp2: | |
320 | fp2 = nullid |
|
320 | fp2 = nullid | |
321 |
|
321 | |||
322 | # is the file unmodified from the parent? report existing entry |
|
322 | # is the file unmodified from the parent? report existing entry | |
323 | if fp2 == nullid and text == filelog.read(fp1): |
|
323 | if fp2 == nullid and text == filelog.read(fp1): | |
324 | return (fp1, None, None) |
|
324 | return (fp1, None, None) | |
325 |
|
325 | |||
326 | return (None, fp1, fp2) |
|
326 | return (None, fp1, fp2) | |
327 |
|
327 | |||
328 | def rawcommit(self, files, text, user, date, p1=None, p2=None, wlock=None): |
|
328 | def rawcommit(self, files, text, user, date, p1=None, p2=None, wlock=None): | |
329 | orig_parent = self.dirstate.parents()[0] or nullid |
|
329 | orig_parent = self.dirstate.parents()[0] or nullid | |
330 | p1 = p1 or self.dirstate.parents()[0] or nullid |
|
330 | p1 = p1 or self.dirstate.parents()[0] or nullid | |
331 | p2 = p2 or self.dirstate.parents()[1] or nullid |
|
331 | p2 = p2 or self.dirstate.parents()[1] or nullid | |
332 | c1 = self.changelog.read(p1) |
|
332 | c1 = self.changelog.read(p1) | |
333 | c2 = self.changelog.read(p2) |
|
333 | c2 = self.changelog.read(p2) | |
334 | m1 = self.manifest.read(c1[0]) |
|
334 | m1 = self.manifest.read(c1[0]) | |
335 | mf1 = self.manifest.readflags(c1[0]) |
|
335 | mf1 = self.manifest.readflags(c1[0]) | |
336 | m2 = self.manifest.read(c2[0]) |
|
336 | m2 = self.manifest.read(c2[0]) | |
337 | changed = [] |
|
337 | changed = [] | |
338 |
|
338 | |||
339 | if orig_parent == p1: |
|
339 | if orig_parent == p1: | |
340 | update_dirstate = 1 |
|
340 | update_dirstate = 1 | |
341 | else: |
|
341 | else: | |
342 | update_dirstate = 0 |
|
342 | update_dirstate = 0 | |
343 |
|
343 | |||
344 | if not wlock: |
|
344 | if not wlock: | |
345 | wlock = self.wlock() |
|
345 | wlock = self.wlock() | |
346 | l = self.lock() |
|
346 | l = self.lock() | |
347 | tr = self.transaction() |
|
347 | tr = self.transaction() | |
348 | mm = m1.copy() |
|
348 | mm = m1.copy() | |
349 | mfm = mf1.copy() |
|
349 | mfm = mf1.copy() | |
350 | linkrev = self.changelog.count() |
|
350 | linkrev = self.changelog.count() | |
351 | for f in files: |
|
351 | for f in files: | |
352 | try: |
|
352 | try: | |
353 | t = self.wread(f) |
|
353 | t = self.wread(f) | |
354 | tm = util.is_exec(self.wjoin(f), mfm.get(f, False)) |
|
354 | tm = util.is_exec(self.wjoin(f), mfm.get(f, False)) | |
355 | r = self.file(f) |
|
355 | r = self.file(f) | |
356 | mfm[f] = tm |
|
356 | mfm[f] = tm | |
357 |
|
357 | |||
358 | (entry, fp1, fp2) = self.checkfilemerge(f, t, r, m1, m2) |
|
358 | (entry, fp1, fp2) = self.checkfilemerge(f, t, r, m1, m2) | |
359 | if entry: |
|
359 | if entry: | |
360 | mm[f] = entry |
|
360 | mm[f] = entry | |
361 | continue |
|
361 | continue | |
362 |
|
362 | |||
363 | mm[f] = r.add(t, {}, tr, linkrev, fp1, fp2) |
|
363 | mm[f] = r.add(t, {}, tr, linkrev, fp1, fp2) | |
364 | changed.append(f) |
|
364 | changed.append(f) | |
365 | if update_dirstate: |
|
365 | if update_dirstate: | |
366 | self.dirstate.update([f], "n") |
|
366 | self.dirstate.update([f], "n") | |
367 | except IOError: |
|
367 | except IOError: | |
368 | try: |
|
368 | try: | |
369 | del mm[f] |
|
369 | del mm[f] | |
370 | del mfm[f] |
|
370 | del mfm[f] | |
371 | if update_dirstate: |
|
371 | if update_dirstate: | |
372 | self.dirstate.forget([f]) |
|
372 | self.dirstate.forget([f]) | |
373 | except: |
|
373 | except: | |
374 | # deleted from p2? |
|
374 | # deleted from p2? | |
375 | pass |
|
375 | pass | |
376 |
|
376 | |||
377 | mnode = self.manifest.add(mm, mfm, tr, linkrev, c1[0], c2[0]) |
|
377 | mnode = self.manifest.add(mm, mfm, tr, linkrev, c1[0], c2[0]) | |
378 | user = user or self.ui.username() |
|
378 | user = user or self.ui.username() | |
379 | n = self.changelog.add(mnode, changed, text, tr, p1, p2, user, date) |
|
379 | n = self.changelog.add(mnode, changed, text, tr, p1, p2, user, date) | |
380 | tr.close() |
|
380 | tr.close() | |
381 | if update_dirstate: |
|
381 | if update_dirstate: | |
382 | self.dirstate.setparents(n, nullid) |
|
382 | self.dirstate.setparents(n, nullid) | |
383 |
|
383 | |||
384 | def commit(self, files=None, text="", user=None, date=None, |
|
384 | def commit(self, files=None, text="", user=None, date=None, | |
385 | match=util.always, force=False, lock=None, wlock=None): |
|
385 | match=util.always, force=False, lock=None, wlock=None): | |
386 | commit = [] |
|
386 | commit = [] | |
387 | remove = [] |
|
387 | remove = [] | |
388 | changed = [] |
|
388 | changed = [] | |
389 |
|
389 | |||
390 | if files: |
|
390 | if files: | |
391 | for f in files: |
|
391 | for f in files: | |
392 | s = self.dirstate.state(f) |
|
392 | s = self.dirstate.state(f) | |
393 | if s in 'nmai': |
|
393 | if s in 'nmai': | |
394 | commit.append(f) |
|
394 | commit.append(f) | |
395 | elif s == 'r': |
|
395 | elif s == 'r': | |
396 | remove.append(f) |
|
396 | remove.append(f) | |
397 | else: |
|
397 | else: | |
398 | self.ui.warn(_("%s not tracked!\n") % f) |
|
398 | self.ui.warn(_("%s not tracked!\n") % f) | |
399 | else: |
|
399 | else: | |
400 | modified, added, removed, deleted, unknown = self.changes(match=match) |
|
400 | modified, added, removed, deleted, unknown = self.changes(match=match) | |
401 | commit = modified + added |
|
401 | commit = modified + added | |
402 | remove = removed |
|
402 | remove = removed | |
403 |
|
403 | |||
404 | p1, p2 = self.dirstate.parents() |
|
404 | p1, p2 = self.dirstate.parents() | |
405 | c1 = self.changelog.read(p1) |
|
405 | c1 = self.changelog.read(p1) | |
406 | c2 = self.changelog.read(p2) |
|
406 | c2 = self.changelog.read(p2) | |
407 | m1 = self.manifest.read(c1[0]) |
|
407 | m1 = self.manifest.read(c1[0]) | |
408 | mf1 = self.manifest.readflags(c1[0]) |
|
408 | mf1 = self.manifest.readflags(c1[0]) | |
409 | m2 = self.manifest.read(c2[0]) |
|
409 | m2 = self.manifest.read(c2[0]) | |
410 |
|
410 | |||
411 | if not commit and not remove and not force and p2 == nullid: |
|
411 | if not commit and not remove and not force and p2 == nullid: | |
412 | self.ui.status(_("nothing changed\n")) |
|
412 | self.ui.status(_("nothing changed\n")) | |
413 | return None |
|
413 | return None | |
414 |
|
414 | |||
415 | xp1 = hex(p1) |
|
415 | xp1 = hex(p1) | |
416 | if p2 == nullid: xp2 = '' |
|
416 | if p2 == nullid: xp2 = '' | |
417 | else: xp2 = hex(p2) |
|
417 | else: xp2 = hex(p2) | |
418 |
|
418 | |||
419 | self.hook("precommit", throw=True, parent1=xp1, parent2=xp2) |
|
419 | self.hook("precommit", throw=True, parent1=xp1, parent2=xp2) | |
420 |
|
420 | |||
421 | if not wlock: |
|
421 | if not wlock: | |
422 | wlock = self.wlock() |
|
422 | wlock = self.wlock() | |
423 | if not lock: |
|
423 | if not lock: | |
424 | lock = self.lock() |
|
424 | lock = self.lock() | |
425 | tr = self.transaction() |
|
425 | tr = self.transaction() | |
426 |
|
426 | |||
427 | # check in files |
|
427 | # check in files | |
428 | new = {} |
|
428 | new = {} | |
429 | linkrev = self.changelog.count() |
|
429 | linkrev = self.changelog.count() | |
430 | commit.sort() |
|
430 | commit.sort() | |
431 | for f in commit: |
|
431 | for f in commit: | |
432 | self.ui.note(f + "\n") |
|
432 | self.ui.note(f + "\n") | |
433 | try: |
|
433 | try: | |
434 | mf1[f] = util.is_exec(self.wjoin(f), mf1.get(f, False)) |
|
434 | mf1[f] = util.is_exec(self.wjoin(f), mf1.get(f, False)) | |
435 | t = self.wread(f) |
|
435 | t = self.wread(f) | |
436 | except IOError: |
|
436 | except IOError: | |
437 | self.ui.warn(_("trouble committing %s!\n") % f) |
|
437 | self.ui.warn(_("trouble committing %s!\n") % f) | |
438 | raise |
|
438 | raise | |
439 |
|
439 | |||
440 | r = self.file(f) |
|
440 | r = self.file(f) | |
441 |
|
441 | |||
442 | meta = {} |
|
442 | meta = {} | |
443 | cp = self.dirstate.copied(f) |
|
443 | cp = self.dirstate.copied(f) | |
444 | if cp: |
|
444 | if cp: | |
445 | meta["copy"] = cp |
|
445 | meta["copy"] = cp | |
446 | meta["copyrev"] = hex(m1.get(cp, m2.get(cp, nullid))) |
|
446 | meta["copyrev"] = hex(m1.get(cp, m2.get(cp, nullid))) | |
447 | self.ui.debug(_(" %s: copy %s:%s\n") % (f, cp, meta["copyrev"])) |
|
447 | self.ui.debug(_(" %s: copy %s:%s\n") % (f, cp, meta["copyrev"])) | |
448 | fp1, fp2 = nullid, nullid |
|
448 | fp1, fp2 = nullid, nullid | |
449 | else: |
|
449 | else: | |
450 | entry, fp1, fp2 = self.checkfilemerge(f, t, r, m1, m2) |
|
450 | entry, fp1, fp2 = self.checkfilemerge(f, t, r, m1, m2) | |
451 | if entry: |
|
451 | if entry: | |
452 | new[f] = entry |
|
452 | new[f] = entry | |
453 | continue |
|
453 | continue | |
454 |
|
454 | |||
455 | new[f] = r.add(t, meta, tr, linkrev, fp1, fp2) |
|
455 | new[f] = r.add(t, meta, tr, linkrev, fp1, fp2) | |
456 | # remember what we've added so that we can later calculate |
|
456 | # remember what we've added so that we can later calculate | |
457 | # the files to pull from a set of changesets |
|
457 | # the files to pull from a set of changesets | |
458 | changed.append(f) |
|
458 | changed.append(f) | |
459 |
|
459 | |||
460 | # update manifest |
|
460 | # update manifest | |
461 | m1 = m1.copy() |
|
461 | m1 = m1.copy() | |
462 | m1.update(new) |
|
462 | m1.update(new) | |
463 | for f in remove: |
|
463 | for f in remove: | |
464 | if f in m1: |
|
464 | if f in m1: | |
465 | del m1[f] |
|
465 | del m1[f] | |
466 | mn = self.manifest.add(m1, mf1, tr, linkrev, c1[0], c2[0], |
|
466 | mn = self.manifest.add(m1, mf1, tr, linkrev, c1[0], c2[0], | |
467 | (new, remove)) |
|
467 | (new, remove)) | |
468 |
|
468 | |||
469 | # add changeset |
|
469 | # add changeset | |
470 | new = new.keys() |
|
470 | new = new.keys() | |
471 | new.sort() |
|
471 | new.sort() | |
472 |
|
472 | |||
473 | user = user or self.ui.username() |
|
473 | user = user or self.ui.username() | |
474 | if not text: |
|
474 | if not text: | |
475 | edittext = [""] |
|
475 | edittext = [""] | |
476 | if p2 != nullid: |
|
476 | if p2 != nullid: | |
477 | edittext.append("HG: branch merge") |
|
477 | edittext.append("HG: branch merge") | |
478 | edittext.extend(["HG: changed %s" % f for f in changed]) |
|
478 | edittext.extend(["HG: changed %s" % f for f in changed]) | |
479 | edittext.extend(["HG: removed %s" % f for f in remove]) |
|
479 | edittext.extend(["HG: removed %s" % f for f in remove]) | |
480 | if not changed and not remove: |
|
480 | if not changed and not remove: | |
481 | edittext.append("HG: no files changed") |
|
481 | edittext.append("HG: no files changed") | |
482 | edittext.append("") |
|
482 | edittext.append("") | |
483 | # run editor in the repository root |
|
483 | # run editor in the repository root | |
484 | olddir = os.getcwd() |
|
484 | olddir = os.getcwd() | |
485 | os.chdir(self.root) |
|
485 | os.chdir(self.root) | |
486 | edittext = self.ui.edit("\n".join(edittext), user) |
|
486 | edittext = self.ui.edit("\n".join(edittext), user) | |
487 | os.chdir(olddir) |
|
487 | os.chdir(olddir) | |
488 | if not edittext.rstrip(): |
|
488 | if not edittext.rstrip(): | |
489 | return None |
|
489 | return None | |
490 | text = edittext |
|
490 | text = edittext | |
491 |
|
491 | |||
492 | n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date) |
|
492 | n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date) | |
493 | self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, |
|
493 | self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, | |
494 | parent2=xp2) |
|
494 | parent2=xp2) | |
495 | tr.close() |
|
495 | tr.close() | |
496 |
|
496 | |||
497 | self.dirstate.setparents(n) |
|
497 | self.dirstate.setparents(n) | |
498 | self.dirstate.update(new, "n") |
|
498 | self.dirstate.update(new, "n") | |
499 | self.dirstate.forget(remove) |
|
499 | self.dirstate.forget(remove) | |
500 |
|
500 | |||
501 | self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2) |
|
501 | self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2) | |
502 | return n |
|
502 | return n | |
503 |
|
503 | |||
504 | def walk(self, node=None, files=[], match=util.always, badmatch=None): |
|
504 | def walk(self, node=None, files=[], match=util.always, badmatch=None): | |
505 | if node: |
|
505 | if node: | |
506 | fdict = dict.fromkeys(files) |
|
506 | fdict = dict.fromkeys(files) | |
507 | for fn in self.manifest.read(self.changelog.read(node)[0]): |
|
507 | for fn in self.manifest.read(self.changelog.read(node)[0]): | |
508 | fdict.pop(fn, None) |
|
508 | fdict.pop(fn, None) | |
509 | if match(fn): |
|
509 | if match(fn): | |
510 | yield 'm', fn |
|
510 | yield 'm', fn | |
511 | for fn in fdict: |
|
511 | for fn in fdict: | |
512 | if badmatch and badmatch(fn): |
|
512 | if badmatch and badmatch(fn): | |
513 | if match(fn): |
|
513 | if match(fn): | |
514 | yield 'b', fn |
|
514 | yield 'b', fn | |
515 | else: |
|
515 | else: | |
516 | self.ui.warn(_('%s: No such file in rev %s\n') % ( |
|
516 | self.ui.warn(_('%s: No such file in rev %s\n') % ( | |
517 | util.pathto(self.getcwd(), fn), short(node))) |
|
517 | util.pathto(self.getcwd(), fn), short(node))) | |
518 | else: |
|
518 | else: | |
519 | for src, fn in self.dirstate.walk(files, match, badmatch=badmatch): |
|
519 | for src, fn in self.dirstate.walk(files, match, badmatch=badmatch): | |
520 | yield src, fn |
|
520 | yield src, fn | |
521 |
|
521 | |||
522 | def changes(self, node1=None, node2=None, files=[], match=util.always, |
|
522 | def changes(self, node1=None, node2=None, files=[], match=util.always, | |
523 | wlock=None, show_ignored=None): |
|
523 | wlock=None, show_ignored=None): | |
524 | """return changes between two nodes or node and working directory |
|
524 | """return changes between two nodes or node and working directory | |
525 |
|
525 | |||
526 | If node1 is None, use the first dirstate parent instead. |
|
526 | If node1 is None, use the first dirstate parent instead. | |
527 | If node2 is None, compare node1 with working directory. |
|
527 | If node2 is None, compare node1 with working directory. | |
528 | """ |
|
528 | """ | |
529 |
|
529 | |||
530 | def fcmp(fn, mf): |
|
530 | def fcmp(fn, mf): | |
531 | t1 = self.wread(fn) |
|
531 | t1 = self.wread(fn) | |
532 | t2 = self.file(fn).read(mf.get(fn, nullid)) |
|
532 | t2 = self.file(fn).read(mf.get(fn, nullid)) | |
533 | return cmp(t1, t2) |
|
533 | return cmp(t1, t2) | |
534 |
|
534 | |||
535 | def mfmatches(node): |
|
535 | def mfmatches(node): | |
536 | change = self.changelog.read(node) |
|
536 | change = self.changelog.read(node) | |
537 | mf = dict(self.manifest.read(change[0])) |
|
537 | mf = dict(self.manifest.read(change[0])) | |
538 | for fn in mf.keys(): |
|
538 | for fn in mf.keys(): | |
539 | if not match(fn): |
|
539 | if not match(fn): | |
540 | del mf[fn] |
|
540 | del mf[fn] | |
541 | return mf |
|
541 | return mf | |
542 |
|
542 | |||
543 | if node1: |
|
543 | if node1: | |
544 | # read the manifest from node1 before the manifest from node2, |
|
544 | # read the manifest from node1 before the manifest from node2, | |
545 | # so that we'll hit the manifest cache if we're going through |
|
545 | # so that we'll hit the manifest cache if we're going through | |
546 | # all the revisions in parent->child order. |
|
546 | # all the revisions in parent->child order. | |
547 | mf1 = mfmatches(node1) |
|
547 | mf1 = mfmatches(node1) | |
548 |
|
548 | |||
549 | # are we comparing the working directory? |
|
549 | # are we comparing the working directory? | |
550 | if not node2: |
|
550 | if not node2: | |
551 | if not wlock: |
|
551 | if not wlock: | |
552 | try: |
|
552 | try: | |
553 | wlock = self.wlock(wait=0) |
|
553 | wlock = self.wlock(wait=0) | |
554 | except lock.LockException: |
|
554 | except lock.LockException: | |
555 | wlock = None |
|
555 | wlock = None | |
556 | lookup, modified, added, removed, deleted, unknown, ignored = ( |
|
556 | lookup, modified, added, removed, deleted, unknown, ignored = ( | |
557 | self.dirstate.changes(files, match, show_ignored)) |
|
557 | self.dirstate.changes(files, match, show_ignored)) | |
558 |
|
558 | |||
559 | # are we comparing working dir against its parent? |
|
559 | # are we comparing working dir against its parent? | |
560 | if not node1: |
|
560 | if not node1: | |
561 | if lookup: |
|
561 | if lookup: | |
562 | # do a full compare of any files that might have changed |
|
562 | # do a full compare of any files that might have changed | |
563 | mf2 = mfmatches(self.dirstate.parents()[0]) |
|
563 | mf2 = mfmatches(self.dirstate.parents()[0]) | |
564 | for f in lookup: |
|
564 | for f in lookup: | |
565 | if fcmp(f, mf2): |
|
565 | if fcmp(f, mf2): | |
566 | modified.append(f) |
|
566 | modified.append(f) | |
567 | elif wlock is not None: |
|
567 | elif wlock is not None: | |
568 | self.dirstate.update([f], "n") |
|
568 | self.dirstate.update([f], "n") | |
569 | else: |
|
569 | else: | |
570 | # we are comparing working dir against non-parent |
|
570 | # we are comparing working dir against non-parent | |
571 | # generate a pseudo-manifest for the working dir |
|
571 | # generate a pseudo-manifest for the working dir | |
572 | mf2 = mfmatches(self.dirstate.parents()[0]) |
|
572 | mf2 = mfmatches(self.dirstate.parents()[0]) | |
573 | for f in lookup + modified + added: |
|
573 | for f in lookup + modified + added: | |
574 | mf2[f] = "" |
|
574 | mf2[f] = "" | |
575 | for f in removed: |
|
575 | for f in removed: | |
576 | if f in mf2: |
|
576 | if f in mf2: | |
577 | del mf2[f] |
|
577 | del mf2[f] | |
578 | else: |
|
578 | else: | |
579 | # we are comparing two revisions |
|
579 | # we are comparing two revisions | |
580 | deleted, unknown, ignored = [], [], [] |
|
580 | deleted, unknown, ignored = [], [], [] | |
581 | mf2 = mfmatches(node2) |
|
581 | mf2 = mfmatches(node2) | |
582 |
|
582 | |||
583 | if node1: |
|
583 | if node1: | |
584 | # flush lists from dirstate before comparing manifests |
|
584 | # flush lists from dirstate before comparing manifests | |
585 | modified, added = [], [] |
|
585 | modified, added = [], [] | |
586 |
|
586 | |||
587 | for fn in mf2: |
|
587 | for fn in mf2: | |
588 | if mf1.has_key(fn): |
|
588 | if mf1.has_key(fn): | |
589 | if mf1[fn] != mf2[fn] and (mf2[fn] != "" or fcmp(fn, mf1)): |
|
589 | if mf1[fn] != mf2[fn] and (mf2[fn] != "" or fcmp(fn, mf1)): | |
590 | modified.append(fn) |
|
590 | modified.append(fn) | |
591 | del mf1[fn] |
|
591 | del mf1[fn] | |
592 | else: |
|
592 | else: | |
593 | added.append(fn) |
|
593 | added.append(fn) | |
594 |
|
594 | |||
595 | removed = mf1.keys() |
|
595 | removed = mf1.keys() | |
596 |
|
596 | |||
597 | # sort and return results: |
|
597 | # sort and return results: | |
598 | for l in modified, added, removed, deleted, unknown, ignored: |
|
598 | for l in modified, added, removed, deleted, unknown, ignored: | |
599 | l.sort() |
|
599 | l.sort() | |
600 | if show_ignored is None: |
|
600 | if show_ignored is None: | |
601 | return (modified, added, removed, deleted, unknown) |
|
601 | return (modified, added, removed, deleted, unknown) | |
602 | else: |
|
602 | else: | |
603 | return (modified, added, removed, deleted, unknown, ignored) |
|
603 | return (modified, added, removed, deleted, unknown, ignored) | |
604 |
|
604 | |||
605 | def add(self, list, wlock=None): |
|
605 | def add(self, list, wlock=None): | |
606 | if not wlock: |
|
606 | if not wlock: | |
607 | wlock = self.wlock() |
|
607 | wlock = self.wlock() | |
608 | for f in list: |
|
608 | for f in list: | |
609 | p = self.wjoin(f) |
|
609 | p = self.wjoin(f) | |
610 | if not os.path.exists(p): |
|
610 | if not os.path.exists(p): | |
611 | self.ui.warn(_("%s does not exist!\n") % f) |
|
611 | self.ui.warn(_("%s does not exist!\n") % f) | |
612 | elif not os.path.isfile(p): |
|
612 | elif not os.path.isfile(p): | |
613 | self.ui.warn(_("%s not added: only files supported currently\n") |
|
613 | self.ui.warn(_("%s not added: only files supported currently\n") | |
614 | % f) |
|
614 | % f) | |
615 | elif self.dirstate.state(f) in 'an': |
|
615 | elif self.dirstate.state(f) in 'an': | |
616 | self.ui.warn(_("%s already tracked!\n") % f) |
|
616 | self.ui.warn(_("%s already tracked!\n") % f) | |
617 | else: |
|
617 | else: | |
618 | self.dirstate.update([f], "a") |
|
618 | self.dirstate.update([f], "a") | |
619 |
|
619 | |||
620 | def forget(self, list, wlock=None): |
|
620 | def forget(self, list, wlock=None): | |
621 | if not wlock: |
|
621 | if not wlock: | |
622 | wlock = self.wlock() |
|
622 | wlock = self.wlock() | |
623 | for f in list: |
|
623 | for f in list: | |
624 | if self.dirstate.state(f) not in 'ai': |
|
624 | if self.dirstate.state(f) not in 'ai': | |
625 | self.ui.warn(_("%s not added!\n") % f) |
|
625 | self.ui.warn(_("%s not added!\n") % f) | |
626 | else: |
|
626 | else: | |
627 | self.dirstate.forget([f]) |
|
627 | self.dirstate.forget([f]) | |
628 |
|
628 | |||
629 | def remove(self, list, unlink=False, wlock=None): |
|
629 | def remove(self, list, unlink=False, wlock=None): | |
630 | if unlink: |
|
630 | if unlink: | |
631 | for f in list: |
|
631 | for f in list: | |
632 | try: |
|
632 | try: | |
633 | util.unlink(self.wjoin(f)) |
|
633 | util.unlink(self.wjoin(f)) | |
634 | except OSError, inst: |
|
634 | except OSError, inst: | |
635 | if inst.errno != errno.ENOENT: |
|
635 | if inst.errno != errno.ENOENT: | |
636 | raise |
|
636 | raise | |
637 | if not wlock: |
|
637 | if not wlock: | |
638 | wlock = self.wlock() |
|
638 | wlock = self.wlock() | |
639 | for f in list: |
|
639 | for f in list: | |
640 | p = self.wjoin(f) |
|
640 | p = self.wjoin(f) | |
641 | if os.path.exists(p): |
|
641 | if os.path.exists(p): | |
642 | self.ui.warn(_("%s still exists!\n") % f) |
|
642 | self.ui.warn(_("%s still exists!\n") % f) | |
643 | elif self.dirstate.state(f) == 'a': |
|
643 | elif self.dirstate.state(f) == 'a': | |
644 | self.dirstate.forget([f]) |
|
644 | self.dirstate.forget([f]) | |
645 | elif f not in self.dirstate: |
|
645 | elif f not in self.dirstate: | |
646 | self.ui.warn(_("%s not tracked!\n") % f) |
|
646 | self.ui.warn(_("%s not tracked!\n") % f) | |
647 | else: |
|
647 | else: | |
648 | self.dirstate.update([f], "r") |
|
648 | self.dirstate.update([f], "r") | |
649 |
|
649 | |||
650 | def undelete(self, list, wlock=None): |
|
650 | def undelete(self, list, wlock=None): | |
651 | p = self.dirstate.parents()[0] |
|
651 | p = self.dirstate.parents()[0] | |
652 | mn = self.changelog.read(p)[0] |
|
652 | mn = self.changelog.read(p)[0] | |
653 | mf = self.manifest.readflags(mn) |
|
653 | mf = self.manifest.readflags(mn) | |
654 | m = self.manifest.read(mn) |
|
654 | m = self.manifest.read(mn) | |
655 | if not wlock: |
|
655 | if not wlock: | |
656 | wlock = self.wlock() |
|
656 | wlock = self.wlock() | |
657 | for f in list: |
|
657 | for f in list: | |
658 | if self.dirstate.state(f) not in "r": |
|
658 | if self.dirstate.state(f) not in "r": | |
659 | self.ui.warn("%s not removed!\n" % f) |
|
659 | self.ui.warn("%s not removed!\n" % f) | |
660 | else: |
|
660 | else: | |
661 | t = self.file(f).read(m[f]) |
|
661 | t = self.file(f).read(m[f]) | |
662 | self.wwrite(f, t) |
|
662 | self.wwrite(f, t) | |
663 | util.set_exec(self.wjoin(f), mf[f]) |
|
663 | util.set_exec(self.wjoin(f), mf[f]) | |
664 | self.dirstate.update([f], "n") |
|
664 | self.dirstate.update([f], "n") | |
665 |
|
665 | |||
666 | def copy(self, source, dest, wlock=None): |
|
666 | def copy(self, source, dest, wlock=None): | |
667 | p = self.wjoin(dest) |
|
667 | p = self.wjoin(dest) | |
668 | if not os.path.exists(p): |
|
668 | if not os.path.exists(p): | |
669 | self.ui.warn(_("%s does not exist!\n") % dest) |
|
669 | self.ui.warn(_("%s does not exist!\n") % dest) | |
670 | elif not os.path.isfile(p): |
|
670 | elif not os.path.isfile(p): | |
671 | self.ui.warn(_("copy failed: %s is not a file\n") % dest) |
|
671 | self.ui.warn(_("copy failed: %s is not a file\n") % dest) | |
672 | else: |
|
672 | else: | |
673 | if not wlock: |
|
673 | if not wlock: | |
674 | wlock = self.wlock() |
|
674 | wlock = self.wlock() | |
675 | if self.dirstate.state(dest) == '?': |
|
675 | if self.dirstate.state(dest) == '?': | |
676 | self.dirstate.update([dest], "a") |
|
676 | self.dirstate.update([dest], "a") | |
677 | self.dirstate.copy(source, dest) |
|
677 | self.dirstate.copy(source, dest) | |
678 |
|
678 | |||
679 | def heads(self, start=None): |
|
679 | def heads(self, start=None): | |
680 | heads = self.changelog.heads(start) |
|
680 | heads = self.changelog.heads(start) | |
681 | # sort the output in rev descending order |
|
681 | # sort the output in rev descending order | |
682 | heads = [(-self.changelog.rev(h), h) for h in heads] |
|
682 | heads = [(-self.changelog.rev(h), h) for h in heads] | |
683 | heads.sort() |
|
683 | heads.sort() | |
684 | return [n for (r, n) in heads] |
|
684 | return [n for (r, n) in heads] | |
685 |
|
685 | |||
686 | # branchlookup returns a dict giving a list of branches for |
|
686 | # branchlookup returns a dict giving a list of branches for | |
687 | # each head. A branch is defined as the tag of a node or |
|
687 | # each head. A branch is defined as the tag of a node or | |
688 | # the branch of the node's parents. If a node has multiple |
|
688 | # the branch of the node's parents. If a node has multiple | |
689 | # branch tags, tags are eliminated if they are visible from other |
|
689 | # branch tags, tags are eliminated if they are visible from other | |
690 | # branch tags. |
|
690 | # branch tags. | |
691 | # |
|
691 | # | |
692 | # So, for this graph: a->b->c->d->e |
|
692 | # So, for this graph: a->b->c->d->e | |
693 | # \ / |
|
693 | # \ / | |
694 | # aa -----/ |
|
694 | # aa -----/ | |
695 | # a has tag 2.6.12 |
|
695 | # a has tag 2.6.12 | |
696 | # d has tag 2.6.13 |
|
696 | # d has tag 2.6.13 | |
697 | # e would have branch tags for 2.6.12 and 2.6.13. Because the node |
|
697 | # e would have branch tags for 2.6.12 and 2.6.13. Because the node | |
698 | # for 2.6.12 can be reached from the node 2.6.13, that is eliminated |
|
698 | # for 2.6.12 can be reached from the node 2.6.13, that is eliminated | |
699 | # from the list. |
|
699 | # from the list. | |
700 | # |
|
700 | # | |
701 | # It is possible that more than one head will have the same branch tag. |
|
701 | # It is possible that more than one head will have the same branch tag. | |
702 | # callers need to check the result for multiple heads under the same |
|
702 | # callers need to check the result for multiple heads under the same | |
703 | # branch tag if that is a problem for them (ie checkout of a specific |
|
703 | # branch tag if that is a problem for them (ie checkout of a specific | |
704 | # branch). |
|
704 | # branch). | |
705 | # |
|
705 | # | |
706 | # passing in a specific branch will limit the depth of the search |
|
706 | # passing in a specific branch will limit the depth of the search | |
707 | # through the parents. It won't limit the branches returned in the |
|
707 | # through the parents. It won't limit the branches returned in the | |
708 | # result though. |
|
708 | # result though. | |
709 | def branchlookup(self, heads=None, branch=None): |
|
709 | def branchlookup(self, heads=None, branch=None): | |
710 | if not heads: |
|
710 | if not heads: | |
711 | heads = self.heads() |
|
711 | heads = self.heads() | |
712 | headt = [ h for h in heads ] |
|
712 | headt = [ h for h in heads ] | |
713 | chlog = self.changelog |
|
713 | chlog = self.changelog | |
714 | branches = {} |
|
714 | branches = {} | |
715 | merges = [] |
|
715 | merges = [] | |
716 | seenmerge = {} |
|
716 | seenmerge = {} | |
717 |
|
717 | |||
718 | # traverse the tree once for each head, recording in the branches |
|
718 | # traverse the tree once for each head, recording in the branches | |
719 | # dict which tags are visible from this head. The branches |
|
719 | # dict which tags are visible from this head. The branches | |
720 | # dict also records which tags are visible from each tag |
|
720 | # dict also records which tags are visible from each tag | |
721 | # while we traverse. |
|
721 | # while we traverse. | |
722 | while headt or merges: |
|
722 | while headt or merges: | |
723 | if merges: |
|
723 | if merges: | |
724 | n, found = merges.pop() |
|
724 | n, found = merges.pop() | |
725 | visit = [n] |
|
725 | visit = [n] | |
726 | else: |
|
726 | else: | |
727 | h = headt.pop() |
|
727 | h = headt.pop() | |
728 | visit = [h] |
|
728 | visit = [h] | |
729 | found = [h] |
|
729 | found = [h] | |
730 | seen = {} |
|
730 | seen = {} | |
731 | while visit: |
|
731 | while visit: | |
732 | n = visit.pop() |
|
732 | n = visit.pop() | |
733 | if n in seen: |
|
733 | if n in seen: | |
734 | continue |
|
734 | continue | |
735 | pp = chlog.parents(n) |
|
735 | pp = chlog.parents(n) | |
736 | tags = self.nodetags(n) |
|
736 | tags = self.nodetags(n) | |
737 | if tags: |
|
737 | if tags: | |
738 | for x in tags: |
|
738 | for x in tags: | |
739 | if x == 'tip': |
|
739 | if x == 'tip': | |
740 | continue |
|
740 | continue | |
741 | for f in found: |
|
741 | for f in found: | |
742 | branches.setdefault(f, {})[n] = 1 |
|
742 | branches.setdefault(f, {})[n] = 1 | |
743 | branches.setdefault(n, {})[n] = 1 |
|
743 | branches.setdefault(n, {})[n] = 1 | |
744 | break |
|
744 | break | |
745 | if n not in found: |
|
745 | if n not in found: | |
746 | found.append(n) |
|
746 | found.append(n) | |
747 | if branch in tags: |
|
747 | if branch in tags: | |
748 | continue |
|
748 | continue | |
749 | seen[n] = 1 |
|
749 | seen[n] = 1 | |
750 | if pp[1] != nullid and n not in seenmerge: |
|
750 | if pp[1] != nullid and n not in seenmerge: | |
751 | merges.append((pp[1], [x for x in found])) |
|
751 | merges.append((pp[1], [x for x in found])) | |
752 | seenmerge[n] = 1 |
|
752 | seenmerge[n] = 1 | |
753 | if pp[0] != nullid: |
|
753 | if pp[0] != nullid: | |
754 | visit.append(pp[0]) |
|
754 | visit.append(pp[0]) | |
755 | # traverse the branches dict, eliminating branch tags from each |
|
755 | # traverse the branches dict, eliminating branch tags from each | |
756 | # head that are visible from another branch tag for that head. |
|
756 | # head that are visible from another branch tag for that head. | |
757 | out = {} |
|
757 | out = {} | |
758 | viscache = {} |
|
758 | viscache = {} | |
759 | for h in heads: |
|
759 | for h in heads: | |
760 | def visible(node): |
|
760 | def visible(node): | |
761 | if node in viscache: |
|
761 | if node in viscache: | |
762 | return viscache[node] |
|
762 | return viscache[node] | |
763 | ret = {} |
|
763 | ret = {} | |
764 | visit = [node] |
|
764 | visit = [node] | |
765 | while visit: |
|
765 | while visit: | |
766 | x = visit.pop() |
|
766 | x = visit.pop() | |
767 | if x in viscache: |
|
767 | if x in viscache: | |
768 | ret.update(viscache[x]) |
|
768 | ret.update(viscache[x]) | |
769 | elif x not in ret: |
|
769 | elif x not in ret: | |
770 | ret[x] = 1 |
|
770 | ret[x] = 1 | |
771 | if x in branches: |
|
771 | if x in branches: | |
772 | visit[len(visit):] = branches[x].keys() |
|
772 | visit[len(visit):] = branches[x].keys() | |
773 | viscache[node] = ret |
|
773 | viscache[node] = ret | |
774 | return ret |
|
774 | return ret | |
775 | if h not in branches: |
|
775 | if h not in branches: | |
776 | continue |
|
776 | continue | |
777 | # O(n^2), but somewhat limited. This only searches the |
|
777 | # O(n^2), but somewhat limited. This only searches the | |
778 | # tags visible from a specific head, not all the tags in the |
|
778 | # tags visible from a specific head, not all the tags in the | |
779 | # whole repo. |
|
779 | # whole repo. | |
780 | for b in branches[h]: |
|
780 | for b in branches[h]: | |
781 | vis = False |
|
781 | vis = False | |
782 | for bb in branches[h].keys(): |
|
782 | for bb in branches[h].keys(): | |
783 | if b != bb: |
|
783 | if b != bb: | |
784 | if b in visible(bb): |
|
784 | if b in visible(bb): | |
785 | vis = True |
|
785 | vis = True | |
786 | break |
|
786 | break | |
787 | if not vis: |
|
787 | if not vis: | |
788 | l = out.setdefault(h, []) |
|
788 | l = out.setdefault(h, []) | |
789 | l[len(l):] = self.nodetags(b) |
|
789 | l[len(l):] = self.nodetags(b) | |
790 | return out |
|
790 | return out | |
791 |
|
791 | |||
792 | def branches(self, nodes): |
|
792 | def branches(self, nodes): | |
793 | if not nodes: |
|
793 | if not nodes: | |
794 | nodes = [self.changelog.tip()] |
|
794 | nodes = [self.changelog.tip()] | |
795 | b = [] |
|
795 | b = [] | |
796 | for n in nodes: |
|
796 | for n in nodes: | |
797 | t = n |
|
797 | t = n | |
798 | while n: |
|
798 | while n: | |
799 | p = self.changelog.parents(n) |
|
799 | p = self.changelog.parents(n) | |
800 | if p[1] != nullid or p[0] == nullid: |
|
800 | if p[1] != nullid or p[0] == nullid: | |
801 | b.append((t, n, p[0], p[1])) |
|
801 | b.append((t, n, p[0], p[1])) | |
802 | break |
|
802 | break | |
803 | n = p[0] |
|
803 | n = p[0] | |
804 | return b |
|
804 | return b | |
805 |
|
805 | |||
806 | def between(self, pairs): |
|
806 | def between(self, pairs): | |
807 | r = [] |
|
807 | r = [] | |
808 |
|
808 | |||
809 | for top, bottom in pairs: |
|
809 | for top, bottom in pairs: | |
810 | n, l, i = top, [], 0 |
|
810 | n, l, i = top, [], 0 | |
811 | f = 1 |
|
811 | f = 1 | |
812 |
|
812 | |||
813 | while n != bottom: |
|
813 | while n != bottom: | |
814 | p = self.changelog.parents(n)[0] |
|
814 | p = self.changelog.parents(n)[0] | |
815 | if i == f: |
|
815 | if i == f: | |
816 | l.append(n) |
|
816 | l.append(n) | |
817 | f = f * 2 |
|
817 | f = f * 2 | |
818 | n = p |
|
818 | n = p | |
819 | i += 1 |
|
819 | i += 1 | |
820 |
|
820 | |||
821 | r.append(l) |
|
821 | r.append(l) | |
822 |
|
822 | |||
823 | return r |
|
823 | return r | |
824 |
|
824 | |||
825 | def findincoming(self, remote, base=None, heads=None, force=False): |
|
825 | def findincoming(self, remote, base=None, heads=None, force=False): | |
826 | m = self.changelog.nodemap |
|
826 | m = self.changelog.nodemap | |
827 | search = [] |
|
827 | search = [] | |
828 | fetch = {} |
|
828 | fetch = {} | |
829 | seen = {} |
|
829 | seen = {} | |
830 | seenbranch = {} |
|
830 | seenbranch = {} | |
831 | if base == None: |
|
831 | if base == None: | |
832 | base = {} |
|
832 | base = {} | |
833 |
|
833 | |||
834 | if not heads: |
|
834 | if not heads: | |
835 | heads = remote.heads() |
|
835 | heads = remote.heads() | |
836 |
|
836 | |||
837 | if self.changelog.tip() == nullid: |
|
837 | if self.changelog.tip() == nullid: | |
838 | if heads != [nullid]: |
|
838 | if heads != [nullid]: | |
839 | return [nullid] |
|
839 | return [nullid] | |
840 | return [] |
|
840 | return [] | |
841 |
|
841 | |||
842 | # assume we're closer to the tip than the root |
|
842 | # assume we're closer to the tip than the root | |
843 | # and start by examining the heads |
|
843 | # and start by examining the heads | |
844 | self.ui.status(_("searching for changes\n")) |
|
844 | self.ui.status(_("searching for changes\n")) | |
845 |
|
845 | |||
846 | unknown = [] |
|
846 | unknown = [] | |
847 | for h in heads: |
|
847 | for h in heads: | |
848 | if h not in m: |
|
848 | if h not in m: | |
849 | unknown.append(h) |
|
849 | unknown.append(h) | |
850 | else: |
|
850 | else: | |
851 | base[h] = 1 |
|
851 | base[h] = 1 | |
852 |
|
852 | |||
853 | if not unknown: |
|
853 | if not unknown: | |
854 | return [] |
|
854 | return [] | |
855 |
|
855 | |||
856 | rep = {} |
|
856 | rep = {} | |
857 | reqcnt = 0 |
|
857 | reqcnt = 0 | |
858 |
|
858 | |||
859 | # search through remote branches |
|
859 | # search through remote branches | |
860 | # a 'branch' here is a linear segment of history, with four parts: |
|
860 | # a 'branch' here is a linear segment of history, with four parts: | |
861 | # head, root, first parent, second parent |
|
861 | # head, root, first parent, second parent | |
862 | # (a branch always has two parents (or none) by definition) |
|
862 | # (a branch always has two parents (or none) by definition) | |
863 | unknown = remote.branches(unknown) |
|
863 | unknown = remote.branches(unknown) | |
864 | while unknown: |
|
864 | while unknown: | |
865 | r = [] |
|
865 | r = [] | |
866 | while unknown: |
|
866 | while unknown: | |
867 | n = unknown.pop(0) |
|
867 | n = unknown.pop(0) | |
868 | if n[0] in seen: |
|
868 | if n[0] in seen: | |
869 | continue |
|
869 | continue | |
870 |
|
870 | |||
871 | self.ui.debug(_("examining %s:%s\n") |
|
871 | self.ui.debug(_("examining %s:%s\n") | |
872 | % (short(n[0]), short(n[1]))) |
|
872 | % (short(n[0]), short(n[1]))) | |
873 | if n[0] == nullid: |
|
873 | if n[0] == nullid: | |
874 | break |
|
874 | break | |
875 | if n in seenbranch: |
|
875 | if n in seenbranch: | |
876 | self.ui.debug(_("branch already found\n")) |
|
876 | self.ui.debug(_("branch already found\n")) | |
877 | continue |
|
877 | continue | |
878 | if n[1] and n[1] in m: # do we know the base? |
|
878 | if n[1] and n[1] in m: # do we know the base? | |
879 | self.ui.debug(_("found incomplete branch %s:%s\n") |
|
879 | self.ui.debug(_("found incomplete branch %s:%s\n") | |
880 | % (short(n[0]), short(n[1]))) |
|
880 | % (short(n[0]), short(n[1]))) | |
881 | search.append(n) # schedule branch range for scanning |
|
881 | search.append(n) # schedule branch range for scanning | |
882 | seenbranch[n] = 1 |
|
882 | seenbranch[n] = 1 | |
883 | else: |
|
883 | else: | |
884 | if n[1] not in seen and n[1] not in fetch: |
|
884 | if n[1] not in seen and n[1] not in fetch: | |
885 | if n[2] in m and n[3] in m: |
|
885 | if n[2] in m and n[3] in m: | |
886 | self.ui.debug(_("found new changeset %s\n") % |
|
886 | self.ui.debug(_("found new changeset %s\n") % | |
887 | short(n[1])) |
|
887 | short(n[1])) | |
888 | fetch[n[1]] = 1 # earliest unknown |
|
888 | fetch[n[1]] = 1 # earliest unknown | |
889 | base[n[2]] = 1 # latest known |
|
889 | base[n[2]] = 1 # latest known | |
890 | continue |
|
890 | continue | |
891 |
|
891 | |||
892 | for a in n[2:4]: |
|
892 | for a in n[2:4]: | |
893 | if a not in rep: |
|
893 | if a not in rep: | |
894 | r.append(a) |
|
894 | r.append(a) | |
895 | rep[a] = 1 |
|
895 | rep[a] = 1 | |
896 |
|
896 | |||
897 | seen[n[0]] = 1 |
|
897 | seen[n[0]] = 1 | |
898 |
|
898 | |||
899 | if r: |
|
899 | if r: | |
900 | reqcnt += 1 |
|
900 | reqcnt += 1 | |
901 | self.ui.debug(_("request %d: %s\n") % |
|
901 | self.ui.debug(_("request %d: %s\n") % | |
902 | (reqcnt, " ".join(map(short, r)))) |
|
902 | (reqcnt, " ".join(map(short, r)))) | |
903 | for p in range(0, len(r), 10): |
|
903 | for p in range(0, len(r), 10): | |
904 | for b in remote.branches(r[p:p+10]): |
|
904 | for b in remote.branches(r[p:p+10]): | |
905 | self.ui.debug(_("received %s:%s\n") % |
|
905 | self.ui.debug(_("received %s:%s\n") % | |
906 | (short(b[0]), short(b[1]))) |
|
906 | (short(b[0]), short(b[1]))) | |
907 | if b[0] in m: |
|
907 | if b[0] in m: | |
908 | self.ui.debug(_("found base node %s\n") |
|
908 | self.ui.debug(_("found base node %s\n") | |
909 | % short(b[0])) |
|
909 | % short(b[0])) | |
910 | base[b[0]] = 1 |
|
910 | base[b[0]] = 1 | |
911 | elif b[0] not in seen: |
|
911 | elif b[0] not in seen: | |
912 | unknown.append(b) |
|
912 | unknown.append(b) | |
913 |
|
913 | |||
914 | # do binary search on the branches we found |
|
914 | # do binary search on the branches we found | |
915 | while search: |
|
915 | while search: | |
916 | n = search.pop(0) |
|
916 | n = search.pop(0) | |
917 | reqcnt += 1 |
|
917 | reqcnt += 1 | |
918 | l = remote.between([(n[0], n[1])])[0] |
|
918 | l = remote.between([(n[0], n[1])])[0] | |
919 | l.append(n[1]) |
|
919 | l.append(n[1]) | |
920 | p = n[0] |
|
920 | p = n[0] | |
921 | f = 1 |
|
921 | f = 1 | |
922 | for i in l: |
|
922 | for i in l: | |
923 | self.ui.debug(_("narrowing %d:%d %s\n") % (f, len(l), short(i))) |
|
923 | self.ui.debug(_("narrowing %d:%d %s\n") % (f, len(l), short(i))) | |
924 | if i in m: |
|
924 | if i in m: | |
925 | if f <= 2: |
|
925 | if f <= 2: | |
926 | self.ui.debug(_("found new branch changeset %s\n") % |
|
926 | self.ui.debug(_("found new branch changeset %s\n") % | |
927 | short(p)) |
|
927 | short(p)) | |
928 | fetch[p] = 1 |
|
928 | fetch[p] = 1 | |
929 | base[i] = 1 |
|
929 | base[i] = 1 | |
930 | else: |
|
930 | else: | |
931 | self.ui.debug(_("narrowed branch search to %s:%s\n") |
|
931 | self.ui.debug(_("narrowed branch search to %s:%s\n") | |
932 | % (short(p), short(i))) |
|
932 | % (short(p), short(i))) | |
933 | search.append((p, i)) |
|
933 | search.append((p, i)) | |
934 | break |
|
934 | break | |
935 | p, f = i, f * 2 |
|
935 | p, f = i, f * 2 | |
936 |
|
936 | |||
937 | # sanity check our fetch list |
|
937 | # sanity check our fetch list | |
938 | for f in fetch.keys(): |
|
938 | for f in fetch.keys(): | |
939 | if f in m: |
|
939 | if f in m: | |
940 | raise repo.RepoError(_("already have changeset ") + short(f[:4])) |
|
940 | raise repo.RepoError(_("already have changeset ") + short(f[:4])) | |
941 |
|
941 | |||
942 | if base.keys() == [nullid]: |
|
942 | if base.keys() == [nullid]: | |
943 | if force: |
|
943 | if force: | |
944 | self.ui.warn(_("warning: repository is unrelated\n")) |
|
944 | self.ui.warn(_("warning: repository is unrelated\n")) | |
945 | else: |
|
945 | else: | |
946 | raise util.Abort(_("repository is unrelated")) |
|
946 | raise util.Abort(_("repository is unrelated")) | |
947 |
|
947 | |||
948 | self.ui.note(_("found new changesets starting at ") + |
|
948 | self.ui.note(_("found new changesets starting at ") + | |
949 | " ".join([short(f) for f in fetch]) + "\n") |
|
949 | " ".join([short(f) for f in fetch]) + "\n") | |
950 |
|
950 | |||
951 | self.ui.debug(_("%d total queries\n") % reqcnt) |
|
951 | self.ui.debug(_("%d total queries\n") % reqcnt) | |
952 |
|
952 | |||
953 | return fetch.keys() |
|
953 | return fetch.keys() | |
954 |
|
954 | |||
955 | def findoutgoing(self, remote, base=None, heads=None, force=False): |
|
955 | def findoutgoing(self, remote, base=None, heads=None, force=False): | |
956 | """Return list of nodes that are roots of subsets not in remote |
|
956 | """Return list of nodes that are roots of subsets not in remote | |
957 |
|
957 | |||
958 | If base dict is specified, assume that these nodes and their parents |
|
958 | If base dict is specified, assume that these nodes and their parents | |
959 | exist on the remote side. |
|
959 | exist on the remote side. | |
960 | If a list of heads is specified, return only nodes which are heads |
|
960 | If a list of heads is specified, return only nodes which are heads | |
961 | or ancestors of these heads, and return a second element which |
|
961 | or ancestors of these heads, and return a second element which | |
962 | contains all remote heads which get new children. |
|
962 | contains all remote heads which get new children. | |
963 | """ |
|
963 | """ | |
964 | if base == None: |
|
964 | if base == None: | |
965 | base = {} |
|
965 | base = {} | |
966 | self.findincoming(remote, base, heads, force=force) |
|
966 | self.findincoming(remote, base, heads, force=force) | |
967 |
|
967 | |||
968 | self.ui.debug(_("common changesets up to ") |
|
968 | self.ui.debug(_("common changesets up to ") | |
969 | + " ".join(map(short, base.keys())) + "\n") |
|
969 | + " ".join(map(short, base.keys())) + "\n") | |
970 |
|
970 | |||
971 | remain = dict.fromkeys(self.changelog.nodemap) |
|
971 | remain = dict.fromkeys(self.changelog.nodemap) | |
972 |
|
972 | |||
973 | # prune everything remote has from the tree |
|
973 | # prune everything remote has from the tree | |
974 | del remain[nullid] |
|
974 | del remain[nullid] | |
975 | remove = base.keys() |
|
975 | remove = base.keys() | |
976 | while remove: |
|
976 | while remove: | |
977 | n = remove.pop(0) |
|
977 | n = remove.pop(0) | |
978 | if n in remain: |
|
978 | if n in remain: | |
979 | del remain[n] |
|
979 | del remain[n] | |
980 | for p in self.changelog.parents(n): |
|
980 | for p in self.changelog.parents(n): | |
981 | remove.append(p) |
|
981 | remove.append(p) | |
982 |
|
982 | |||
983 | # find every node whose parents have been pruned |
|
983 | # find every node whose parents have been pruned | |
984 | subset = [] |
|
984 | subset = [] | |
985 | # find every remote head that will get new children |
|
985 | # find every remote head that will get new children | |
986 | updated_heads = {} |
|
986 | updated_heads = {} | |
987 | for n in remain: |
|
987 | for n in remain: | |
988 | p1, p2 = self.changelog.parents(n) |
|
988 | p1, p2 = self.changelog.parents(n) | |
989 | if p1 not in remain and p2 not in remain: |
|
989 | if p1 not in remain and p2 not in remain: | |
990 | subset.append(n) |
|
990 | subset.append(n) | |
991 | if heads: |
|
991 | if heads: | |
992 | if p1 in heads: |
|
992 | if p1 in heads: | |
993 | updated_heads[p1] = True |
|
993 | updated_heads[p1] = True | |
994 | if p2 in heads: |
|
994 | if p2 in heads: | |
995 | updated_heads[p2] = True |
|
995 | updated_heads[p2] = True | |
996 |
|
996 | |||
997 | # this is the set of all roots we have to push |
|
997 | # this is the set of all roots we have to push | |
998 | if heads: |
|
998 | if heads: | |
999 | return subset, updated_heads.keys() |
|
999 | return subset, updated_heads.keys() | |
1000 | else: |
|
1000 | else: | |
1001 | return subset |
|
1001 | return subset | |
1002 |
|
1002 | |||
1003 | def pull(self, remote, heads=None, force=False): |
|
1003 | def pull(self, remote, heads=None, force=False): | |
1004 | l = self.lock() |
|
1004 | l = self.lock() | |
1005 |
|
1005 | |||
1006 | fetch = self.findincoming(remote, force=force) |
|
1006 | fetch = self.findincoming(remote, force=force) | |
1007 | if fetch == [nullid]: |
|
1007 | if fetch == [nullid]: | |
1008 | self.ui.status(_("requesting all changes\n")) |
|
1008 | self.ui.status(_("requesting all changes\n")) | |
1009 |
|
1009 | |||
1010 | if not fetch: |
|
1010 | if not fetch: | |
1011 | self.ui.status(_("no changes found\n")) |
|
1011 | self.ui.status(_("no changes found\n")) | |
1012 | return 0 |
|
1012 | return 0 | |
1013 |
|
1013 | |||
1014 | if heads is None: |
|
1014 | if heads is None: | |
1015 | cg = remote.changegroup(fetch, 'pull') |
|
1015 | cg = remote.changegroup(fetch, 'pull') | |
1016 | else: |
|
1016 | else: | |
1017 | cg = remote.changegroupsubset(fetch, heads, 'pull') |
|
1017 | cg = remote.changegroupsubset(fetch, heads, 'pull') | |
1018 | return self.addchangegroup(cg) |
|
1018 | return self.addchangegroup(cg) | |
1019 |
|
1019 | |||
1020 | def push(self, remote, force=False, revs=None): |
|
1020 | def push(self, remote, force=False, revs=None): | |
1021 | lock = remote.lock() |
|
1021 | lock = remote.lock() | |
1022 |
|
1022 | |||
1023 | base = {} |
|
1023 | base = {} | |
1024 | remote_heads = remote.heads() |
|
1024 | remote_heads = remote.heads() | |
1025 | inc = self.findincoming(remote, base, remote_heads, force=force) |
|
1025 | inc = self.findincoming(remote, base, remote_heads, force=force) | |
1026 | if not force and inc: |
|
1026 | if not force and inc: | |
1027 | self.ui.warn(_("abort: unsynced remote changes!\n")) |
|
1027 | self.ui.warn(_("abort: unsynced remote changes!\n")) | |
1028 | self.ui.status(_("(did you forget to sync?" |
|
1028 | self.ui.status(_("(did you forget to sync?" | |
1029 | " use push -f to force)\n")) |
|
1029 | " use push -f to force)\n")) | |
1030 | return 1 |
|
1030 | return 1 | |
1031 |
|
1031 | |||
1032 | update, updated_heads = self.findoutgoing(remote, base, remote_heads) |
|
1032 | update, updated_heads = self.findoutgoing(remote, base, remote_heads) | |
1033 | if revs is not None: |
|
1033 | if revs is not None: | |
1034 | msng_cl, bases, heads = self.changelog.nodesbetween(update, revs) |
|
1034 | msng_cl, bases, heads = self.changelog.nodesbetween(update, revs) | |
1035 | else: |
|
1035 | else: | |
1036 | bases, heads = update, self.changelog.heads() |
|
1036 | bases, heads = update, self.changelog.heads() | |
1037 |
|
1037 | |||
1038 | if not bases: |
|
1038 | if not bases: | |
1039 | self.ui.status(_("no changes found\n")) |
|
1039 | self.ui.status(_("no changes found\n")) | |
1040 | return 1 |
|
1040 | return 1 | |
1041 | elif not force: |
|
1041 | elif not force: | |
1042 | if revs is not None: |
|
1042 | # FIXME we don't properly detect creation of new heads | |
1043 | updated_heads = {} |
|
1043 | # in the push -r case, assume the user knows what he's doing | |
1044 | for base in msng_cl: |
|
1044 | if not revs and len(remote_heads) < len(heads) \ | |
1045 | for parent in self.changelog.parents(base): |
|
1045 | and remote_heads != [nullid]: | |
1046 | if parent in remote_heads: |
|
|||
1047 | updated_heads[parent] = True |
|
|||
1048 | updated_heads = updated_heads.keys() |
|
|||
1049 | if len(updated_heads) < len(heads): |
|
|||
1050 | self.ui.warn(_("abort: push creates new remote branches!\n")) |
|
1046 | self.ui.warn(_("abort: push creates new remote branches!\n")) | |
1051 | self.ui.status(_("(did you forget to merge?" |
|
1047 | self.ui.status(_("(did you forget to merge?" | |
1052 | " use push -f to force)\n")) |
|
1048 | " use push -f to force)\n")) | |
1053 | return 1 |
|
1049 | return 1 | |
1054 |
|
1050 | |||
1055 | if revs is None: |
|
1051 | if revs is None: | |
1056 | cg = self.changegroup(update, 'push') |
|
1052 | cg = self.changegroup(update, 'push') | |
1057 | else: |
|
1053 | else: | |
1058 | cg = self.changegroupsubset(update, revs, 'push') |
|
1054 | cg = self.changegroupsubset(update, revs, 'push') | |
1059 | return remote.addchangegroup(cg) |
|
1055 | return remote.addchangegroup(cg) | |
1060 |
|
1056 | |||
1061 | def changegroupsubset(self, bases, heads, source): |
|
1057 | def changegroupsubset(self, bases, heads, source): | |
1062 | """This function generates a changegroup consisting of all the nodes |
|
1058 | """This function generates a changegroup consisting of all the nodes | |
1063 | that are descendents of any of the bases, and ancestors of any of |
|
1059 | that are descendents of any of the bases, and ancestors of any of | |
1064 | the heads. |
|
1060 | the heads. | |
1065 |
|
1061 | |||
1066 | It is fairly complex as determining which filenodes and which |
|
1062 | It is fairly complex as determining which filenodes and which | |
1067 | manifest nodes need to be included for the changeset to be complete |
|
1063 | manifest nodes need to be included for the changeset to be complete | |
1068 | is non-trivial. |
|
1064 | is non-trivial. | |
1069 |
|
1065 | |||
1070 | Another wrinkle is doing the reverse, figuring out which changeset in |
|
1066 | Another wrinkle is doing the reverse, figuring out which changeset in | |
1071 | the changegroup a particular filenode or manifestnode belongs to.""" |
|
1067 | the changegroup a particular filenode or manifestnode belongs to.""" | |
1072 |
|
1068 | |||
1073 | self.hook('preoutgoing', throw=True, source=source) |
|
1069 | self.hook('preoutgoing', throw=True, source=source) | |
1074 |
|
1070 | |||
1075 | # Set up some initial variables |
|
1071 | # Set up some initial variables | |
1076 | # Make it easy to refer to self.changelog |
|
1072 | # Make it easy to refer to self.changelog | |
1077 | cl = self.changelog |
|
1073 | cl = self.changelog | |
1078 | # msng is short for missing - compute the list of changesets in this |
|
1074 | # msng is short for missing - compute the list of changesets in this | |
1079 | # changegroup. |
|
1075 | # changegroup. | |
1080 | msng_cl_lst, bases, heads = cl.nodesbetween(bases, heads) |
|
1076 | msng_cl_lst, bases, heads = cl.nodesbetween(bases, heads) | |
1081 | # Some bases may turn out to be superfluous, and some heads may be |
|
1077 | # Some bases may turn out to be superfluous, and some heads may be | |
1082 | # too. nodesbetween will return the minimal set of bases and heads |
|
1078 | # too. nodesbetween will return the minimal set of bases and heads | |
1083 | # necessary to re-create the changegroup. |
|
1079 | # necessary to re-create the changegroup. | |
1084 |
|
1080 | |||
1085 | # Known heads are the list of heads that it is assumed the recipient |
|
1081 | # Known heads are the list of heads that it is assumed the recipient | |
1086 | # of this changegroup will know about. |
|
1082 | # of this changegroup will know about. | |
1087 | knownheads = {} |
|
1083 | knownheads = {} | |
1088 | # We assume that all parents of bases are known heads. |
|
1084 | # We assume that all parents of bases are known heads. | |
1089 | for n in bases: |
|
1085 | for n in bases: | |
1090 | for p in cl.parents(n): |
|
1086 | for p in cl.parents(n): | |
1091 | if p != nullid: |
|
1087 | if p != nullid: | |
1092 | knownheads[p] = 1 |
|
1088 | knownheads[p] = 1 | |
1093 | knownheads = knownheads.keys() |
|
1089 | knownheads = knownheads.keys() | |
1094 | if knownheads: |
|
1090 | if knownheads: | |
1095 | # Now that we know what heads are known, we can compute which |
|
1091 | # Now that we know what heads are known, we can compute which | |
1096 | # changesets are known. The recipient must know about all |
|
1092 | # changesets are known. The recipient must know about all | |
1097 | # changesets required to reach the known heads from the null |
|
1093 | # changesets required to reach the known heads from the null | |
1098 | # changeset. |
|
1094 | # changeset. | |
1099 | has_cl_set, junk, junk = cl.nodesbetween(None, knownheads) |
|
1095 | has_cl_set, junk, junk = cl.nodesbetween(None, knownheads) | |
1100 | junk = None |
|
1096 | junk = None | |
1101 | # Transform the list into an ersatz set. |
|
1097 | # Transform the list into an ersatz set. | |
1102 | has_cl_set = dict.fromkeys(has_cl_set) |
|
1098 | has_cl_set = dict.fromkeys(has_cl_set) | |
1103 | else: |
|
1099 | else: | |
1104 | # If there were no known heads, the recipient cannot be assumed to |
|
1100 | # If there were no known heads, the recipient cannot be assumed to | |
1105 | # know about any changesets. |
|
1101 | # know about any changesets. | |
1106 | has_cl_set = {} |
|
1102 | has_cl_set = {} | |
1107 |
|
1103 | |||
1108 | # Make it easy to refer to self.manifest |
|
1104 | # Make it easy to refer to self.manifest | |
1109 | mnfst = self.manifest |
|
1105 | mnfst = self.manifest | |
1110 | # We don't know which manifests are missing yet |
|
1106 | # We don't know which manifests are missing yet | |
1111 | msng_mnfst_set = {} |
|
1107 | msng_mnfst_set = {} | |
1112 | # Nor do we know which filenodes are missing. |
|
1108 | # Nor do we know which filenodes are missing. | |
1113 | msng_filenode_set = {} |
|
1109 | msng_filenode_set = {} | |
1114 |
|
1110 | |||
1115 | junk = mnfst.index[mnfst.count() - 1] # Get around a bug in lazyindex |
|
1111 | junk = mnfst.index[mnfst.count() - 1] # Get around a bug in lazyindex | |
1116 | junk = None |
|
1112 | junk = None | |
1117 |
|
1113 | |||
1118 | # A changeset always belongs to itself, so the changenode lookup |
|
1114 | # A changeset always belongs to itself, so the changenode lookup | |
1119 | # function for a changenode is identity. |
|
1115 | # function for a changenode is identity. | |
1120 | def identity(x): |
|
1116 | def identity(x): | |
1121 | return x |
|
1117 | return x | |
1122 |
|
1118 | |||
1123 | # A function generating function. Sets up an environment for the |
|
1119 | # A function generating function. Sets up an environment for the | |
1124 | # inner function. |
|
1120 | # inner function. | |
1125 | def cmp_by_rev_func(revlog): |
|
1121 | def cmp_by_rev_func(revlog): | |
1126 | # Compare two nodes by their revision number in the environment's |
|
1122 | # Compare two nodes by their revision number in the environment's | |
1127 | # revision history. Since the revision number both represents the |
|
1123 | # revision history. Since the revision number both represents the | |
1128 | # most efficient order to read the nodes in, and represents a |
|
1124 | # most efficient order to read the nodes in, and represents a | |
1129 | # topological sorting of the nodes, this function is often useful. |
|
1125 | # topological sorting of the nodes, this function is often useful. | |
1130 | def cmp_by_rev(a, b): |
|
1126 | def cmp_by_rev(a, b): | |
1131 | return cmp(revlog.rev(a), revlog.rev(b)) |
|
1127 | return cmp(revlog.rev(a), revlog.rev(b)) | |
1132 | return cmp_by_rev |
|
1128 | return cmp_by_rev | |
1133 |
|
1129 | |||
1134 | # If we determine that a particular file or manifest node must be a |
|
1130 | # If we determine that a particular file or manifest node must be a | |
1135 | # node that the recipient of the changegroup will already have, we can |
|
1131 | # node that the recipient of the changegroup will already have, we can | |
1136 | # also assume the recipient will have all the parents. This function |
|
1132 | # also assume the recipient will have all the parents. This function | |
1137 | # prunes them from the set of missing nodes. |
|
1133 | # prunes them from the set of missing nodes. | |
1138 | def prune_parents(revlog, hasset, msngset): |
|
1134 | def prune_parents(revlog, hasset, msngset): | |
1139 | haslst = hasset.keys() |
|
1135 | haslst = hasset.keys() | |
1140 | haslst.sort(cmp_by_rev_func(revlog)) |
|
1136 | haslst.sort(cmp_by_rev_func(revlog)) | |
1141 | for node in haslst: |
|
1137 | for node in haslst: | |
1142 | parentlst = [p for p in revlog.parents(node) if p != nullid] |
|
1138 | parentlst = [p for p in revlog.parents(node) if p != nullid] | |
1143 | while parentlst: |
|
1139 | while parentlst: | |
1144 | n = parentlst.pop() |
|
1140 | n = parentlst.pop() | |
1145 | if n not in hasset: |
|
1141 | if n not in hasset: | |
1146 | hasset[n] = 1 |
|
1142 | hasset[n] = 1 | |
1147 | p = [p for p in revlog.parents(n) if p != nullid] |
|
1143 | p = [p for p in revlog.parents(n) if p != nullid] | |
1148 | parentlst.extend(p) |
|
1144 | parentlst.extend(p) | |
1149 | for n in hasset: |
|
1145 | for n in hasset: | |
1150 | msngset.pop(n, None) |
|
1146 | msngset.pop(n, None) | |
1151 |
|
1147 | |||
1152 | # This is a function generating function used to set up an environment |
|
1148 | # This is a function generating function used to set up an environment | |
1153 | # for the inner function to execute in. |
|
1149 | # for the inner function to execute in. | |
1154 | def manifest_and_file_collector(changedfileset): |
|
1150 | def manifest_and_file_collector(changedfileset): | |
1155 | # This is an information gathering function that gathers |
|
1151 | # This is an information gathering function that gathers | |
1156 | # information from each changeset node that goes out as part of |
|
1152 | # information from each changeset node that goes out as part of | |
1157 | # the changegroup. The information gathered is a list of which |
|
1153 | # the changegroup. The information gathered is a list of which | |
1158 | # manifest nodes are potentially required (the recipient may |
|
1154 | # manifest nodes are potentially required (the recipient may | |
1159 | # already have them) and total list of all files which were |
|
1155 | # already have them) and total list of all files which were | |
1160 | # changed in any changeset in the changegroup. |
|
1156 | # changed in any changeset in the changegroup. | |
1161 | # |
|
1157 | # | |
1162 | # We also remember the first changenode we saw any manifest |
|
1158 | # We also remember the first changenode we saw any manifest | |
1163 | # referenced by so we can later determine which changenode 'owns' |
|
1159 | # referenced by so we can later determine which changenode 'owns' | |
1164 | # the manifest. |
|
1160 | # the manifest. | |
1165 | def collect_manifests_and_files(clnode): |
|
1161 | def collect_manifests_and_files(clnode): | |
1166 | c = cl.read(clnode) |
|
1162 | c = cl.read(clnode) | |
1167 | for f in c[3]: |
|
1163 | for f in c[3]: | |
1168 | # This is to make sure we only have one instance of each |
|
1164 | # This is to make sure we only have one instance of each | |
1169 | # filename string for each filename. |
|
1165 | # filename string for each filename. | |
1170 | changedfileset.setdefault(f, f) |
|
1166 | changedfileset.setdefault(f, f) | |
1171 | msng_mnfst_set.setdefault(c[0], clnode) |
|
1167 | msng_mnfst_set.setdefault(c[0], clnode) | |
1172 | return collect_manifests_and_files |
|
1168 | return collect_manifests_and_files | |
1173 |
|
1169 | |||
1174 | # Figure out which manifest nodes (of the ones we think might be part |
|
1170 | # Figure out which manifest nodes (of the ones we think might be part | |
1175 | # of the changegroup) the recipient must know about and remove them |
|
1171 | # of the changegroup) the recipient must know about and remove them | |
1176 | # from the changegroup. |
|
1172 | # from the changegroup. | |
1177 | def prune_manifests(): |
|
1173 | def prune_manifests(): | |
1178 | has_mnfst_set = {} |
|
1174 | has_mnfst_set = {} | |
1179 | for n in msng_mnfst_set: |
|
1175 | for n in msng_mnfst_set: | |
1180 | # If a 'missing' manifest thinks it belongs to a changenode |
|
1176 | # If a 'missing' manifest thinks it belongs to a changenode | |
1181 | # the recipient is assumed to have, obviously the recipient |
|
1177 | # the recipient is assumed to have, obviously the recipient | |
1182 | # must have that manifest. |
|
1178 | # must have that manifest. | |
1183 | linknode = cl.node(mnfst.linkrev(n)) |
|
1179 | linknode = cl.node(mnfst.linkrev(n)) | |
1184 | if linknode in has_cl_set: |
|
1180 | if linknode in has_cl_set: | |
1185 | has_mnfst_set[n] = 1 |
|
1181 | has_mnfst_set[n] = 1 | |
1186 | prune_parents(mnfst, has_mnfst_set, msng_mnfst_set) |
|
1182 | prune_parents(mnfst, has_mnfst_set, msng_mnfst_set) | |
1187 |
|
1183 | |||
1188 | # Use the information collected in collect_manifests_and_files to say |
|
1184 | # Use the information collected in collect_manifests_and_files to say | |
1189 | # which changenode any manifestnode belongs to. |
|
1185 | # which changenode any manifestnode belongs to. | |
1190 | def lookup_manifest_link(mnfstnode): |
|
1186 | def lookup_manifest_link(mnfstnode): | |
1191 | return msng_mnfst_set[mnfstnode] |
|
1187 | return msng_mnfst_set[mnfstnode] | |
1192 |
|
1188 | |||
1193 | # A function generating function that sets up the initial environment |
|
1189 | # A function generating function that sets up the initial environment | |
1194 | # the inner function. |
|
1190 | # the inner function. | |
1195 | def filenode_collector(changedfiles): |
|
1191 | def filenode_collector(changedfiles): | |
1196 | next_rev = [0] |
|
1192 | next_rev = [0] | |
1197 | # This gathers information from each manifestnode included in the |
|
1193 | # This gathers information from each manifestnode included in the | |
1198 | # changegroup about which filenodes the manifest node references |
|
1194 | # changegroup about which filenodes the manifest node references | |
1199 | # so we can include those in the changegroup too. |
|
1195 | # so we can include those in the changegroup too. | |
1200 | # |
|
1196 | # | |
1201 | # It also remembers which changenode each filenode belongs to. It |
|
1197 | # It also remembers which changenode each filenode belongs to. It | |
1202 | # does this by assuming the a filenode belongs to the changenode |
|
1198 | # does this by assuming the a filenode belongs to the changenode | |
1203 | # the first manifest that references it belongs to. |
|
1199 | # the first manifest that references it belongs to. | |
1204 | def collect_msng_filenodes(mnfstnode): |
|
1200 | def collect_msng_filenodes(mnfstnode): | |
1205 | r = mnfst.rev(mnfstnode) |
|
1201 | r = mnfst.rev(mnfstnode) | |
1206 | if r == next_rev[0]: |
|
1202 | if r == next_rev[0]: | |
1207 | # If the last rev we looked at was the one just previous, |
|
1203 | # If the last rev we looked at was the one just previous, | |
1208 | # we only need to see a diff. |
|
1204 | # we only need to see a diff. | |
1209 | delta = mdiff.patchtext(mnfst.delta(mnfstnode)) |
|
1205 | delta = mdiff.patchtext(mnfst.delta(mnfstnode)) | |
1210 | # For each line in the delta |
|
1206 | # For each line in the delta | |
1211 | for dline in delta.splitlines(): |
|
1207 | for dline in delta.splitlines(): | |
1212 | # get the filename and filenode for that line |
|
1208 | # get the filename and filenode for that line | |
1213 | f, fnode = dline.split('\0') |
|
1209 | f, fnode = dline.split('\0') | |
1214 | fnode = bin(fnode[:40]) |
|
1210 | fnode = bin(fnode[:40]) | |
1215 | f = changedfiles.get(f, None) |
|
1211 | f = changedfiles.get(f, None) | |
1216 | # And if the file is in the list of files we care |
|
1212 | # And if the file is in the list of files we care | |
1217 | # about. |
|
1213 | # about. | |
1218 | if f is not None: |
|
1214 | if f is not None: | |
1219 | # Get the changenode this manifest belongs to |
|
1215 | # Get the changenode this manifest belongs to | |
1220 | clnode = msng_mnfst_set[mnfstnode] |
|
1216 | clnode = msng_mnfst_set[mnfstnode] | |
1221 | # Create the set of filenodes for the file if |
|
1217 | # Create the set of filenodes for the file if | |
1222 | # there isn't one already. |
|
1218 | # there isn't one already. | |
1223 | ndset = msng_filenode_set.setdefault(f, {}) |
|
1219 | ndset = msng_filenode_set.setdefault(f, {}) | |
1224 | # And set the filenode's changelog node to the |
|
1220 | # And set the filenode's changelog node to the | |
1225 | # manifest's if it hasn't been set already. |
|
1221 | # manifest's if it hasn't been set already. | |
1226 | ndset.setdefault(fnode, clnode) |
|
1222 | ndset.setdefault(fnode, clnode) | |
1227 | else: |
|
1223 | else: | |
1228 | # Otherwise we need a full manifest. |
|
1224 | # Otherwise we need a full manifest. | |
1229 | m = mnfst.read(mnfstnode) |
|
1225 | m = mnfst.read(mnfstnode) | |
1230 | # For every file in we care about. |
|
1226 | # For every file in we care about. | |
1231 | for f in changedfiles: |
|
1227 | for f in changedfiles: | |
1232 | fnode = m.get(f, None) |
|
1228 | fnode = m.get(f, None) | |
1233 | # If it's in the manifest |
|
1229 | # If it's in the manifest | |
1234 | if fnode is not None: |
|
1230 | if fnode is not None: | |
1235 | # See comments above. |
|
1231 | # See comments above. | |
1236 | clnode = msng_mnfst_set[mnfstnode] |
|
1232 | clnode = msng_mnfst_set[mnfstnode] | |
1237 | ndset = msng_filenode_set.setdefault(f, {}) |
|
1233 | ndset = msng_filenode_set.setdefault(f, {}) | |
1238 | ndset.setdefault(fnode, clnode) |
|
1234 | ndset.setdefault(fnode, clnode) | |
1239 | # Remember the revision we hope to see next. |
|
1235 | # Remember the revision we hope to see next. | |
1240 | next_rev[0] = r + 1 |
|
1236 | next_rev[0] = r + 1 | |
1241 | return collect_msng_filenodes |
|
1237 | return collect_msng_filenodes | |
1242 |
|
1238 | |||
1243 | # We have a list of filenodes we think we need for a file, lets remove |
|
1239 | # We have a list of filenodes we think we need for a file, lets remove | |
1244 | # all those we now the recipient must have. |
|
1240 | # all those we now the recipient must have. | |
1245 | def prune_filenodes(f, filerevlog): |
|
1241 | def prune_filenodes(f, filerevlog): | |
1246 | msngset = msng_filenode_set[f] |
|
1242 | msngset = msng_filenode_set[f] | |
1247 | hasset = {} |
|
1243 | hasset = {} | |
1248 | # If a 'missing' filenode thinks it belongs to a changenode we |
|
1244 | # If a 'missing' filenode thinks it belongs to a changenode we | |
1249 | # assume the recipient must have, then the recipient must have |
|
1245 | # assume the recipient must have, then the recipient must have | |
1250 | # that filenode. |
|
1246 | # that filenode. | |
1251 | for n in msngset: |
|
1247 | for n in msngset: | |
1252 | clnode = cl.node(filerevlog.linkrev(n)) |
|
1248 | clnode = cl.node(filerevlog.linkrev(n)) | |
1253 | if clnode in has_cl_set: |
|
1249 | if clnode in has_cl_set: | |
1254 | hasset[n] = 1 |
|
1250 | hasset[n] = 1 | |
1255 | prune_parents(filerevlog, hasset, msngset) |
|
1251 | prune_parents(filerevlog, hasset, msngset) | |
1256 |
|
1252 | |||
1257 | # A function generator function that sets up the a context for the |
|
1253 | # A function generator function that sets up the a context for the | |
1258 | # inner function. |
|
1254 | # inner function. | |
1259 | def lookup_filenode_link_func(fname): |
|
1255 | def lookup_filenode_link_func(fname): | |
1260 | msngset = msng_filenode_set[fname] |
|
1256 | msngset = msng_filenode_set[fname] | |
1261 | # Lookup the changenode the filenode belongs to. |
|
1257 | # Lookup the changenode the filenode belongs to. | |
1262 | def lookup_filenode_link(fnode): |
|
1258 | def lookup_filenode_link(fnode): | |
1263 | return msngset[fnode] |
|
1259 | return msngset[fnode] | |
1264 | return lookup_filenode_link |
|
1260 | return lookup_filenode_link | |
1265 |
|
1261 | |||
1266 | # Now that we have all theses utility functions to help out and |
|
1262 | # Now that we have all theses utility functions to help out and | |
1267 | # logically divide up the task, generate the group. |
|
1263 | # logically divide up the task, generate the group. | |
1268 | def gengroup(): |
|
1264 | def gengroup(): | |
1269 | # The set of changed files starts empty. |
|
1265 | # The set of changed files starts empty. | |
1270 | changedfiles = {} |
|
1266 | changedfiles = {} | |
1271 | # Create a changenode group generator that will call our functions |
|
1267 | # Create a changenode group generator that will call our functions | |
1272 | # back to lookup the owning changenode and collect information. |
|
1268 | # back to lookup the owning changenode and collect information. | |
1273 | group = cl.group(msng_cl_lst, identity, |
|
1269 | group = cl.group(msng_cl_lst, identity, | |
1274 | manifest_and_file_collector(changedfiles)) |
|
1270 | manifest_and_file_collector(changedfiles)) | |
1275 | for chnk in group: |
|
1271 | for chnk in group: | |
1276 | yield chnk |
|
1272 | yield chnk | |
1277 |
|
1273 | |||
1278 | # The list of manifests has been collected by the generator |
|
1274 | # The list of manifests has been collected by the generator | |
1279 | # calling our functions back. |
|
1275 | # calling our functions back. | |
1280 | prune_manifests() |
|
1276 | prune_manifests() | |
1281 | msng_mnfst_lst = msng_mnfst_set.keys() |
|
1277 | msng_mnfst_lst = msng_mnfst_set.keys() | |
1282 | # Sort the manifestnodes by revision number. |
|
1278 | # Sort the manifestnodes by revision number. | |
1283 | msng_mnfst_lst.sort(cmp_by_rev_func(mnfst)) |
|
1279 | msng_mnfst_lst.sort(cmp_by_rev_func(mnfst)) | |
1284 | # Create a generator for the manifestnodes that calls our lookup |
|
1280 | # Create a generator for the manifestnodes that calls our lookup | |
1285 | # and data collection functions back. |
|
1281 | # and data collection functions back. | |
1286 | group = mnfst.group(msng_mnfst_lst, lookup_manifest_link, |
|
1282 | group = mnfst.group(msng_mnfst_lst, lookup_manifest_link, | |
1287 | filenode_collector(changedfiles)) |
|
1283 | filenode_collector(changedfiles)) | |
1288 | for chnk in group: |
|
1284 | for chnk in group: | |
1289 | yield chnk |
|
1285 | yield chnk | |
1290 |
|
1286 | |||
1291 | # These are no longer needed, dereference and toss the memory for |
|
1287 | # These are no longer needed, dereference and toss the memory for | |
1292 | # them. |
|
1288 | # them. | |
1293 | msng_mnfst_lst = None |
|
1289 | msng_mnfst_lst = None | |
1294 | msng_mnfst_set.clear() |
|
1290 | msng_mnfst_set.clear() | |
1295 |
|
1291 | |||
1296 | changedfiles = changedfiles.keys() |
|
1292 | changedfiles = changedfiles.keys() | |
1297 | changedfiles.sort() |
|
1293 | changedfiles.sort() | |
1298 | # Go through all our files in order sorted by name. |
|
1294 | # Go through all our files in order sorted by name. | |
1299 | for fname in changedfiles: |
|
1295 | for fname in changedfiles: | |
1300 | filerevlog = self.file(fname) |
|
1296 | filerevlog = self.file(fname) | |
1301 | # Toss out the filenodes that the recipient isn't really |
|
1297 | # Toss out the filenodes that the recipient isn't really | |
1302 | # missing. |
|
1298 | # missing. | |
1303 | if msng_filenode_set.has_key(fname): |
|
1299 | if msng_filenode_set.has_key(fname): | |
1304 | prune_filenodes(fname, filerevlog) |
|
1300 | prune_filenodes(fname, filerevlog) | |
1305 | msng_filenode_lst = msng_filenode_set[fname].keys() |
|
1301 | msng_filenode_lst = msng_filenode_set[fname].keys() | |
1306 | else: |
|
1302 | else: | |
1307 | msng_filenode_lst = [] |
|
1303 | msng_filenode_lst = [] | |
1308 | # If any filenodes are left, generate the group for them, |
|
1304 | # If any filenodes are left, generate the group for them, | |
1309 | # otherwise don't bother. |
|
1305 | # otherwise don't bother. | |
1310 | if len(msng_filenode_lst) > 0: |
|
1306 | if len(msng_filenode_lst) > 0: | |
1311 | yield changegroup.genchunk(fname) |
|
1307 | yield changegroup.genchunk(fname) | |
1312 | # Sort the filenodes by their revision # |
|
1308 | # Sort the filenodes by their revision # | |
1313 | msng_filenode_lst.sort(cmp_by_rev_func(filerevlog)) |
|
1309 | msng_filenode_lst.sort(cmp_by_rev_func(filerevlog)) | |
1314 | # Create a group generator and only pass in a changenode |
|
1310 | # Create a group generator and only pass in a changenode | |
1315 | # lookup function as we need to collect no information |
|
1311 | # lookup function as we need to collect no information | |
1316 | # from filenodes. |
|
1312 | # from filenodes. | |
1317 | group = filerevlog.group(msng_filenode_lst, |
|
1313 | group = filerevlog.group(msng_filenode_lst, | |
1318 | lookup_filenode_link_func(fname)) |
|
1314 | lookup_filenode_link_func(fname)) | |
1319 | for chnk in group: |
|
1315 | for chnk in group: | |
1320 | yield chnk |
|
1316 | yield chnk | |
1321 | if msng_filenode_set.has_key(fname): |
|
1317 | if msng_filenode_set.has_key(fname): | |
1322 | # Don't need this anymore, toss it to free memory. |
|
1318 | # Don't need this anymore, toss it to free memory. | |
1323 | del msng_filenode_set[fname] |
|
1319 | del msng_filenode_set[fname] | |
1324 | # Signal that no more groups are left. |
|
1320 | # Signal that no more groups are left. | |
1325 | yield changegroup.closechunk() |
|
1321 | yield changegroup.closechunk() | |
1326 |
|
1322 | |||
1327 | self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source) |
|
1323 | self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source) | |
1328 |
|
1324 | |||
1329 | return util.chunkbuffer(gengroup()) |
|
1325 | return util.chunkbuffer(gengroup()) | |
1330 |
|
1326 | |||
1331 | def changegroup(self, basenodes, source): |
|
1327 | def changegroup(self, basenodes, source): | |
1332 | """Generate a changegroup of all nodes that we have that a recipient |
|
1328 | """Generate a changegroup of all nodes that we have that a recipient | |
1333 | doesn't. |
|
1329 | doesn't. | |
1334 |
|
1330 | |||
1335 | This is much easier than the previous function as we can assume that |
|
1331 | This is much easier than the previous function as we can assume that | |
1336 | the recipient has any changenode we aren't sending them.""" |
|
1332 | the recipient has any changenode we aren't sending them.""" | |
1337 |
|
1333 | |||
1338 | self.hook('preoutgoing', throw=True, source=source) |
|
1334 | self.hook('preoutgoing', throw=True, source=source) | |
1339 |
|
1335 | |||
1340 | cl = self.changelog |
|
1336 | cl = self.changelog | |
1341 | nodes = cl.nodesbetween(basenodes, None)[0] |
|
1337 | nodes = cl.nodesbetween(basenodes, None)[0] | |
1342 | revset = dict.fromkeys([cl.rev(n) for n in nodes]) |
|
1338 | revset = dict.fromkeys([cl.rev(n) for n in nodes]) | |
1343 |
|
1339 | |||
1344 | def identity(x): |
|
1340 | def identity(x): | |
1345 | return x |
|
1341 | return x | |
1346 |
|
1342 | |||
1347 | def gennodelst(revlog): |
|
1343 | def gennodelst(revlog): | |
1348 | for r in xrange(0, revlog.count()): |
|
1344 | for r in xrange(0, revlog.count()): | |
1349 | n = revlog.node(r) |
|
1345 | n = revlog.node(r) | |
1350 | if revlog.linkrev(n) in revset: |
|
1346 | if revlog.linkrev(n) in revset: | |
1351 | yield n |
|
1347 | yield n | |
1352 |
|
1348 | |||
1353 | def changed_file_collector(changedfileset): |
|
1349 | def changed_file_collector(changedfileset): | |
1354 | def collect_changed_files(clnode): |
|
1350 | def collect_changed_files(clnode): | |
1355 | c = cl.read(clnode) |
|
1351 | c = cl.read(clnode) | |
1356 | for fname in c[3]: |
|
1352 | for fname in c[3]: | |
1357 | changedfileset[fname] = 1 |
|
1353 | changedfileset[fname] = 1 | |
1358 | return collect_changed_files |
|
1354 | return collect_changed_files | |
1359 |
|
1355 | |||
1360 | def lookuprevlink_func(revlog): |
|
1356 | def lookuprevlink_func(revlog): | |
1361 | def lookuprevlink(n): |
|
1357 | def lookuprevlink(n): | |
1362 | return cl.node(revlog.linkrev(n)) |
|
1358 | return cl.node(revlog.linkrev(n)) | |
1363 | return lookuprevlink |
|
1359 | return lookuprevlink | |
1364 |
|
1360 | |||
1365 | def gengroup(): |
|
1361 | def gengroup(): | |
1366 | # construct a list of all changed files |
|
1362 | # construct a list of all changed files | |
1367 | changedfiles = {} |
|
1363 | changedfiles = {} | |
1368 |
|
1364 | |||
1369 | for chnk in cl.group(nodes, identity, |
|
1365 | for chnk in cl.group(nodes, identity, | |
1370 | changed_file_collector(changedfiles)): |
|
1366 | changed_file_collector(changedfiles)): | |
1371 | yield chnk |
|
1367 | yield chnk | |
1372 | changedfiles = changedfiles.keys() |
|
1368 | changedfiles = changedfiles.keys() | |
1373 | changedfiles.sort() |
|
1369 | changedfiles.sort() | |
1374 |
|
1370 | |||
1375 | mnfst = self.manifest |
|
1371 | mnfst = self.manifest | |
1376 | nodeiter = gennodelst(mnfst) |
|
1372 | nodeiter = gennodelst(mnfst) | |
1377 | for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)): |
|
1373 | for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)): | |
1378 | yield chnk |
|
1374 | yield chnk | |
1379 |
|
1375 | |||
1380 | for fname in changedfiles: |
|
1376 | for fname in changedfiles: | |
1381 | filerevlog = self.file(fname) |
|
1377 | filerevlog = self.file(fname) | |
1382 | nodeiter = gennodelst(filerevlog) |
|
1378 | nodeiter = gennodelst(filerevlog) | |
1383 | nodeiter = list(nodeiter) |
|
1379 | nodeiter = list(nodeiter) | |
1384 | if nodeiter: |
|
1380 | if nodeiter: | |
1385 | yield changegroup.genchunk(fname) |
|
1381 | yield changegroup.genchunk(fname) | |
1386 | lookup = lookuprevlink_func(filerevlog) |
|
1382 | lookup = lookuprevlink_func(filerevlog) | |
1387 | for chnk in filerevlog.group(nodeiter, lookup): |
|
1383 | for chnk in filerevlog.group(nodeiter, lookup): | |
1388 | yield chnk |
|
1384 | yield chnk | |
1389 |
|
1385 | |||
1390 | yield changegroup.closechunk() |
|
1386 | yield changegroup.closechunk() | |
1391 |
|
1387 | |||
1392 | if nodes: |
|
1388 | if nodes: | |
1393 | self.hook('outgoing', node=hex(nodes[0]), source=source) |
|
1389 | self.hook('outgoing', node=hex(nodes[0]), source=source) | |
1394 |
|
1390 | |||
1395 | return util.chunkbuffer(gengroup()) |
|
1391 | return util.chunkbuffer(gengroup()) | |
1396 |
|
1392 | |||
1397 | def addchangegroup(self, source): |
|
1393 | def addchangegroup(self, source): | |
1398 | """add changegroup to repo. |
|
1394 | """add changegroup to repo. | |
1399 | returns number of heads modified or added + 1.""" |
|
1395 | returns number of heads modified or added + 1.""" | |
1400 |
|
1396 | |||
1401 | def csmap(x): |
|
1397 | def csmap(x): | |
1402 | self.ui.debug(_("add changeset %s\n") % short(x)) |
|
1398 | self.ui.debug(_("add changeset %s\n") % short(x)) | |
1403 | return cl.count() |
|
1399 | return cl.count() | |
1404 |
|
1400 | |||
1405 | def revmap(x): |
|
1401 | def revmap(x): | |
1406 | return cl.rev(x) |
|
1402 | return cl.rev(x) | |
1407 |
|
1403 | |||
1408 | if not source: |
|
1404 | if not source: | |
1409 | return 0 |
|
1405 | return 0 | |
1410 |
|
1406 | |||
1411 | self.hook('prechangegroup', throw=True) |
|
1407 | self.hook('prechangegroup', throw=True) | |
1412 |
|
1408 | |||
1413 | changesets = files = revisions = 0 |
|
1409 | changesets = files = revisions = 0 | |
1414 |
|
1410 | |||
1415 | tr = self.transaction() |
|
1411 | tr = self.transaction() | |
1416 |
|
1412 | |||
1417 | # write changelog and manifest data to temp files so |
|
1413 | # write changelog and manifest data to temp files so | |
1418 | # concurrent readers will not see inconsistent view |
|
1414 | # concurrent readers will not see inconsistent view | |
1419 | cl = appendfile.appendchangelog(self.opener, self.changelog.version) |
|
1415 | cl = appendfile.appendchangelog(self.opener, self.changelog.version) | |
1420 |
|
1416 | |||
1421 | oldheads = len(cl.heads()) |
|
1417 | oldheads = len(cl.heads()) | |
1422 |
|
1418 | |||
1423 | # pull off the changeset group |
|
1419 | # pull off the changeset group | |
1424 | self.ui.status(_("adding changesets\n")) |
|
1420 | self.ui.status(_("adding changesets\n")) | |
1425 | co = cl.tip() |
|
1421 | co = cl.tip() | |
1426 | chunkiter = changegroup.chunkiter(source) |
|
1422 | chunkiter = changegroup.chunkiter(source) | |
1427 | cn = cl.addgroup(chunkiter, csmap, tr, 1) # unique |
|
1423 | cn = cl.addgroup(chunkiter, csmap, tr, 1) # unique | |
1428 | cnr, cor = map(cl.rev, (cn, co)) |
|
1424 | cnr, cor = map(cl.rev, (cn, co)) | |
1429 | if cn == nullid: |
|
1425 | if cn == nullid: | |
1430 | cnr = cor |
|
1426 | cnr = cor | |
1431 | changesets = cnr - cor |
|
1427 | changesets = cnr - cor | |
1432 |
|
1428 | |||
1433 | mf = appendfile.appendmanifest(self.opener, self.manifest.version) |
|
1429 | mf = appendfile.appendmanifest(self.opener, self.manifest.version) | |
1434 |
|
1430 | |||
1435 | # pull off the manifest group |
|
1431 | # pull off the manifest group | |
1436 | self.ui.status(_("adding manifests\n")) |
|
1432 | self.ui.status(_("adding manifests\n")) | |
1437 | mm = mf.tip() |
|
1433 | mm = mf.tip() | |
1438 | chunkiter = changegroup.chunkiter(source) |
|
1434 | chunkiter = changegroup.chunkiter(source) | |
1439 | mo = mf.addgroup(chunkiter, revmap, tr) |
|
1435 | mo = mf.addgroup(chunkiter, revmap, tr) | |
1440 |
|
1436 | |||
1441 | # process the files |
|
1437 | # process the files | |
1442 | self.ui.status(_("adding file changes\n")) |
|
1438 | self.ui.status(_("adding file changes\n")) | |
1443 | while 1: |
|
1439 | while 1: | |
1444 | f = changegroup.getchunk(source) |
|
1440 | f = changegroup.getchunk(source) | |
1445 | if not f: |
|
1441 | if not f: | |
1446 | break |
|
1442 | break | |
1447 | self.ui.debug(_("adding %s revisions\n") % f) |
|
1443 | self.ui.debug(_("adding %s revisions\n") % f) | |
1448 | fl = self.file(f) |
|
1444 | fl = self.file(f) | |
1449 | o = fl.count() |
|
1445 | o = fl.count() | |
1450 | chunkiter = changegroup.chunkiter(source) |
|
1446 | chunkiter = changegroup.chunkiter(source) | |
1451 | n = fl.addgroup(chunkiter, revmap, tr) |
|
1447 | n = fl.addgroup(chunkiter, revmap, tr) | |
1452 | revisions += fl.count() - o |
|
1448 | revisions += fl.count() - o | |
1453 | files += 1 |
|
1449 | files += 1 | |
1454 |
|
1450 | |||
1455 | # write order here is important so concurrent readers will see |
|
1451 | # write order here is important so concurrent readers will see | |
1456 | # consistent view of repo |
|
1452 | # consistent view of repo | |
1457 | mf.writedata() |
|
1453 | mf.writedata() | |
1458 | cl.writedata() |
|
1454 | cl.writedata() | |
1459 |
|
1455 | |||
1460 | # make changelog and manifest see real files again |
|
1456 | # make changelog and manifest see real files again | |
1461 | self.changelog = changelog.changelog(self.opener, self.changelog.version) |
|
1457 | self.changelog = changelog.changelog(self.opener, self.changelog.version) | |
1462 | self.manifest = manifest.manifest(self.opener, self.manifest.version) |
|
1458 | self.manifest = manifest.manifest(self.opener, self.manifest.version) | |
1463 | self.changelog.checkinlinesize(tr) |
|
1459 | self.changelog.checkinlinesize(tr) | |
1464 | self.manifest.checkinlinesize(tr) |
|
1460 | self.manifest.checkinlinesize(tr) | |
1465 |
|
1461 | |||
1466 | newheads = len(self.changelog.heads()) |
|
1462 | newheads = len(self.changelog.heads()) | |
1467 | heads = "" |
|
1463 | heads = "" | |
1468 | if oldheads and newheads > oldheads: |
|
1464 | if oldheads and newheads > oldheads: | |
1469 | heads = _(" (+%d heads)") % (newheads - oldheads) |
|
1465 | heads = _(" (+%d heads)") % (newheads - oldheads) | |
1470 |
|
1466 | |||
1471 | self.ui.status(_("added %d changesets" |
|
1467 | self.ui.status(_("added %d changesets" | |
1472 | " with %d changes to %d files%s\n") |
|
1468 | " with %d changes to %d files%s\n") | |
1473 | % (changesets, revisions, files, heads)) |
|
1469 | % (changesets, revisions, files, heads)) | |
1474 |
|
1470 | |||
1475 | self.hook('pretxnchangegroup', throw=True, |
|
1471 | self.hook('pretxnchangegroup', throw=True, | |
1476 | node=hex(self.changelog.node(cor+1))) |
|
1472 | node=hex(self.changelog.node(cor+1))) | |
1477 |
|
1473 | |||
1478 | tr.close() |
|
1474 | tr.close() | |
1479 |
|
1475 | |||
1480 | if changesets > 0: |
|
1476 | if changesets > 0: | |
1481 | self.hook("changegroup", node=hex(self.changelog.node(cor+1))) |
|
1477 | self.hook("changegroup", node=hex(self.changelog.node(cor+1))) | |
1482 |
|
1478 | |||
1483 | for i in range(cor + 1, cnr + 1): |
|
1479 | for i in range(cor + 1, cnr + 1): | |
1484 | self.hook("incoming", node=hex(self.changelog.node(i))) |
|
1480 | self.hook("incoming", node=hex(self.changelog.node(i))) | |
1485 |
|
1481 | |||
1486 | return newheads - oldheads + 1 |
|
1482 | return newheads - oldheads + 1 | |
1487 |
|
1483 | |||
1488 | def update(self, node, allow=False, force=False, choose=None, |
|
1484 | def update(self, node, allow=False, force=False, choose=None, | |
1489 | moddirstate=True, forcemerge=False, wlock=None): |
|
1485 | moddirstate=True, forcemerge=False, wlock=None): | |
1490 | pl = self.dirstate.parents() |
|
1486 | pl = self.dirstate.parents() | |
1491 | if not force and pl[1] != nullid: |
|
1487 | if not force and pl[1] != nullid: | |
1492 | self.ui.warn(_("aborting: outstanding uncommitted merges\n")) |
|
1488 | self.ui.warn(_("aborting: outstanding uncommitted merges\n")) | |
1493 | return 1 |
|
1489 | return 1 | |
1494 |
|
1490 | |||
1495 | err = False |
|
1491 | err = False | |
1496 |
|
1492 | |||
1497 | p1, p2 = pl[0], node |
|
1493 | p1, p2 = pl[0], node | |
1498 | pa = self.changelog.ancestor(p1, p2) |
|
1494 | pa = self.changelog.ancestor(p1, p2) | |
1499 | m1n = self.changelog.read(p1)[0] |
|
1495 | m1n = self.changelog.read(p1)[0] | |
1500 | m2n = self.changelog.read(p2)[0] |
|
1496 | m2n = self.changelog.read(p2)[0] | |
1501 | man = self.manifest.ancestor(m1n, m2n) |
|
1497 | man = self.manifest.ancestor(m1n, m2n) | |
1502 | m1 = self.manifest.read(m1n) |
|
1498 | m1 = self.manifest.read(m1n) | |
1503 | mf1 = self.manifest.readflags(m1n) |
|
1499 | mf1 = self.manifest.readflags(m1n) | |
1504 | m2 = self.manifest.read(m2n).copy() |
|
1500 | m2 = self.manifest.read(m2n).copy() | |
1505 | mf2 = self.manifest.readflags(m2n) |
|
1501 | mf2 = self.manifest.readflags(m2n) | |
1506 | ma = self.manifest.read(man) |
|
1502 | ma = self.manifest.read(man) | |
1507 | mfa = self.manifest.readflags(man) |
|
1503 | mfa = self.manifest.readflags(man) | |
1508 |
|
1504 | |||
1509 | modified, added, removed, deleted, unknown = self.changes() |
|
1505 | modified, added, removed, deleted, unknown = self.changes() | |
1510 |
|
1506 | |||
1511 | # is this a jump, or a merge? i.e. is there a linear path |
|
1507 | # is this a jump, or a merge? i.e. is there a linear path | |
1512 | # from p1 to p2? |
|
1508 | # from p1 to p2? | |
1513 | linear_path = (pa == p1 or pa == p2) |
|
1509 | linear_path = (pa == p1 or pa == p2) | |
1514 |
|
1510 | |||
1515 | if allow and linear_path: |
|
1511 | if allow and linear_path: | |
1516 | raise util.Abort(_("there is nothing to merge, " |
|
1512 | raise util.Abort(_("there is nothing to merge, " | |
1517 | "just use 'hg update'")) |
|
1513 | "just use 'hg update'")) | |
1518 | if allow and not forcemerge: |
|
1514 | if allow and not forcemerge: | |
1519 | if modified or added or removed: |
|
1515 | if modified or added or removed: | |
1520 | raise util.Abort(_("outstanding uncommitted changes")) |
|
1516 | raise util.Abort(_("outstanding uncommitted changes")) | |
1521 | if not forcemerge and not force: |
|
1517 | if not forcemerge and not force: | |
1522 | for f in unknown: |
|
1518 | for f in unknown: | |
1523 | if f in m2: |
|
1519 | if f in m2: | |
1524 | t1 = self.wread(f) |
|
1520 | t1 = self.wread(f) | |
1525 | t2 = self.file(f).read(m2[f]) |
|
1521 | t2 = self.file(f).read(m2[f]) | |
1526 | if cmp(t1, t2) != 0: |
|
1522 | if cmp(t1, t2) != 0: | |
1527 | raise util.Abort(_("'%s' already exists in the working" |
|
1523 | raise util.Abort(_("'%s' already exists in the working" | |
1528 | " dir and differs from remote") % f) |
|
1524 | " dir and differs from remote") % f) | |
1529 |
|
1525 | |||
1530 | # resolve the manifest to determine which files |
|
1526 | # resolve the manifest to determine which files | |
1531 | # we care about merging |
|
1527 | # we care about merging | |
1532 | self.ui.note(_("resolving manifests\n")) |
|
1528 | self.ui.note(_("resolving manifests\n")) | |
1533 | self.ui.debug(_(" force %s allow %s moddirstate %s linear %s\n") % |
|
1529 | self.ui.debug(_(" force %s allow %s moddirstate %s linear %s\n") % | |
1534 | (force, allow, moddirstate, linear_path)) |
|
1530 | (force, allow, moddirstate, linear_path)) | |
1535 | self.ui.debug(_(" ancestor %s local %s remote %s\n") % |
|
1531 | self.ui.debug(_(" ancestor %s local %s remote %s\n") % | |
1536 | (short(man), short(m1n), short(m2n))) |
|
1532 | (short(man), short(m1n), short(m2n))) | |
1537 |
|
1533 | |||
1538 | merge = {} |
|
1534 | merge = {} | |
1539 | get = {} |
|
1535 | get = {} | |
1540 | remove = [] |
|
1536 | remove = [] | |
1541 |
|
1537 | |||
1542 | # construct a working dir manifest |
|
1538 | # construct a working dir manifest | |
1543 | mw = m1.copy() |
|
1539 | mw = m1.copy() | |
1544 | mfw = mf1.copy() |
|
1540 | mfw = mf1.copy() | |
1545 | umap = dict.fromkeys(unknown) |
|
1541 | umap = dict.fromkeys(unknown) | |
1546 |
|
1542 | |||
1547 | for f in added + modified + unknown: |
|
1543 | for f in added + modified + unknown: | |
1548 | mw[f] = "" |
|
1544 | mw[f] = "" | |
1549 | mfw[f] = util.is_exec(self.wjoin(f), mfw.get(f, False)) |
|
1545 | mfw[f] = util.is_exec(self.wjoin(f), mfw.get(f, False)) | |
1550 |
|
1546 | |||
1551 | if moddirstate and not wlock: |
|
1547 | if moddirstate and not wlock: | |
1552 | wlock = self.wlock() |
|
1548 | wlock = self.wlock() | |
1553 |
|
1549 | |||
1554 | for f in deleted + removed: |
|
1550 | for f in deleted + removed: | |
1555 | if f in mw: |
|
1551 | if f in mw: | |
1556 | del mw[f] |
|
1552 | del mw[f] | |
1557 |
|
1553 | |||
1558 | # If we're jumping between revisions (as opposed to merging), |
|
1554 | # If we're jumping between revisions (as opposed to merging), | |
1559 | # and if neither the working directory nor the target rev has |
|
1555 | # and if neither the working directory nor the target rev has | |
1560 | # the file, then we need to remove it from the dirstate, to |
|
1556 | # the file, then we need to remove it from the dirstate, to | |
1561 | # prevent the dirstate from listing the file when it is no |
|
1557 | # prevent the dirstate from listing the file when it is no | |
1562 | # longer in the manifest. |
|
1558 | # longer in the manifest. | |
1563 | if moddirstate and linear_path and f not in m2: |
|
1559 | if moddirstate and linear_path and f not in m2: | |
1564 | self.dirstate.forget((f,)) |
|
1560 | self.dirstate.forget((f,)) | |
1565 |
|
1561 | |||
1566 | # Compare manifests |
|
1562 | # Compare manifests | |
1567 | for f, n in mw.iteritems(): |
|
1563 | for f, n in mw.iteritems(): | |
1568 | if choose and not choose(f): |
|
1564 | if choose and not choose(f): | |
1569 | continue |
|
1565 | continue | |
1570 | if f in m2: |
|
1566 | if f in m2: | |
1571 | s = 0 |
|
1567 | s = 0 | |
1572 |
|
1568 | |||
1573 | # is the wfile new since m1, and match m2? |
|
1569 | # is the wfile new since m1, and match m2? | |
1574 | if f not in m1: |
|
1570 | if f not in m1: | |
1575 | t1 = self.wread(f) |
|
1571 | t1 = self.wread(f) | |
1576 | t2 = self.file(f).read(m2[f]) |
|
1572 | t2 = self.file(f).read(m2[f]) | |
1577 | if cmp(t1, t2) == 0: |
|
1573 | if cmp(t1, t2) == 0: | |
1578 | n = m2[f] |
|
1574 | n = m2[f] | |
1579 | del t1, t2 |
|
1575 | del t1, t2 | |
1580 |
|
1576 | |||
1581 | # are files different? |
|
1577 | # are files different? | |
1582 | if n != m2[f]: |
|
1578 | if n != m2[f]: | |
1583 | a = ma.get(f, nullid) |
|
1579 | a = ma.get(f, nullid) | |
1584 | # are both different from the ancestor? |
|
1580 | # are both different from the ancestor? | |
1585 | if n != a and m2[f] != a: |
|
1581 | if n != a and m2[f] != a: | |
1586 | self.ui.debug(_(" %s versions differ, resolve\n") % f) |
|
1582 | self.ui.debug(_(" %s versions differ, resolve\n") % f) | |
1587 | # merge executable bits |
|
1583 | # merge executable bits | |
1588 | # "if we changed or they changed, change in merge" |
|
1584 | # "if we changed or they changed, change in merge" | |
1589 | a, b, c = mfa.get(f, 0), mfw[f], mf2[f] |
|
1585 | a, b, c = mfa.get(f, 0), mfw[f], mf2[f] | |
1590 | mode = ((a^b) | (a^c)) ^ a |
|
1586 | mode = ((a^b) | (a^c)) ^ a | |
1591 | merge[f] = (m1.get(f, nullid), m2[f], mode) |
|
1587 | merge[f] = (m1.get(f, nullid), m2[f], mode) | |
1592 | s = 1 |
|
1588 | s = 1 | |
1593 | # are we clobbering? |
|
1589 | # are we clobbering? | |
1594 | # is remote's version newer? |
|
1590 | # is remote's version newer? | |
1595 | # or are we going back in time? |
|
1591 | # or are we going back in time? | |
1596 | elif force or m2[f] != a or (p2 == pa and mw[f] == m1[f]): |
|
1592 | elif force or m2[f] != a or (p2 == pa and mw[f] == m1[f]): | |
1597 | self.ui.debug(_(" remote %s is newer, get\n") % f) |
|
1593 | self.ui.debug(_(" remote %s is newer, get\n") % f) | |
1598 | get[f] = m2[f] |
|
1594 | get[f] = m2[f] | |
1599 | s = 1 |
|
1595 | s = 1 | |
1600 | elif f in umap or f in added: |
|
1596 | elif f in umap or f in added: | |
1601 | # this unknown file is the same as the checkout |
|
1597 | # this unknown file is the same as the checkout | |
1602 | # we need to reset the dirstate if the file was added |
|
1598 | # we need to reset the dirstate if the file was added | |
1603 | get[f] = m2[f] |
|
1599 | get[f] = m2[f] | |
1604 |
|
1600 | |||
1605 | if not s and mfw[f] != mf2[f]: |
|
1601 | if not s and mfw[f] != mf2[f]: | |
1606 | if force: |
|
1602 | if force: | |
1607 | self.ui.debug(_(" updating permissions for %s\n") % f) |
|
1603 | self.ui.debug(_(" updating permissions for %s\n") % f) | |
1608 | util.set_exec(self.wjoin(f), mf2[f]) |
|
1604 | util.set_exec(self.wjoin(f), mf2[f]) | |
1609 | else: |
|
1605 | else: | |
1610 | a, b, c = mfa.get(f, 0), mfw[f], mf2[f] |
|
1606 | a, b, c = mfa.get(f, 0), mfw[f], mf2[f] | |
1611 | mode = ((a^b) | (a^c)) ^ a |
|
1607 | mode = ((a^b) | (a^c)) ^ a | |
1612 | if mode != b: |
|
1608 | if mode != b: | |
1613 | self.ui.debug(_(" updating permissions for %s\n") |
|
1609 | self.ui.debug(_(" updating permissions for %s\n") | |
1614 | % f) |
|
1610 | % f) | |
1615 | util.set_exec(self.wjoin(f), mode) |
|
1611 | util.set_exec(self.wjoin(f), mode) | |
1616 | del m2[f] |
|
1612 | del m2[f] | |
1617 | elif f in ma: |
|
1613 | elif f in ma: | |
1618 | if n != ma[f]: |
|
1614 | if n != ma[f]: | |
1619 | r = _("d") |
|
1615 | r = _("d") | |
1620 | if not force and (linear_path or allow): |
|
1616 | if not force and (linear_path or allow): | |
1621 | r = self.ui.prompt( |
|
1617 | r = self.ui.prompt( | |
1622 | (_(" local changed %s which remote deleted\n") % f) + |
|
1618 | (_(" local changed %s which remote deleted\n") % f) + | |
1623 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) |
|
1619 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) | |
1624 | if r == _("d"): |
|
1620 | if r == _("d"): | |
1625 | remove.append(f) |
|
1621 | remove.append(f) | |
1626 | else: |
|
1622 | else: | |
1627 | self.ui.debug(_("other deleted %s\n") % f) |
|
1623 | self.ui.debug(_("other deleted %s\n") % f) | |
1628 | remove.append(f) # other deleted it |
|
1624 | remove.append(f) # other deleted it | |
1629 | else: |
|
1625 | else: | |
1630 | # file is created on branch or in working directory |
|
1626 | # file is created on branch or in working directory | |
1631 | if force and f not in umap: |
|
1627 | if force and f not in umap: | |
1632 | self.ui.debug(_("remote deleted %s, clobbering\n") % f) |
|
1628 | self.ui.debug(_("remote deleted %s, clobbering\n") % f) | |
1633 | remove.append(f) |
|
1629 | remove.append(f) | |
1634 | elif n == m1.get(f, nullid): # same as parent |
|
1630 | elif n == m1.get(f, nullid): # same as parent | |
1635 | if p2 == pa: # going backwards? |
|
1631 | if p2 == pa: # going backwards? | |
1636 | self.ui.debug(_("remote deleted %s\n") % f) |
|
1632 | self.ui.debug(_("remote deleted %s\n") % f) | |
1637 | remove.append(f) |
|
1633 | remove.append(f) | |
1638 | else: |
|
1634 | else: | |
1639 | self.ui.debug(_("local modified %s, keeping\n") % f) |
|
1635 | self.ui.debug(_("local modified %s, keeping\n") % f) | |
1640 | else: |
|
1636 | else: | |
1641 | self.ui.debug(_("working dir created %s, keeping\n") % f) |
|
1637 | self.ui.debug(_("working dir created %s, keeping\n") % f) | |
1642 |
|
1638 | |||
1643 | for f, n in m2.iteritems(): |
|
1639 | for f, n in m2.iteritems(): | |
1644 | if choose and not choose(f): |
|
1640 | if choose and not choose(f): | |
1645 | continue |
|
1641 | continue | |
1646 | if f[0] == "/": |
|
1642 | if f[0] == "/": | |
1647 | continue |
|
1643 | continue | |
1648 | if f in ma and n != ma[f]: |
|
1644 | if f in ma and n != ma[f]: | |
1649 | r = _("k") |
|
1645 | r = _("k") | |
1650 | if not force and (linear_path or allow): |
|
1646 | if not force and (linear_path or allow): | |
1651 | r = self.ui.prompt( |
|
1647 | r = self.ui.prompt( | |
1652 | (_("remote changed %s which local deleted\n") % f) + |
|
1648 | (_("remote changed %s which local deleted\n") % f) + | |
1653 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) |
|
1649 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) | |
1654 | if r == _("k"): |
|
1650 | if r == _("k"): | |
1655 | get[f] = n |
|
1651 | get[f] = n | |
1656 | elif f not in ma: |
|
1652 | elif f not in ma: | |
1657 | self.ui.debug(_("remote created %s\n") % f) |
|
1653 | self.ui.debug(_("remote created %s\n") % f) | |
1658 | get[f] = n |
|
1654 | get[f] = n | |
1659 | else: |
|
1655 | else: | |
1660 | if force or p2 == pa: # going backwards? |
|
1656 | if force or p2 == pa: # going backwards? | |
1661 | self.ui.debug(_("local deleted %s, recreating\n") % f) |
|
1657 | self.ui.debug(_("local deleted %s, recreating\n") % f) | |
1662 | get[f] = n |
|
1658 | get[f] = n | |
1663 | else: |
|
1659 | else: | |
1664 | self.ui.debug(_("local deleted %s\n") % f) |
|
1660 | self.ui.debug(_("local deleted %s\n") % f) | |
1665 |
|
1661 | |||
1666 | del mw, m1, m2, ma |
|
1662 | del mw, m1, m2, ma | |
1667 |
|
1663 | |||
1668 | if force: |
|
1664 | if force: | |
1669 | for f in merge: |
|
1665 | for f in merge: | |
1670 | get[f] = merge[f][1] |
|
1666 | get[f] = merge[f][1] | |
1671 | merge = {} |
|
1667 | merge = {} | |
1672 |
|
1668 | |||
1673 | if linear_path or force: |
|
1669 | if linear_path or force: | |
1674 | # we don't need to do any magic, just jump to the new rev |
|
1670 | # we don't need to do any magic, just jump to the new rev | |
1675 | branch_merge = False |
|
1671 | branch_merge = False | |
1676 | p1, p2 = p2, nullid |
|
1672 | p1, p2 = p2, nullid | |
1677 | else: |
|
1673 | else: | |
1678 | if not allow: |
|
1674 | if not allow: | |
1679 | self.ui.status(_("this update spans a branch" |
|
1675 | self.ui.status(_("this update spans a branch" | |
1680 | " affecting the following files:\n")) |
|
1676 | " affecting the following files:\n")) | |
1681 | fl = merge.keys() + get.keys() |
|
1677 | fl = merge.keys() + get.keys() | |
1682 | fl.sort() |
|
1678 | fl.sort() | |
1683 | for f in fl: |
|
1679 | for f in fl: | |
1684 | cf = "" |
|
1680 | cf = "" | |
1685 | if f in merge: |
|
1681 | if f in merge: | |
1686 | cf = _(" (resolve)") |
|
1682 | cf = _(" (resolve)") | |
1687 | self.ui.status(" %s%s\n" % (f, cf)) |
|
1683 | self.ui.status(" %s%s\n" % (f, cf)) | |
1688 | self.ui.warn(_("aborting update spanning branches!\n")) |
|
1684 | self.ui.warn(_("aborting update spanning branches!\n")) | |
1689 | self.ui.status(_("(use 'hg merge' to merge across branches" |
|
1685 | self.ui.status(_("(use 'hg merge' to merge across branches" | |
1690 | " or 'hg update -C' to lose changes)\n")) |
|
1686 | " or 'hg update -C' to lose changes)\n")) | |
1691 | return 1 |
|
1687 | return 1 | |
1692 | branch_merge = True |
|
1688 | branch_merge = True | |
1693 |
|
1689 | |||
1694 | # get the files we don't need to change |
|
1690 | # get the files we don't need to change | |
1695 | files = get.keys() |
|
1691 | files = get.keys() | |
1696 | files.sort() |
|
1692 | files.sort() | |
1697 | for f in files: |
|
1693 | for f in files: | |
1698 | if f[0] == "/": |
|
1694 | if f[0] == "/": | |
1699 | continue |
|
1695 | continue | |
1700 | self.ui.note(_("getting %s\n") % f) |
|
1696 | self.ui.note(_("getting %s\n") % f) | |
1701 | t = self.file(f).read(get[f]) |
|
1697 | t = self.file(f).read(get[f]) | |
1702 | self.wwrite(f, t) |
|
1698 | self.wwrite(f, t) | |
1703 | util.set_exec(self.wjoin(f), mf2[f]) |
|
1699 | util.set_exec(self.wjoin(f), mf2[f]) | |
1704 | if moddirstate: |
|
1700 | if moddirstate: | |
1705 | if branch_merge: |
|
1701 | if branch_merge: | |
1706 | self.dirstate.update([f], 'n', st_mtime=-1) |
|
1702 | self.dirstate.update([f], 'n', st_mtime=-1) | |
1707 | else: |
|
1703 | else: | |
1708 | self.dirstate.update([f], 'n') |
|
1704 | self.dirstate.update([f], 'n') | |
1709 |
|
1705 | |||
1710 | # merge the tricky bits |
|
1706 | # merge the tricky bits | |
1711 | failedmerge = [] |
|
1707 | failedmerge = [] | |
1712 | files = merge.keys() |
|
1708 | files = merge.keys() | |
1713 | files.sort() |
|
1709 | files.sort() | |
1714 | xp1 = hex(p1) |
|
1710 | xp1 = hex(p1) | |
1715 | xp2 = hex(p2) |
|
1711 | xp2 = hex(p2) | |
1716 | for f in files: |
|
1712 | for f in files: | |
1717 | self.ui.status(_("merging %s\n") % f) |
|
1713 | self.ui.status(_("merging %s\n") % f) | |
1718 | my, other, flag = merge[f] |
|
1714 | my, other, flag = merge[f] | |
1719 | ret = self.merge3(f, my, other, xp1, xp2) |
|
1715 | ret = self.merge3(f, my, other, xp1, xp2) | |
1720 | if ret: |
|
1716 | if ret: | |
1721 | err = True |
|
1717 | err = True | |
1722 | failedmerge.append(f) |
|
1718 | failedmerge.append(f) | |
1723 | util.set_exec(self.wjoin(f), flag) |
|
1719 | util.set_exec(self.wjoin(f), flag) | |
1724 | if moddirstate: |
|
1720 | if moddirstate: | |
1725 | if branch_merge: |
|
1721 | if branch_merge: | |
1726 | # We've done a branch merge, mark this file as merged |
|
1722 | # We've done a branch merge, mark this file as merged | |
1727 | # so that we properly record the merger later |
|
1723 | # so that we properly record the merger later | |
1728 | self.dirstate.update([f], 'm') |
|
1724 | self.dirstate.update([f], 'm') | |
1729 | else: |
|
1725 | else: | |
1730 | # We've update-merged a locally modified file, so |
|
1726 | # We've update-merged a locally modified file, so | |
1731 | # we set the dirstate to emulate a normal checkout |
|
1727 | # we set the dirstate to emulate a normal checkout | |
1732 | # of that file some time in the past. Thus our |
|
1728 | # of that file some time in the past. Thus our | |
1733 | # merge will appear as a normal local file |
|
1729 | # merge will appear as a normal local file | |
1734 | # modification. |
|
1730 | # modification. | |
1735 | f_len = len(self.file(f).read(other)) |
|
1731 | f_len = len(self.file(f).read(other)) | |
1736 | self.dirstate.update([f], 'n', st_size=f_len, st_mtime=-1) |
|
1732 | self.dirstate.update([f], 'n', st_size=f_len, st_mtime=-1) | |
1737 |
|
1733 | |||
1738 | remove.sort() |
|
1734 | remove.sort() | |
1739 | for f in remove: |
|
1735 | for f in remove: | |
1740 | self.ui.note(_("removing %s\n") % f) |
|
1736 | self.ui.note(_("removing %s\n") % f) | |
1741 | util.audit_path(f) |
|
1737 | util.audit_path(f) | |
1742 | try: |
|
1738 | try: | |
1743 | util.unlink(self.wjoin(f)) |
|
1739 | util.unlink(self.wjoin(f)) | |
1744 | except OSError, inst: |
|
1740 | except OSError, inst: | |
1745 | if inst.errno != errno.ENOENT: |
|
1741 | if inst.errno != errno.ENOENT: | |
1746 | self.ui.warn(_("update failed to remove %s: %s!\n") % |
|
1742 | self.ui.warn(_("update failed to remove %s: %s!\n") % | |
1747 | (f, inst.strerror)) |
|
1743 | (f, inst.strerror)) | |
1748 | if moddirstate: |
|
1744 | if moddirstate: | |
1749 | if branch_merge: |
|
1745 | if branch_merge: | |
1750 | self.dirstate.update(remove, 'r') |
|
1746 | self.dirstate.update(remove, 'r') | |
1751 | else: |
|
1747 | else: | |
1752 | self.dirstate.forget(remove) |
|
1748 | self.dirstate.forget(remove) | |
1753 |
|
1749 | |||
1754 | if moddirstate: |
|
1750 | if moddirstate: | |
1755 | self.dirstate.setparents(p1, p2) |
|
1751 | self.dirstate.setparents(p1, p2) | |
1756 |
|
1752 | |||
1757 | stat = ((len(get), _("updated")), |
|
1753 | stat = ((len(get), _("updated")), | |
1758 | (len(merge) - len(failedmerge), _("merged")), |
|
1754 | (len(merge) - len(failedmerge), _("merged")), | |
1759 | (len(remove), _("removed")), |
|
1755 | (len(remove), _("removed")), | |
1760 | (len(failedmerge), _("unresolved"))) |
|
1756 | (len(failedmerge), _("unresolved"))) | |
1761 | note = ", ".join([_("%d files %s") % s for s in stat]) |
|
1757 | note = ", ".join([_("%d files %s") % s for s in stat]) | |
1762 | self.ui.note("%s\n" % note) |
|
1758 | self.ui.note("%s\n" % note) | |
1763 | if moddirstate and branch_merge: |
|
1759 | if moddirstate and branch_merge: | |
1764 | self.ui.note(_("(branch merge, don't forget to commit)\n")) |
|
1760 | self.ui.note(_("(branch merge, don't forget to commit)\n")) | |
1765 |
|
1761 | |||
1766 | return err |
|
1762 | return err | |
1767 |
|
1763 | |||
1768 | def merge3(self, fn, my, other, p1, p2): |
|
1764 | def merge3(self, fn, my, other, p1, p2): | |
1769 | """perform a 3-way merge in the working directory""" |
|
1765 | """perform a 3-way merge in the working directory""" | |
1770 |
|
1766 | |||
1771 | def temp(prefix, node): |
|
1767 | def temp(prefix, node): | |
1772 | pre = "%s~%s." % (os.path.basename(fn), prefix) |
|
1768 | pre = "%s~%s." % (os.path.basename(fn), prefix) | |
1773 | (fd, name) = tempfile.mkstemp("", pre) |
|
1769 | (fd, name) = tempfile.mkstemp("", pre) | |
1774 | f = os.fdopen(fd, "wb") |
|
1770 | f = os.fdopen(fd, "wb") | |
1775 | self.wwrite(fn, fl.read(node), f) |
|
1771 | self.wwrite(fn, fl.read(node), f) | |
1776 | f.close() |
|
1772 | f.close() | |
1777 | return name |
|
1773 | return name | |
1778 |
|
1774 | |||
1779 | fl = self.file(fn) |
|
1775 | fl = self.file(fn) | |
1780 | base = fl.ancestor(my, other) |
|
1776 | base = fl.ancestor(my, other) | |
1781 | a = self.wjoin(fn) |
|
1777 | a = self.wjoin(fn) | |
1782 | b = temp("base", base) |
|
1778 | b = temp("base", base) | |
1783 | c = temp("other", other) |
|
1779 | c = temp("other", other) | |
1784 |
|
1780 | |||
1785 | self.ui.note(_("resolving %s\n") % fn) |
|
1781 | self.ui.note(_("resolving %s\n") % fn) | |
1786 | self.ui.debug(_("file %s: my %s other %s ancestor %s\n") % |
|
1782 | self.ui.debug(_("file %s: my %s other %s ancestor %s\n") % | |
1787 | (fn, short(my), short(other), short(base))) |
|
1783 | (fn, short(my), short(other), short(base))) | |
1788 |
|
1784 | |||
1789 | cmd = (os.environ.get("HGMERGE") or self.ui.config("ui", "merge") |
|
1785 | cmd = (os.environ.get("HGMERGE") or self.ui.config("ui", "merge") | |
1790 | or "hgmerge") |
|
1786 | or "hgmerge") | |
1791 | r = util.system('%s "%s" "%s" "%s"' % (cmd, a, b, c), cwd=self.root, |
|
1787 | r = util.system('%s "%s" "%s" "%s"' % (cmd, a, b, c), cwd=self.root, | |
1792 | environ={'HG_FILE': fn, |
|
1788 | environ={'HG_FILE': fn, | |
1793 | 'HG_MY_NODE': p1, |
|
1789 | 'HG_MY_NODE': p1, | |
1794 | 'HG_OTHER_NODE': p2, |
|
1790 | 'HG_OTHER_NODE': p2, | |
1795 | 'HG_FILE_MY_NODE': hex(my), |
|
1791 | 'HG_FILE_MY_NODE': hex(my), | |
1796 | 'HG_FILE_OTHER_NODE': hex(other), |
|
1792 | 'HG_FILE_OTHER_NODE': hex(other), | |
1797 | 'HG_FILE_BASE_NODE': hex(base)}) |
|
1793 | 'HG_FILE_BASE_NODE': hex(base)}) | |
1798 | if r: |
|
1794 | if r: | |
1799 | self.ui.warn(_("merging %s failed!\n") % fn) |
|
1795 | self.ui.warn(_("merging %s failed!\n") % fn) | |
1800 |
|
1796 | |||
1801 | os.unlink(b) |
|
1797 | os.unlink(b) | |
1802 | os.unlink(c) |
|
1798 | os.unlink(c) | |
1803 | return r |
|
1799 | return r | |
1804 |
|
1800 | |||
1805 | def verify(self): |
|
1801 | def verify(self): | |
1806 | filelinkrevs = {} |
|
1802 | filelinkrevs = {} | |
1807 | filenodes = {} |
|
1803 | filenodes = {} | |
1808 | changesets = revisions = files = 0 |
|
1804 | changesets = revisions = files = 0 | |
1809 | errors = [0] |
|
1805 | errors = [0] | |
1810 | neededmanifests = {} |
|
1806 | neededmanifests = {} | |
1811 |
|
1807 | |||
1812 | def err(msg): |
|
1808 | def err(msg): | |
1813 | self.ui.warn(msg + "\n") |
|
1809 | self.ui.warn(msg + "\n") | |
1814 | errors[0] += 1 |
|
1810 | errors[0] += 1 | |
1815 |
|
1811 | |||
1816 | def checksize(obj, name): |
|
1812 | def checksize(obj, name): | |
1817 | d = obj.checksize() |
|
1813 | d = obj.checksize() | |
1818 | if d[0]: |
|
1814 | if d[0]: | |
1819 | err(_("%s data length off by %d bytes") % (name, d[0])) |
|
1815 | err(_("%s data length off by %d bytes") % (name, d[0])) | |
1820 | if d[1]: |
|
1816 | if d[1]: | |
1821 | err(_("%s index contains %d extra bytes") % (name, d[1])) |
|
1817 | err(_("%s index contains %d extra bytes") % (name, d[1])) | |
1822 |
|
1818 | |||
1823 | seen = {} |
|
1819 | seen = {} | |
1824 | self.ui.status(_("checking changesets\n")) |
|
1820 | self.ui.status(_("checking changesets\n")) | |
1825 | checksize(self.changelog, "changelog") |
|
1821 | checksize(self.changelog, "changelog") | |
1826 |
|
1822 | |||
1827 | for i in range(self.changelog.count()): |
|
1823 | for i in range(self.changelog.count()): | |
1828 | changesets += 1 |
|
1824 | changesets += 1 | |
1829 | n = self.changelog.node(i) |
|
1825 | n = self.changelog.node(i) | |
1830 | l = self.changelog.linkrev(n) |
|
1826 | l = self.changelog.linkrev(n) | |
1831 | if l != i: |
|
1827 | if l != i: | |
1832 | err(_("incorrect link (%d) for changeset revision %d") %(l, i)) |
|
1828 | err(_("incorrect link (%d) for changeset revision %d") %(l, i)) | |
1833 | if n in seen: |
|
1829 | if n in seen: | |
1834 | err(_("duplicate changeset at revision %d") % i) |
|
1830 | err(_("duplicate changeset at revision %d") % i) | |
1835 | seen[n] = 1 |
|
1831 | seen[n] = 1 | |
1836 |
|
1832 | |||
1837 | for p in self.changelog.parents(n): |
|
1833 | for p in self.changelog.parents(n): | |
1838 | if p not in self.changelog.nodemap: |
|
1834 | if p not in self.changelog.nodemap: | |
1839 | err(_("changeset %s has unknown parent %s") % |
|
1835 | err(_("changeset %s has unknown parent %s") % | |
1840 | (short(n), short(p))) |
|
1836 | (short(n), short(p))) | |
1841 | try: |
|
1837 | try: | |
1842 | changes = self.changelog.read(n) |
|
1838 | changes = self.changelog.read(n) | |
1843 | except KeyboardInterrupt: |
|
1839 | except KeyboardInterrupt: | |
1844 | self.ui.warn(_("interrupted")) |
|
1840 | self.ui.warn(_("interrupted")) | |
1845 | raise |
|
1841 | raise | |
1846 | except Exception, inst: |
|
1842 | except Exception, inst: | |
1847 | err(_("unpacking changeset %s: %s") % (short(n), inst)) |
|
1843 | err(_("unpacking changeset %s: %s") % (short(n), inst)) | |
1848 | continue |
|
1844 | continue | |
1849 |
|
1845 | |||
1850 | neededmanifests[changes[0]] = n |
|
1846 | neededmanifests[changes[0]] = n | |
1851 |
|
1847 | |||
1852 | for f in changes[3]: |
|
1848 | for f in changes[3]: | |
1853 | filelinkrevs.setdefault(f, []).append(i) |
|
1849 | filelinkrevs.setdefault(f, []).append(i) | |
1854 |
|
1850 | |||
1855 | seen = {} |
|
1851 | seen = {} | |
1856 | self.ui.status(_("checking manifests\n")) |
|
1852 | self.ui.status(_("checking manifests\n")) | |
1857 | checksize(self.manifest, "manifest") |
|
1853 | checksize(self.manifest, "manifest") | |
1858 |
|
1854 | |||
1859 | for i in range(self.manifest.count()): |
|
1855 | for i in range(self.manifest.count()): | |
1860 | n = self.manifest.node(i) |
|
1856 | n = self.manifest.node(i) | |
1861 | l = self.manifest.linkrev(n) |
|
1857 | l = self.manifest.linkrev(n) | |
1862 |
|
1858 | |||
1863 | if l < 0 or l >= self.changelog.count(): |
|
1859 | if l < 0 or l >= self.changelog.count(): | |
1864 | err(_("bad manifest link (%d) at revision %d") % (l, i)) |
|
1860 | err(_("bad manifest link (%d) at revision %d") % (l, i)) | |
1865 |
|
1861 | |||
1866 | if n in neededmanifests: |
|
1862 | if n in neededmanifests: | |
1867 | del neededmanifests[n] |
|
1863 | del neededmanifests[n] | |
1868 |
|
1864 | |||
1869 | if n in seen: |
|
1865 | if n in seen: | |
1870 | err(_("duplicate manifest at revision %d") % i) |
|
1866 | err(_("duplicate manifest at revision %d") % i) | |
1871 |
|
1867 | |||
1872 | seen[n] = 1 |
|
1868 | seen[n] = 1 | |
1873 |
|
1869 | |||
1874 | for p in self.manifest.parents(n): |
|
1870 | for p in self.manifest.parents(n): | |
1875 | if p not in self.manifest.nodemap: |
|
1871 | if p not in self.manifest.nodemap: | |
1876 | err(_("manifest %s has unknown parent %s") % |
|
1872 | err(_("manifest %s has unknown parent %s") % | |
1877 | (short(n), short(p))) |
|
1873 | (short(n), short(p))) | |
1878 |
|
1874 | |||
1879 | try: |
|
1875 | try: | |
1880 | delta = mdiff.patchtext(self.manifest.delta(n)) |
|
1876 | delta = mdiff.patchtext(self.manifest.delta(n)) | |
1881 | except KeyboardInterrupt: |
|
1877 | except KeyboardInterrupt: | |
1882 | self.ui.warn(_("interrupted")) |
|
1878 | self.ui.warn(_("interrupted")) | |
1883 | raise |
|
1879 | raise | |
1884 | except Exception, inst: |
|
1880 | except Exception, inst: | |
1885 | err(_("unpacking manifest %s: %s") % (short(n), inst)) |
|
1881 | err(_("unpacking manifest %s: %s") % (short(n), inst)) | |
1886 | continue |
|
1882 | continue | |
1887 |
|
1883 | |||
1888 | try: |
|
1884 | try: | |
1889 | ff = [ l.split('\0') for l in delta.splitlines() ] |
|
1885 | ff = [ l.split('\0') for l in delta.splitlines() ] | |
1890 | for f, fn in ff: |
|
1886 | for f, fn in ff: | |
1891 | filenodes.setdefault(f, {})[bin(fn[:40])] = 1 |
|
1887 | filenodes.setdefault(f, {})[bin(fn[:40])] = 1 | |
1892 | except (ValueError, TypeError), inst: |
|
1888 | except (ValueError, TypeError), inst: | |
1893 | err(_("broken delta in manifest %s: %s") % (short(n), inst)) |
|
1889 | err(_("broken delta in manifest %s: %s") % (short(n), inst)) | |
1894 |
|
1890 | |||
1895 | self.ui.status(_("crosschecking files in changesets and manifests\n")) |
|
1891 | self.ui.status(_("crosschecking files in changesets and manifests\n")) | |
1896 |
|
1892 | |||
1897 | for m, c in neededmanifests.items(): |
|
1893 | for m, c in neededmanifests.items(): | |
1898 | err(_("Changeset %s refers to unknown manifest %s") % |
|
1894 | err(_("Changeset %s refers to unknown manifest %s") % | |
1899 | (short(m), short(c))) |
|
1895 | (short(m), short(c))) | |
1900 | del neededmanifests |
|
1896 | del neededmanifests | |
1901 |
|
1897 | |||
1902 | for f in filenodes: |
|
1898 | for f in filenodes: | |
1903 | if f not in filelinkrevs: |
|
1899 | if f not in filelinkrevs: | |
1904 | err(_("file %s in manifest but not in changesets") % f) |
|
1900 | err(_("file %s in manifest but not in changesets") % f) | |
1905 |
|
1901 | |||
1906 | for f in filelinkrevs: |
|
1902 | for f in filelinkrevs: | |
1907 | if f not in filenodes: |
|
1903 | if f not in filenodes: | |
1908 | err(_("file %s in changeset but not in manifest") % f) |
|
1904 | err(_("file %s in changeset but not in manifest") % f) | |
1909 |
|
1905 | |||
1910 | self.ui.status(_("checking files\n")) |
|
1906 | self.ui.status(_("checking files\n")) | |
1911 | ff = filenodes.keys() |
|
1907 | ff = filenodes.keys() | |
1912 | ff.sort() |
|
1908 | ff.sort() | |
1913 | for f in ff: |
|
1909 | for f in ff: | |
1914 | if f == "/dev/null": |
|
1910 | if f == "/dev/null": | |
1915 | continue |
|
1911 | continue | |
1916 | files += 1 |
|
1912 | files += 1 | |
1917 | if not f: |
|
1913 | if not f: | |
1918 | err(_("file without name in manifest %s") % short(n)) |
|
1914 | err(_("file without name in manifest %s") % short(n)) | |
1919 | continue |
|
1915 | continue | |
1920 | fl = self.file(f) |
|
1916 | fl = self.file(f) | |
1921 | checksize(fl, f) |
|
1917 | checksize(fl, f) | |
1922 |
|
1918 | |||
1923 | nodes = {nullid: 1} |
|
1919 | nodes = {nullid: 1} | |
1924 | seen = {} |
|
1920 | seen = {} | |
1925 | for i in range(fl.count()): |
|
1921 | for i in range(fl.count()): | |
1926 | revisions += 1 |
|
1922 | revisions += 1 | |
1927 | n = fl.node(i) |
|
1923 | n = fl.node(i) | |
1928 |
|
1924 | |||
1929 | if n in seen: |
|
1925 | if n in seen: | |
1930 | err(_("%s: duplicate revision %d") % (f, i)) |
|
1926 | err(_("%s: duplicate revision %d") % (f, i)) | |
1931 | if n not in filenodes[f]: |
|
1927 | if n not in filenodes[f]: | |
1932 | err(_("%s: %d:%s not in manifests") % (f, i, short(n))) |
|
1928 | err(_("%s: %d:%s not in manifests") % (f, i, short(n))) | |
1933 | else: |
|
1929 | else: | |
1934 | del filenodes[f][n] |
|
1930 | del filenodes[f][n] | |
1935 |
|
1931 | |||
1936 | flr = fl.linkrev(n) |
|
1932 | flr = fl.linkrev(n) | |
1937 | if flr not in filelinkrevs.get(f, []): |
|
1933 | if flr not in filelinkrevs.get(f, []): | |
1938 | err(_("%s:%s points to unexpected changeset %d") |
|
1934 | err(_("%s:%s points to unexpected changeset %d") | |
1939 | % (f, short(n), flr)) |
|
1935 | % (f, short(n), flr)) | |
1940 | else: |
|
1936 | else: | |
1941 | filelinkrevs[f].remove(flr) |
|
1937 | filelinkrevs[f].remove(flr) | |
1942 |
|
1938 | |||
1943 | # verify contents |
|
1939 | # verify contents | |
1944 | try: |
|
1940 | try: | |
1945 | t = fl.read(n) |
|
1941 | t = fl.read(n) | |
1946 | except KeyboardInterrupt: |
|
1942 | except KeyboardInterrupt: | |
1947 | self.ui.warn(_("interrupted")) |
|
1943 | self.ui.warn(_("interrupted")) | |
1948 | raise |
|
1944 | raise | |
1949 | except Exception, inst: |
|
1945 | except Exception, inst: | |
1950 | err(_("unpacking file %s %s: %s") % (f, short(n), inst)) |
|
1946 | err(_("unpacking file %s %s: %s") % (f, short(n), inst)) | |
1951 |
|
1947 | |||
1952 | # verify parents |
|
1948 | # verify parents | |
1953 | (p1, p2) = fl.parents(n) |
|
1949 | (p1, p2) = fl.parents(n) | |
1954 | if p1 not in nodes: |
|
1950 | if p1 not in nodes: | |
1955 | err(_("file %s:%s unknown parent 1 %s") % |
|
1951 | err(_("file %s:%s unknown parent 1 %s") % | |
1956 | (f, short(n), short(p1))) |
|
1952 | (f, short(n), short(p1))) | |
1957 | if p2 not in nodes: |
|
1953 | if p2 not in nodes: | |
1958 | err(_("file %s:%s unknown parent 2 %s") % |
|
1954 | err(_("file %s:%s unknown parent 2 %s") % | |
1959 | (f, short(n), short(p1))) |
|
1955 | (f, short(n), short(p1))) | |
1960 | nodes[n] = 1 |
|
1956 | nodes[n] = 1 | |
1961 |
|
1957 | |||
1962 | # cross-check |
|
1958 | # cross-check | |
1963 | for node in filenodes[f]: |
|
1959 | for node in filenodes[f]: | |
1964 | err(_("node %s in manifests not in %s") % (hex(node), f)) |
|
1960 | err(_("node %s in manifests not in %s") % (hex(node), f)) | |
1965 |
|
1961 | |||
1966 | self.ui.status(_("%d files, %d changesets, %d total revisions\n") % |
|
1962 | self.ui.status(_("%d files, %d changesets, %d total revisions\n") % | |
1967 | (files, changesets, revisions)) |
|
1963 | (files, changesets, revisions)) | |
1968 |
|
1964 | |||
1969 | if errors[0]: |
|
1965 | if errors[0]: | |
1970 | self.ui.warn(_("%d integrity errors encountered!\n") % errors[0]) |
|
1966 | self.ui.warn(_("%d integrity errors encountered!\n") % errors[0]) | |
1971 | return 1 |
|
1967 | return 1 | |
1972 |
|
1968 | |||
1973 | # used to avoid circular references so destructors work |
|
1969 | # used to avoid circular references so destructors work | |
1974 | def aftertrans(base): |
|
1970 | def aftertrans(base): | |
1975 | p = base |
|
1971 | p = base | |
1976 | def a(): |
|
1972 | def a(): | |
1977 | util.rename(os.path.join(p, "journal"), os.path.join(p, "undo")) |
|
1973 | util.rename(os.path.join(p, "journal"), os.path.join(p, "undo")) | |
1978 | util.rename(os.path.join(p, "journal.dirstate"), |
|
1974 | util.rename(os.path.join(p, "journal.dirstate"), | |
1979 | os.path.join(p, "undo.dirstate")) |
|
1975 | os.path.join(p, "undo.dirstate")) | |
1980 | return a |
|
1976 | return a | |
1981 |
|
1977 |
@@ -1,38 +1,42 b'' | |||||
1 | pushing to ../a |
|
1 | pushing to ../a | |
2 | searching for changes |
|
2 | searching for changes | |
3 | abort: unsynced remote changes! |
|
3 | abort: unsynced remote changes! | |
4 | (did you forget to sync? use push -f to force) |
|
4 | (did you forget to sync? use push -f to force) | |
5 | pulling from ../a |
|
5 | pulling from ../a | |
6 | searching for changes |
|
6 | searching for changes | |
7 | adding changesets |
|
7 | adding changesets | |
8 | adding manifests |
|
8 | adding manifests | |
9 | adding file changes |
|
9 | adding file changes | |
10 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
10 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
11 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
11 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
12 | pushing to ../a |
|
12 | pushing to ../a | |
13 | searching for changes |
|
13 | searching for changes | |
14 | abort: push creates new remote branches! |
|
14 | abort: push creates new remote branches! | |
15 | (did you forget to merge? use push -f to force) |
|
15 | (did you forget to merge? use push -f to force) | |
16 | pushing to ../a |
|
16 | pushing to ../a | |
17 | searching for changes |
|
17 | searching for changes | |
18 | adding changesets |
|
18 | adding changesets | |
19 | adding manifests |
|
19 | adding manifests | |
20 | adding file changes |
|
20 | adding file changes | |
21 | added 2 changesets with 1 changes to 1 files |
|
21 | added 2 changesets with 1 changes to 1 files | |
22 | adding foo |
|
22 | adding foo | |
23 | merging foo |
|
23 | merging foo | |
24 | pushing to ../c |
|
24 | pushing to ../c | |
25 | searching for changes |
|
25 | searching for changes | |
26 | abort: push creates new remote branches! |
|
26 | abort: push creates new remote branches! | |
27 | (did you forget to merge? use push -f to force) |
|
27 | (did you forget to merge? use push -f to force) | |
28 | pushing to ../c |
|
28 | pushing to ../c | |
29 | searching for changes |
|
29 | searching for changes | |
30 | no changes found |
|
30 | no changes found | |
31 | pushing to ../c |
|
31 | pushing to ../c | |
32 | searching for changes |
|
32 | searching for changes | |
33 | abort: push creates new remote branches! |
|
33 | adding changesets | |
34 | (did you forget to merge? use push -f to force) |
|
34 | adding manifests | |
|
35 | adding file changes | |||
|
36 | added 2 changesets with 2 changes to 1 files (+2 heads) | |||
35 | pushing to ../c |
|
37 | pushing to ../c | |
36 | searching for changes |
|
38 | searching for changes | |
37 | abort: push creates new remote branches! |
|
39 | adding changesets | |
38 | (did you forget to merge? use push -f to force) |
|
40 | adding manifests | |
|
41 | adding file changes | |||
|
42 | added 1 changesets with 1 changes to 1 files |
General Comments 0
You need to be logged in to leave comments.
Login now