Show More
@@ -1,3143 +1,3143 | |||||
1 | # localrepo.py - read/write repository class for mercurial |
|
1 | # localrepo.py - read/write repository class for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import errno |
|
10 | import errno | |
11 | import hashlib |
|
11 | import hashlib | |
12 | import os |
|
12 | import os | |
13 | import random |
|
13 | import random | |
14 | import sys |
|
14 | import sys | |
15 | import time |
|
15 | import time | |
16 | import weakref |
|
16 | import weakref | |
17 |
|
17 | |||
18 | from .i18n import _ |
|
18 | from .i18n import _ | |
19 | from .node import ( |
|
19 | from .node import ( | |
20 | bin, |
|
20 | bin, | |
21 | hex, |
|
21 | hex, | |
22 | nullid, |
|
22 | nullid, | |
23 | nullrev, |
|
23 | nullrev, | |
24 | short, |
|
24 | short, | |
25 | ) |
|
25 | ) | |
26 | from . import ( |
|
26 | from . import ( | |
27 | bookmarks, |
|
27 | bookmarks, | |
28 | branchmap, |
|
28 | branchmap, | |
29 | bundle2, |
|
29 | bundle2, | |
30 | changegroup, |
|
30 | changegroup, | |
31 | changelog, |
|
31 | changelog, | |
32 | color, |
|
32 | color, | |
33 | context, |
|
33 | context, | |
34 | dirstate, |
|
34 | dirstate, | |
35 | dirstateguard, |
|
35 | dirstateguard, | |
36 | discovery, |
|
36 | discovery, | |
37 | encoding, |
|
37 | encoding, | |
38 | error, |
|
38 | error, | |
39 | exchange, |
|
39 | exchange, | |
40 | extensions, |
|
40 | extensions, | |
41 | filelog, |
|
41 | filelog, | |
42 | hook, |
|
42 | hook, | |
43 | lock as lockmod, |
|
43 | lock as lockmod, | |
44 | manifest, |
|
44 | manifest, | |
45 | match as matchmod, |
|
45 | match as matchmod, | |
46 | merge as mergemod, |
|
46 | merge as mergemod, | |
47 | mergeutil, |
|
47 | mergeutil, | |
48 | namespaces, |
|
48 | namespaces, | |
49 | narrowspec, |
|
49 | narrowspec, | |
50 | obsolete, |
|
50 | obsolete, | |
51 | pathutil, |
|
51 | pathutil, | |
52 | phases, |
|
52 | phases, | |
53 | pushkey, |
|
53 | pushkey, | |
54 | pycompat, |
|
54 | pycompat, | |
55 | repository, |
|
55 | repository, | |
56 | repoview, |
|
56 | repoview, | |
57 | revset, |
|
57 | revset, | |
58 | revsetlang, |
|
58 | revsetlang, | |
59 | scmutil, |
|
59 | scmutil, | |
60 | sparse, |
|
60 | sparse, | |
61 | store as storemod, |
|
61 | store as storemod, | |
62 | subrepoutil, |
|
62 | subrepoutil, | |
63 | tags as tagsmod, |
|
63 | tags as tagsmod, | |
64 | transaction, |
|
64 | transaction, | |
65 | txnutil, |
|
65 | txnutil, | |
66 | util, |
|
66 | util, | |
67 | vfs as vfsmod, |
|
67 | vfs as vfsmod, | |
68 | ) |
|
68 | ) | |
69 | from .utils import ( |
|
69 | from .utils import ( | |
70 | interfaceutil, |
|
70 | interfaceutil, | |
71 | procutil, |
|
71 | procutil, | |
72 | stringutil, |
|
72 | stringutil, | |
73 | ) |
|
73 | ) | |
74 |
|
74 | |||
75 | from .revlogutils import ( |
|
75 | from .revlogutils import ( | |
76 | constants as revlogconst, |
|
76 | constants as revlogconst, | |
77 | ) |
|
77 | ) | |
78 |
|
78 | |||
79 | release = lockmod.release |
|
79 | release = lockmod.release | |
80 | urlerr = util.urlerr |
|
80 | urlerr = util.urlerr | |
81 | urlreq = util.urlreq |
|
81 | urlreq = util.urlreq | |
82 |
|
82 | |||
83 | # set of (path, vfs-location) tuples. vfs-location is: |
|
83 | # set of (path, vfs-location) tuples. vfs-location is: | |
84 | # - 'plain for vfs relative paths |
|
84 | # - 'plain for vfs relative paths | |
85 | # - '' for svfs relative paths |
|
85 | # - '' for svfs relative paths | |
86 | _cachedfiles = set() |
|
86 | _cachedfiles = set() | |
87 |
|
87 | |||
88 | class _basefilecache(scmutil.filecache): |
|
88 | class _basefilecache(scmutil.filecache): | |
89 | """All filecache usage on repo are done for logic that should be unfiltered |
|
89 | """All filecache usage on repo are done for logic that should be unfiltered | |
90 | """ |
|
90 | """ | |
91 | def __get__(self, repo, type=None): |
|
91 | def __get__(self, repo, type=None): | |
92 | if repo is None: |
|
92 | if repo is None: | |
93 | return self |
|
93 | return self | |
94 | # proxy to unfiltered __dict__ since filtered repo has no entry |
|
94 | # proxy to unfiltered __dict__ since filtered repo has no entry | |
95 | unfi = repo.unfiltered() |
|
95 | unfi = repo.unfiltered() | |
96 | try: |
|
96 | try: | |
97 | return unfi.__dict__[self.sname] |
|
97 | return unfi.__dict__[self.sname] | |
98 | except KeyError: |
|
98 | except KeyError: | |
99 | pass |
|
99 | pass | |
100 | return super(_basefilecache, self).__get__(unfi, type) |
|
100 | return super(_basefilecache, self).__get__(unfi, type) | |
101 |
|
101 | |||
102 | def set(self, repo, value): |
|
102 | def set(self, repo, value): | |
103 | return super(_basefilecache, self).set(repo.unfiltered(), value) |
|
103 | return super(_basefilecache, self).set(repo.unfiltered(), value) | |
104 |
|
104 | |||
105 | class repofilecache(_basefilecache): |
|
105 | class repofilecache(_basefilecache): | |
106 | """filecache for files in .hg but outside of .hg/store""" |
|
106 | """filecache for files in .hg but outside of .hg/store""" | |
107 | def __init__(self, *paths): |
|
107 | def __init__(self, *paths): | |
108 | super(repofilecache, self).__init__(*paths) |
|
108 | super(repofilecache, self).__init__(*paths) | |
109 | for path in paths: |
|
109 | for path in paths: | |
110 | _cachedfiles.add((path, 'plain')) |
|
110 | _cachedfiles.add((path, 'plain')) | |
111 |
|
111 | |||
112 | def join(self, obj, fname): |
|
112 | def join(self, obj, fname): | |
113 | return obj.vfs.join(fname) |
|
113 | return obj.vfs.join(fname) | |
114 |
|
114 | |||
115 | class storecache(_basefilecache): |
|
115 | class storecache(_basefilecache): | |
116 | """filecache for files in the store""" |
|
116 | """filecache for files in the store""" | |
117 | def __init__(self, *paths): |
|
117 | def __init__(self, *paths): | |
118 | super(storecache, self).__init__(*paths) |
|
118 | super(storecache, self).__init__(*paths) | |
119 | for path in paths: |
|
119 | for path in paths: | |
120 | _cachedfiles.add((path, '')) |
|
120 | _cachedfiles.add((path, '')) | |
121 |
|
121 | |||
122 | def join(self, obj, fname): |
|
122 | def join(self, obj, fname): | |
123 | return obj.sjoin(fname) |
|
123 | return obj.sjoin(fname) | |
124 |
|
124 | |||
125 | def isfilecached(repo, name): |
|
125 | def isfilecached(repo, name): | |
126 | """check if a repo has already cached "name" filecache-ed property |
|
126 | """check if a repo has already cached "name" filecache-ed property | |
127 |
|
127 | |||
128 | This returns (cachedobj-or-None, iscached) tuple. |
|
128 | This returns (cachedobj-or-None, iscached) tuple. | |
129 | """ |
|
129 | """ | |
130 | cacheentry = repo.unfiltered()._filecache.get(name, None) |
|
130 | cacheentry = repo.unfiltered()._filecache.get(name, None) | |
131 | if not cacheentry: |
|
131 | if not cacheentry: | |
132 | return None, False |
|
132 | return None, False | |
133 | return cacheentry.obj, True |
|
133 | return cacheentry.obj, True | |
134 |
|
134 | |||
135 | class unfilteredpropertycache(util.propertycache): |
|
135 | class unfilteredpropertycache(util.propertycache): | |
136 | """propertycache that apply to unfiltered repo only""" |
|
136 | """propertycache that apply to unfiltered repo only""" | |
137 |
|
137 | |||
138 | def __get__(self, repo, type=None): |
|
138 | def __get__(self, repo, type=None): | |
139 | unfi = repo.unfiltered() |
|
139 | unfi = repo.unfiltered() | |
140 | if unfi is repo: |
|
140 | if unfi is repo: | |
141 | return super(unfilteredpropertycache, self).__get__(unfi) |
|
141 | return super(unfilteredpropertycache, self).__get__(unfi) | |
142 | return getattr(unfi, self.name) |
|
142 | return getattr(unfi, self.name) | |
143 |
|
143 | |||
144 | class filteredpropertycache(util.propertycache): |
|
144 | class filteredpropertycache(util.propertycache): | |
145 | """propertycache that must take filtering in account""" |
|
145 | """propertycache that must take filtering in account""" | |
146 |
|
146 | |||
147 | def cachevalue(self, obj, value): |
|
147 | def cachevalue(self, obj, value): | |
148 | object.__setattr__(obj, self.name, value) |
|
148 | object.__setattr__(obj, self.name, value) | |
149 |
|
149 | |||
150 |
|
150 | |||
151 | def hasunfilteredcache(repo, name): |
|
151 | def hasunfilteredcache(repo, name): | |
152 | """check if a repo has an unfilteredpropertycache value for <name>""" |
|
152 | """check if a repo has an unfilteredpropertycache value for <name>""" | |
153 | return name in vars(repo.unfiltered()) |
|
153 | return name in vars(repo.unfiltered()) | |
154 |
|
154 | |||
155 | def unfilteredmethod(orig): |
|
155 | def unfilteredmethod(orig): | |
156 | """decorate method that always need to be run on unfiltered version""" |
|
156 | """decorate method that always need to be run on unfiltered version""" | |
157 | def wrapper(repo, *args, **kwargs): |
|
157 | def wrapper(repo, *args, **kwargs): | |
158 | return orig(repo.unfiltered(), *args, **kwargs) |
|
158 | return orig(repo.unfiltered(), *args, **kwargs) | |
159 | return wrapper |
|
159 | return wrapper | |
160 |
|
160 | |||
161 | moderncaps = {'lookup', 'branchmap', 'pushkey', 'known', 'getbundle', |
|
161 | moderncaps = {'lookup', 'branchmap', 'pushkey', 'known', 'getbundle', | |
162 | 'unbundle'} |
|
162 | 'unbundle'} | |
163 | legacycaps = moderncaps.union({'changegroupsubset'}) |
|
163 | legacycaps = moderncaps.union({'changegroupsubset'}) | |
164 |
|
164 | |||
165 | @interfaceutil.implementer(repository.ipeercommandexecutor) |
|
165 | @interfaceutil.implementer(repository.ipeercommandexecutor) | |
166 | class localcommandexecutor(object): |
|
166 | class localcommandexecutor(object): | |
167 | def __init__(self, peer): |
|
167 | def __init__(self, peer): | |
168 | self._peer = peer |
|
168 | self._peer = peer | |
169 | self._sent = False |
|
169 | self._sent = False | |
170 | self._closed = False |
|
170 | self._closed = False | |
171 |
|
171 | |||
172 | def __enter__(self): |
|
172 | def __enter__(self): | |
173 | return self |
|
173 | return self | |
174 |
|
174 | |||
175 | def __exit__(self, exctype, excvalue, exctb): |
|
175 | def __exit__(self, exctype, excvalue, exctb): | |
176 | self.close() |
|
176 | self.close() | |
177 |
|
177 | |||
178 | def callcommand(self, command, args): |
|
178 | def callcommand(self, command, args): | |
179 | if self._sent: |
|
179 | if self._sent: | |
180 | raise error.ProgrammingError('callcommand() cannot be used after ' |
|
180 | raise error.ProgrammingError('callcommand() cannot be used after ' | |
181 | 'sendcommands()') |
|
181 | 'sendcommands()') | |
182 |
|
182 | |||
183 | if self._closed: |
|
183 | if self._closed: | |
184 | raise error.ProgrammingError('callcommand() cannot be used after ' |
|
184 | raise error.ProgrammingError('callcommand() cannot be used after ' | |
185 | 'close()') |
|
185 | 'close()') | |
186 |
|
186 | |||
187 | # We don't need to support anything fancy. Just call the named |
|
187 | # We don't need to support anything fancy. Just call the named | |
188 | # method on the peer and return a resolved future. |
|
188 | # method on the peer and return a resolved future. | |
189 | fn = getattr(self._peer, pycompat.sysstr(command)) |
|
189 | fn = getattr(self._peer, pycompat.sysstr(command)) | |
190 |
|
190 | |||
191 | f = pycompat.futures.Future() |
|
191 | f = pycompat.futures.Future() | |
192 |
|
192 | |||
193 | try: |
|
193 | try: | |
194 | result = fn(**pycompat.strkwargs(args)) |
|
194 | result = fn(**pycompat.strkwargs(args)) | |
195 | except Exception: |
|
195 | except Exception: | |
196 | pycompat.future_set_exception_info(f, sys.exc_info()[1:]) |
|
196 | pycompat.future_set_exception_info(f, sys.exc_info()[1:]) | |
197 | else: |
|
197 | else: | |
198 | f.set_result(result) |
|
198 | f.set_result(result) | |
199 |
|
199 | |||
200 | return f |
|
200 | return f | |
201 |
|
201 | |||
202 | def sendcommands(self): |
|
202 | def sendcommands(self): | |
203 | self._sent = True |
|
203 | self._sent = True | |
204 |
|
204 | |||
205 | def close(self): |
|
205 | def close(self): | |
206 | self._closed = True |
|
206 | self._closed = True | |
207 |
|
207 | |||
208 | @interfaceutil.implementer(repository.ipeercommands) |
|
208 | @interfaceutil.implementer(repository.ipeercommands) | |
209 | class localpeer(repository.peer): |
|
209 | class localpeer(repository.peer): | |
210 | '''peer for a local repo; reflects only the most recent API''' |
|
210 | '''peer for a local repo; reflects only the most recent API''' | |
211 |
|
211 | |||
212 | def __init__(self, repo, caps=None): |
|
212 | def __init__(self, repo, caps=None): | |
213 | super(localpeer, self).__init__() |
|
213 | super(localpeer, self).__init__() | |
214 |
|
214 | |||
215 | if caps is None: |
|
215 | if caps is None: | |
216 | caps = moderncaps.copy() |
|
216 | caps = moderncaps.copy() | |
217 | self._repo = repo.filtered('served') |
|
217 | self._repo = repo.filtered('served') | |
218 | self.ui = repo.ui |
|
218 | self.ui = repo.ui | |
219 | self._caps = repo._restrictcapabilities(caps) |
|
219 | self._caps = repo._restrictcapabilities(caps) | |
220 |
|
220 | |||
221 | # Begin of _basepeer interface. |
|
221 | # Begin of _basepeer interface. | |
222 |
|
222 | |||
223 | def url(self): |
|
223 | def url(self): | |
224 | return self._repo.url() |
|
224 | return self._repo.url() | |
225 |
|
225 | |||
226 | def local(self): |
|
226 | def local(self): | |
227 | return self._repo |
|
227 | return self._repo | |
228 |
|
228 | |||
229 | def peer(self): |
|
229 | def peer(self): | |
230 | return self |
|
230 | return self | |
231 |
|
231 | |||
232 | def canpush(self): |
|
232 | def canpush(self): | |
233 | return True |
|
233 | return True | |
234 |
|
234 | |||
235 | def close(self): |
|
235 | def close(self): | |
236 | self._repo.close() |
|
236 | self._repo.close() | |
237 |
|
237 | |||
238 | # End of _basepeer interface. |
|
238 | # End of _basepeer interface. | |
239 |
|
239 | |||
240 | # Begin of _basewirecommands interface. |
|
240 | # Begin of _basewirecommands interface. | |
241 |
|
241 | |||
242 | def branchmap(self): |
|
242 | def branchmap(self): | |
243 | return self._repo.branchmap() |
|
243 | return self._repo.branchmap() | |
244 |
|
244 | |||
245 | def capabilities(self): |
|
245 | def capabilities(self): | |
246 | return self._caps |
|
246 | return self._caps | |
247 |
|
247 | |||
248 | def clonebundles(self): |
|
248 | def clonebundles(self): | |
249 | return self._repo.tryread('clonebundles.manifest') |
|
249 | return self._repo.tryread('clonebundles.manifest') | |
250 |
|
250 | |||
251 | def debugwireargs(self, one, two, three=None, four=None, five=None): |
|
251 | def debugwireargs(self, one, two, three=None, four=None, five=None): | |
252 | """Used to test argument passing over the wire""" |
|
252 | """Used to test argument passing over the wire""" | |
253 | return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three), |
|
253 | return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three), | |
254 | pycompat.bytestr(four), |
|
254 | pycompat.bytestr(four), | |
255 | pycompat.bytestr(five)) |
|
255 | pycompat.bytestr(five)) | |
256 |
|
256 | |||
257 | def getbundle(self, source, heads=None, common=None, bundlecaps=None, |
|
257 | def getbundle(self, source, heads=None, common=None, bundlecaps=None, | |
258 | **kwargs): |
|
258 | **kwargs): | |
259 | chunks = exchange.getbundlechunks(self._repo, source, heads=heads, |
|
259 | chunks = exchange.getbundlechunks(self._repo, source, heads=heads, | |
260 | common=common, bundlecaps=bundlecaps, |
|
260 | common=common, bundlecaps=bundlecaps, | |
261 | **kwargs)[1] |
|
261 | **kwargs)[1] | |
262 | cb = util.chunkbuffer(chunks) |
|
262 | cb = util.chunkbuffer(chunks) | |
263 |
|
263 | |||
264 | if exchange.bundle2requested(bundlecaps): |
|
264 | if exchange.bundle2requested(bundlecaps): | |
265 | # When requesting a bundle2, getbundle returns a stream to make the |
|
265 | # When requesting a bundle2, getbundle returns a stream to make the | |
266 | # wire level function happier. We need to build a proper object |
|
266 | # wire level function happier. We need to build a proper object | |
267 | # from it in local peer. |
|
267 | # from it in local peer. | |
268 | return bundle2.getunbundler(self.ui, cb) |
|
268 | return bundle2.getunbundler(self.ui, cb) | |
269 | else: |
|
269 | else: | |
270 | return changegroup.getunbundler('01', cb, None) |
|
270 | return changegroup.getunbundler('01', cb, None) | |
271 |
|
271 | |||
272 | def heads(self): |
|
272 | def heads(self): | |
273 | return self._repo.heads() |
|
273 | return self._repo.heads() | |
274 |
|
274 | |||
275 | def known(self, nodes): |
|
275 | def known(self, nodes): | |
276 | return self._repo.known(nodes) |
|
276 | return self._repo.known(nodes) | |
277 |
|
277 | |||
278 | def listkeys(self, namespace): |
|
278 | def listkeys(self, namespace): | |
279 | return self._repo.listkeys(namespace) |
|
279 | return self._repo.listkeys(namespace) | |
280 |
|
280 | |||
281 | def lookup(self, key): |
|
281 | def lookup(self, key): | |
282 | return self._repo.lookup(key) |
|
282 | return self._repo.lookup(key) | |
283 |
|
283 | |||
284 | def pushkey(self, namespace, key, old, new): |
|
284 | def pushkey(self, namespace, key, old, new): | |
285 | return self._repo.pushkey(namespace, key, old, new) |
|
285 | return self._repo.pushkey(namespace, key, old, new) | |
286 |
|
286 | |||
287 | def stream_out(self): |
|
287 | def stream_out(self): | |
288 | raise error.Abort(_('cannot perform stream clone against local ' |
|
288 | raise error.Abort(_('cannot perform stream clone against local ' | |
289 | 'peer')) |
|
289 | 'peer')) | |
290 |
|
290 | |||
291 | def unbundle(self, bundle, heads, url): |
|
291 | def unbundle(self, bundle, heads, url): | |
292 | """apply a bundle on a repo |
|
292 | """apply a bundle on a repo | |
293 |
|
293 | |||
294 | This function handles the repo locking itself.""" |
|
294 | This function handles the repo locking itself.""" | |
295 | try: |
|
295 | try: | |
296 | try: |
|
296 | try: | |
297 | bundle = exchange.readbundle(self.ui, bundle, None) |
|
297 | bundle = exchange.readbundle(self.ui, bundle, None) | |
298 | ret = exchange.unbundle(self._repo, bundle, heads, 'push', url) |
|
298 | ret = exchange.unbundle(self._repo, bundle, heads, 'push', url) | |
299 | if util.safehasattr(ret, 'getchunks'): |
|
299 | if util.safehasattr(ret, 'getchunks'): | |
300 | # This is a bundle20 object, turn it into an unbundler. |
|
300 | # This is a bundle20 object, turn it into an unbundler. | |
301 | # This little dance should be dropped eventually when the |
|
301 | # This little dance should be dropped eventually when the | |
302 | # API is finally improved. |
|
302 | # API is finally improved. | |
303 | stream = util.chunkbuffer(ret.getchunks()) |
|
303 | stream = util.chunkbuffer(ret.getchunks()) | |
304 | ret = bundle2.getunbundler(self.ui, stream) |
|
304 | ret = bundle2.getunbundler(self.ui, stream) | |
305 | return ret |
|
305 | return ret | |
306 | except Exception as exc: |
|
306 | except Exception as exc: | |
307 | # If the exception contains output salvaged from a bundle2 |
|
307 | # If the exception contains output salvaged from a bundle2 | |
308 | # reply, we need to make sure it is printed before continuing |
|
308 | # reply, we need to make sure it is printed before continuing | |
309 | # to fail. So we build a bundle2 with such output and consume |
|
309 | # to fail. So we build a bundle2 with such output and consume | |
310 | # it directly. |
|
310 | # it directly. | |
311 | # |
|
311 | # | |
312 | # This is not very elegant but allows a "simple" solution for |
|
312 | # This is not very elegant but allows a "simple" solution for | |
313 | # issue4594 |
|
313 | # issue4594 | |
314 | output = getattr(exc, '_bundle2salvagedoutput', ()) |
|
314 | output = getattr(exc, '_bundle2salvagedoutput', ()) | |
315 | if output: |
|
315 | if output: | |
316 | bundler = bundle2.bundle20(self._repo.ui) |
|
316 | bundler = bundle2.bundle20(self._repo.ui) | |
317 | for out in output: |
|
317 | for out in output: | |
318 | bundler.addpart(out) |
|
318 | bundler.addpart(out) | |
319 | stream = util.chunkbuffer(bundler.getchunks()) |
|
319 | stream = util.chunkbuffer(bundler.getchunks()) | |
320 | b = bundle2.getunbundler(self.ui, stream) |
|
320 | b = bundle2.getunbundler(self.ui, stream) | |
321 | bundle2.processbundle(self._repo, b) |
|
321 | bundle2.processbundle(self._repo, b) | |
322 | raise |
|
322 | raise | |
323 | except error.PushRaced as exc: |
|
323 | except error.PushRaced as exc: | |
324 | raise error.ResponseError(_('push failed:'), |
|
324 | raise error.ResponseError(_('push failed:'), | |
325 | stringutil.forcebytestr(exc)) |
|
325 | stringutil.forcebytestr(exc)) | |
326 |
|
326 | |||
327 | # End of _basewirecommands interface. |
|
327 | # End of _basewirecommands interface. | |
328 |
|
328 | |||
329 | # Begin of peer interface. |
|
329 | # Begin of peer interface. | |
330 |
|
330 | |||
331 | def commandexecutor(self): |
|
331 | def commandexecutor(self): | |
332 | return localcommandexecutor(self) |
|
332 | return localcommandexecutor(self) | |
333 |
|
333 | |||
334 | # End of peer interface. |
|
334 | # End of peer interface. | |
335 |
|
335 | |||
336 | @interfaceutil.implementer(repository.ipeerlegacycommands) |
|
336 | @interfaceutil.implementer(repository.ipeerlegacycommands) | |
337 | class locallegacypeer(localpeer): |
|
337 | class locallegacypeer(localpeer): | |
338 | '''peer extension which implements legacy methods too; used for tests with |
|
338 | '''peer extension which implements legacy methods too; used for tests with | |
339 | restricted capabilities''' |
|
339 | restricted capabilities''' | |
340 |
|
340 | |||
341 | def __init__(self, repo): |
|
341 | def __init__(self, repo): | |
342 | super(locallegacypeer, self).__init__(repo, caps=legacycaps) |
|
342 | super(locallegacypeer, self).__init__(repo, caps=legacycaps) | |
343 |
|
343 | |||
344 | # Begin of baselegacywirecommands interface. |
|
344 | # Begin of baselegacywirecommands interface. | |
345 |
|
345 | |||
346 | def between(self, pairs): |
|
346 | def between(self, pairs): | |
347 | return self._repo.between(pairs) |
|
347 | return self._repo.between(pairs) | |
348 |
|
348 | |||
349 | def branches(self, nodes): |
|
349 | def branches(self, nodes): | |
350 | return self._repo.branches(nodes) |
|
350 | return self._repo.branches(nodes) | |
351 |
|
351 | |||
352 | def changegroup(self, nodes, source): |
|
352 | def changegroup(self, nodes, source): | |
353 | outgoing = discovery.outgoing(self._repo, missingroots=nodes, |
|
353 | outgoing = discovery.outgoing(self._repo, missingroots=nodes, | |
354 | missingheads=self._repo.heads()) |
|
354 | missingheads=self._repo.heads()) | |
355 | return changegroup.makechangegroup(self._repo, outgoing, '01', source) |
|
355 | return changegroup.makechangegroup(self._repo, outgoing, '01', source) | |
356 |
|
356 | |||
357 | def changegroupsubset(self, bases, heads, source): |
|
357 | def changegroupsubset(self, bases, heads, source): | |
358 | outgoing = discovery.outgoing(self._repo, missingroots=bases, |
|
358 | outgoing = discovery.outgoing(self._repo, missingroots=bases, | |
359 | missingheads=heads) |
|
359 | missingheads=heads) | |
360 | return changegroup.makechangegroup(self._repo, outgoing, '01', source) |
|
360 | return changegroup.makechangegroup(self._repo, outgoing, '01', source) | |
361 |
|
361 | |||
362 | # End of baselegacywirecommands interface. |
|
362 | # End of baselegacywirecommands interface. | |
363 |
|
363 | |||
364 | # Increment the sub-version when the revlog v2 format changes to lock out old |
|
364 | # Increment the sub-version when the revlog v2 format changes to lock out old | |
365 | # clients. |
|
365 | # clients. | |
366 | REVLOGV2_REQUIREMENT = 'exp-revlogv2.1' |
|
366 | REVLOGV2_REQUIREMENT = 'exp-revlogv2.1' | |
367 |
|
367 | |||
368 | # A repository with the sparserevlog feature will have delta chains that |
|
368 | # A repository with the sparserevlog feature will have delta chains that | |
369 | # can spread over a larger span. Sparse reading cuts these large spans into |
|
369 | # can spread over a larger span. Sparse reading cuts these large spans into | |
370 | # pieces, so that each piece isn't too big. |
|
370 | # pieces, so that each piece isn't too big. | |
371 | # Without the sparserevlog capability, reading from the repository could use |
|
371 | # Without the sparserevlog capability, reading from the repository could use | |
372 | # huge amounts of memory, because the whole span would be read at once, |
|
372 | # huge amounts of memory, because the whole span would be read at once, | |
373 | # including all the intermediate revisions that aren't pertinent for the chain. |
|
373 | # including all the intermediate revisions that aren't pertinent for the chain. | |
374 | # This is why once a repository has enabled sparse-read, it becomes required. |
|
374 | # This is why once a repository has enabled sparse-read, it becomes required. | |
375 | SPARSEREVLOG_REQUIREMENT = 'sparserevlog' |
|
375 | SPARSEREVLOG_REQUIREMENT = 'sparserevlog' | |
376 |
|
376 | |||
377 | # Functions receiving (ui, features) that extensions can register to impact |
|
377 | # Functions receiving (ui, features) that extensions can register to impact | |
378 | # the ability to load repositories with custom requirements. Only |
|
378 | # the ability to load repositories with custom requirements. Only | |
379 | # functions defined in loaded extensions are called. |
|
379 | # functions defined in loaded extensions are called. | |
380 | # |
|
380 | # | |
381 | # The function receives a set of requirement strings that the repository |
|
381 | # The function receives a set of requirement strings that the repository | |
382 | # is capable of opening. Functions will typically add elements to the |
|
382 | # is capable of opening. Functions will typically add elements to the | |
383 | # set to reflect that the extension knows how to handle that requirements. |
|
383 | # set to reflect that the extension knows how to handle that requirements. | |
384 | featuresetupfuncs = set() |
|
384 | featuresetupfuncs = set() | |
385 |
|
385 | |||
386 | def makelocalrepository(baseui, path, intents=None): |
|
386 | def makelocalrepository(baseui, path, intents=None): | |
387 | """Create a local repository object. |
|
387 | """Create a local repository object. | |
388 |
|
388 | |||
389 | Given arguments needed to construct a local repository, this function |
|
389 | Given arguments needed to construct a local repository, this function | |
390 | performs various early repository loading functionality (such as |
|
390 | performs various early repository loading functionality (such as | |
391 | reading the ``.hg/requires`` and ``.hg/hgrc`` files), validates that |
|
391 | reading the ``.hg/requires`` and ``.hg/hgrc`` files), validates that | |
392 | the repository can be opened, derives a type suitable for representing |
|
392 | the repository can be opened, derives a type suitable for representing | |
393 | that repository, and returns an instance of it. |
|
393 | that repository, and returns an instance of it. | |
394 |
|
394 | |||
395 | The returned object conforms to the ``repository.completelocalrepository`` |
|
395 | The returned object conforms to the ``repository.completelocalrepository`` | |
396 | interface. |
|
396 | interface. | |
397 |
|
397 | |||
398 | The repository type is derived by calling a series of factory functions |
|
398 | The repository type is derived by calling a series of factory functions | |
399 | for each aspect/interface of the final repository. These are defined by |
|
399 | for each aspect/interface of the final repository. These are defined by | |
400 | ``REPO_INTERFACES``. |
|
400 | ``REPO_INTERFACES``. | |
401 |
|
401 | |||
402 | Each factory function is called to produce a type implementing a specific |
|
402 | Each factory function is called to produce a type implementing a specific | |
403 | interface. The cumulative list of returned types will be combined into a |
|
403 | interface. The cumulative list of returned types will be combined into a | |
404 | new type and that type will be instantiated to represent the local |
|
404 | new type and that type will be instantiated to represent the local | |
405 | repository. |
|
405 | repository. | |
406 |
|
406 | |||
407 | The factory functions each receive various state that may be consulted |
|
407 | The factory functions each receive various state that may be consulted | |
408 | as part of deriving a type. |
|
408 | as part of deriving a type. | |
409 |
|
409 | |||
410 | Extensions should wrap these factory functions to customize repository type |
|
410 | Extensions should wrap these factory functions to customize repository type | |
411 | creation. Note that an extension's wrapped function may be called even if |
|
411 | creation. Note that an extension's wrapped function may be called even if | |
412 | that extension is not loaded for the repo being constructed. Extensions |
|
412 | that extension is not loaded for the repo being constructed. Extensions | |
413 | should check if their ``__name__`` appears in the |
|
413 | should check if their ``__name__`` appears in the | |
414 | ``extensionmodulenames`` set passed to the factory function and no-op if |
|
414 | ``extensionmodulenames`` set passed to the factory function and no-op if | |
415 | not. |
|
415 | not. | |
416 | """ |
|
416 | """ | |
417 | ui = baseui.copy() |
|
417 | ui = baseui.copy() | |
418 | # Prevent copying repo configuration. |
|
418 | # Prevent copying repo configuration. | |
419 | ui.copy = baseui.copy |
|
419 | ui.copy = baseui.copy | |
420 |
|
420 | |||
421 | # Working directory VFS rooted at repository root. |
|
421 | # Working directory VFS rooted at repository root. | |
422 | wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True) |
|
422 | wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True) | |
423 |
|
423 | |||
424 | # Main VFS for .hg/ directory. |
|
424 | # Main VFS for .hg/ directory. | |
425 | hgpath = wdirvfs.join(b'.hg') |
|
425 | hgpath = wdirvfs.join(b'.hg') | |
426 | hgvfs = vfsmod.vfs(hgpath, cacheaudited=True) |
|
426 | hgvfs = vfsmod.vfs(hgpath, cacheaudited=True) | |
427 |
|
427 | |||
428 | # The .hg/ path should exist and should be a directory. All other |
|
428 | # The .hg/ path should exist and should be a directory. All other | |
429 | # cases are errors. |
|
429 | # cases are errors. | |
430 | if not hgvfs.isdir(): |
|
430 | if not hgvfs.isdir(): | |
431 | try: |
|
431 | try: | |
432 | hgvfs.stat() |
|
432 | hgvfs.stat() | |
433 | except OSError as e: |
|
433 | except OSError as e: | |
434 | if e.errno != errno.ENOENT: |
|
434 | if e.errno != errno.ENOENT: | |
435 | raise |
|
435 | raise | |
436 |
|
436 | |||
437 | raise error.RepoError(_(b'repository %s not found') % path) |
|
437 | raise error.RepoError(_(b'repository %s not found') % path) | |
438 |
|
438 | |||
439 | # .hg/requires file contains a newline-delimited list of |
|
439 | # .hg/requires file contains a newline-delimited list of | |
440 | # features/capabilities the opener (us) must have in order to use |
|
440 | # features/capabilities the opener (us) must have in order to use | |
441 | # the repository. This file was introduced in Mercurial 0.9.2, |
|
441 | # the repository. This file was introduced in Mercurial 0.9.2, | |
442 | # which means very old repositories may not have one. We assume |
|
442 | # which means very old repositories may not have one. We assume | |
443 | # a missing file translates to no requirements. |
|
443 | # a missing file translates to no requirements. | |
444 | try: |
|
444 | try: | |
445 | requirements = set(hgvfs.read(b'requires').splitlines()) |
|
445 | requirements = set(hgvfs.read(b'requires').splitlines()) | |
446 | except IOError as e: |
|
446 | except IOError as e: | |
447 | if e.errno != errno.ENOENT: |
|
447 | if e.errno != errno.ENOENT: | |
448 | raise |
|
448 | raise | |
449 | requirements = set() |
|
449 | requirements = set() | |
450 |
|
450 | |||
451 | # The .hg/hgrc file may load extensions or contain config options |
|
451 | # The .hg/hgrc file may load extensions or contain config options | |
452 | # that influence repository construction. Attempt to load it and |
|
452 | # that influence repository construction. Attempt to load it and | |
453 | # process any new extensions that it may have pulled in. |
|
453 | # process any new extensions that it may have pulled in. | |
454 | if loadhgrc(ui, wdirvfs, hgvfs, requirements): |
|
454 | if loadhgrc(ui, wdirvfs, hgvfs, requirements): | |
455 | afterhgrcload(ui, wdirvfs, hgvfs, requirements) |
|
455 | afterhgrcload(ui, wdirvfs, hgvfs, requirements) | |
456 | extensions.loadall(ui) |
|
456 | extensions.loadall(ui) | |
457 | extensions.populateui(ui) |
|
457 | extensions.populateui(ui) | |
458 |
|
458 | |||
459 | # Set of module names of extensions loaded for this repository. |
|
459 | # Set of module names of extensions loaded for this repository. | |
460 | extensionmodulenames = {m.__name__ for n, m in extensions.extensions(ui)} |
|
460 | extensionmodulenames = {m.__name__ for n, m in extensions.extensions(ui)} | |
461 |
|
461 | |||
462 | supportedrequirements = gathersupportedrequirements(ui) |
|
462 | supportedrequirements = gathersupportedrequirements(ui) | |
463 |
|
463 | |||
464 | # We first validate the requirements are known. |
|
464 | # We first validate the requirements are known. | |
465 | ensurerequirementsrecognized(requirements, supportedrequirements) |
|
465 | ensurerequirementsrecognized(requirements, supportedrequirements) | |
466 |
|
466 | |||
467 | # Then we validate that the known set is reasonable to use together. |
|
467 | # Then we validate that the known set is reasonable to use together. | |
468 | ensurerequirementscompatible(ui, requirements) |
|
468 | ensurerequirementscompatible(ui, requirements) | |
469 |
|
469 | |||
470 | # TODO there are unhandled edge cases related to opening repositories with |
|
470 | # TODO there are unhandled edge cases related to opening repositories with | |
471 | # shared storage. If storage is shared, we should also test for requirements |
|
471 | # shared storage. If storage is shared, we should also test for requirements | |
472 | # compatibility in the pointed-to repo. This entails loading the .hg/hgrc in |
|
472 | # compatibility in the pointed-to repo. This entails loading the .hg/hgrc in | |
473 | # that repo, as that repo may load extensions needed to open it. This is a |
|
473 | # that repo, as that repo may load extensions needed to open it. This is a | |
474 | # bit complicated because we don't want the other hgrc to overwrite settings |
|
474 | # bit complicated because we don't want the other hgrc to overwrite settings | |
475 | # in this hgrc. |
|
475 | # in this hgrc. | |
476 | # |
|
476 | # | |
477 | # This bug is somewhat mitigated by the fact that we copy the .hg/requires |
|
477 | # This bug is somewhat mitigated by the fact that we copy the .hg/requires | |
478 | # file when sharing repos. But if a requirement is added after the share is |
|
478 | # file when sharing repos. But if a requirement is added after the share is | |
479 | # performed, thereby introducing a new requirement for the opener, we may |
|
479 | # performed, thereby introducing a new requirement for the opener, we may | |
480 | # will not see that and could encounter a run-time error interacting with |
|
480 | # will not see that and could encounter a run-time error interacting with | |
481 | # that shared store since it has an unknown-to-us requirement. |
|
481 | # that shared store since it has an unknown-to-us requirement. | |
482 |
|
482 | |||
483 | # At this point, we know we should be capable of opening the repository. |
|
483 | # At this point, we know we should be capable of opening the repository. | |
484 | # Now get on with doing that. |
|
484 | # Now get on with doing that. | |
485 |
|
485 | |||
486 | features = set() |
|
486 | features = set() | |
487 |
|
487 | |||
488 | # The "store" part of the repository holds versioned data. How it is |
|
488 | # The "store" part of the repository holds versioned data. How it is | |
489 | # accessed is determined by various requirements. The ``shared`` or |
|
489 | # accessed is determined by various requirements. The ``shared`` or | |
490 | # ``relshared`` requirements indicate the store lives in the path contained |
|
490 | # ``relshared`` requirements indicate the store lives in the path contained | |
491 | # in the ``.hg/sharedpath`` file. This is an absolute path for |
|
491 | # in the ``.hg/sharedpath`` file. This is an absolute path for | |
492 | # ``shared`` and relative to ``.hg/`` for ``relshared``. |
|
492 | # ``shared`` and relative to ``.hg/`` for ``relshared``. | |
493 | if b'shared' in requirements or b'relshared' in requirements: |
|
493 | if b'shared' in requirements or b'relshared' in requirements: | |
494 | sharedpath = hgvfs.read(b'sharedpath').rstrip(b'\n') |
|
494 | sharedpath = hgvfs.read(b'sharedpath').rstrip(b'\n') | |
495 | if b'relshared' in requirements: |
|
495 | if b'relshared' in requirements: | |
496 | sharedpath = hgvfs.join(sharedpath) |
|
496 | sharedpath = hgvfs.join(sharedpath) | |
497 |
|
497 | |||
498 | sharedvfs = vfsmod.vfs(sharedpath, realpath=True) |
|
498 | sharedvfs = vfsmod.vfs(sharedpath, realpath=True) | |
499 |
|
499 | |||
500 | if not sharedvfs.exists(): |
|
500 | if not sharedvfs.exists(): | |
501 | raise error.RepoError(_(b'.hg/sharedpath points to nonexistent ' |
|
501 | raise error.RepoError(_(b'.hg/sharedpath points to nonexistent ' | |
502 | b'directory %s') % sharedvfs.base) |
|
502 | b'directory %s') % sharedvfs.base) | |
503 |
|
503 | |||
504 | features.add(repository.REPO_FEATURE_SHARED_STORAGE) |
|
504 | features.add(repository.REPO_FEATURE_SHARED_STORAGE) | |
505 |
|
505 | |||
506 | storebasepath = sharedvfs.base |
|
506 | storebasepath = sharedvfs.base | |
507 | cachepath = sharedvfs.join(b'cache') |
|
507 | cachepath = sharedvfs.join(b'cache') | |
508 | else: |
|
508 | else: | |
509 | storebasepath = hgvfs.base |
|
509 | storebasepath = hgvfs.base | |
510 | cachepath = hgvfs.join(b'cache') |
|
510 | cachepath = hgvfs.join(b'cache') | |
511 | wcachepath = hgvfs.join(b'wcache') |
|
511 | wcachepath = hgvfs.join(b'wcache') | |
512 |
|
512 | |||
513 |
|
513 | |||
514 | # The store has changed over time and the exact layout is dictated by |
|
514 | # The store has changed over time and the exact layout is dictated by | |
515 | # requirements. The store interface abstracts differences across all |
|
515 | # requirements. The store interface abstracts differences across all | |
516 | # of them. |
|
516 | # of them. | |
517 | store = makestore(requirements, storebasepath, |
|
517 | store = makestore(requirements, storebasepath, | |
518 | lambda base: vfsmod.vfs(base, cacheaudited=True)) |
|
518 | lambda base: vfsmod.vfs(base, cacheaudited=True)) | |
519 | hgvfs.createmode = store.createmode |
|
519 | hgvfs.createmode = store.createmode | |
520 |
|
520 | |||
521 | storevfs = store.vfs |
|
521 | storevfs = store.vfs | |
522 | storevfs.options = resolvestorevfsoptions(ui, requirements, features) |
|
522 | storevfs.options = resolvestorevfsoptions(ui, requirements, features) | |
523 |
|
523 | |||
524 | # The cache vfs is used to manage cache files. |
|
524 | # The cache vfs is used to manage cache files. | |
525 | cachevfs = vfsmod.vfs(cachepath, cacheaudited=True) |
|
525 | cachevfs = vfsmod.vfs(cachepath, cacheaudited=True) | |
526 | cachevfs.createmode = store.createmode |
|
526 | cachevfs.createmode = store.createmode | |
527 | # The cache vfs is used to manage cache files related to the working copy |
|
527 | # The cache vfs is used to manage cache files related to the working copy | |
528 | wcachevfs = vfsmod.vfs(wcachepath, cacheaudited=True) |
|
528 | wcachevfs = vfsmod.vfs(wcachepath, cacheaudited=True) | |
529 | wcachevfs.createmode = store.createmode |
|
529 | wcachevfs.createmode = store.createmode | |
530 |
|
530 | |||
531 | # Now resolve the type for the repository object. We do this by repeatedly |
|
531 | # Now resolve the type for the repository object. We do this by repeatedly | |
532 | # calling a factory function to produces types for specific aspects of the |
|
532 | # calling a factory function to produces types for specific aspects of the | |
533 | # repo's operation. The aggregate returned types are used as base classes |
|
533 | # repo's operation. The aggregate returned types are used as base classes | |
534 | # for a dynamically-derived type, which will represent our new repository. |
|
534 | # for a dynamically-derived type, which will represent our new repository. | |
535 |
|
535 | |||
536 | bases = [] |
|
536 | bases = [] | |
537 | extrastate = {} |
|
537 | extrastate = {} | |
538 |
|
538 | |||
539 | for iface, fn in REPO_INTERFACES: |
|
539 | for iface, fn in REPO_INTERFACES: | |
540 | # We pass all potentially useful state to give extensions tons of |
|
540 | # We pass all potentially useful state to give extensions tons of | |
541 | # flexibility. |
|
541 | # flexibility. | |
542 | typ = fn()(ui=ui, |
|
542 | typ = fn()(ui=ui, | |
543 | intents=intents, |
|
543 | intents=intents, | |
544 | requirements=requirements, |
|
544 | requirements=requirements, | |
545 | features=features, |
|
545 | features=features, | |
546 | wdirvfs=wdirvfs, |
|
546 | wdirvfs=wdirvfs, | |
547 | hgvfs=hgvfs, |
|
547 | hgvfs=hgvfs, | |
548 | store=store, |
|
548 | store=store, | |
549 | storevfs=storevfs, |
|
549 | storevfs=storevfs, | |
550 | storeoptions=storevfs.options, |
|
550 | storeoptions=storevfs.options, | |
551 | cachevfs=cachevfs, |
|
551 | cachevfs=cachevfs, | |
552 | wcachevfs=wcachevfs, |
|
552 | wcachevfs=wcachevfs, | |
553 | extensionmodulenames=extensionmodulenames, |
|
553 | extensionmodulenames=extensionmodulenames, | |
554 | extrastate=extrastate, |
|
554 | extrastate=extrastate, | |
555 | baseclasses=bases) |
|
555 | baseclasses=bases) | |
556 |
|
556 | |||
557 | if not isinstance(typ, type): |
|
557 | if not isinstance(typ, type): | |
558 | raise error.ProgrammingError('unable to construct type for %s' % |
|
558 | raise error.ProgrammingError('unable to construct type for %s' % | |
559 | iface) |
|
559 | iface) | |
560 |
|
560 | |||
561 | bases.append(typ) |
|
561 | bases.append(typ) | |
562 |
|
562 | |||
563 | # type() allows you to use characters in type names that wouldn't be |
|
563 | # type() allows you to use characters in type names that wouldn't be | |
564 | # recognized as Python symbols in source code. We abuse that to add |
|
564 | # recognized as Python symbols in source code. We abuse that to add | |
565 | # rich information about our constructed repo. |
|
565 | # rich information about our constructed repo. | |
566 | name = pycompat.sysstr(b'derivedrepo:%s<%s>' % ( |
|
566 | name = pycompat.sysstr(b'derivedrepo:%s<%s>' % ( | |
567 | wdirvfs.base, |
|
567 | wdirvfs.base, | |
568 | b','.join(sorted(requirements)))) |
|
568 | b','.join(sorted(requirements)))) | |
569 |
|
569 | |||
570 | cls = type(name, tuple(bases), {}) |
|
570 | cls = type(name, tuple(bases), {}) | |
571 |
|
571 | |||
572 | return cls( |
|
572 | return cls( | |
573 | baseui=baseui, |
|
573 | baseui=baseui, | |
574 | ui=ui, |
|
574 | ui=ui, | |
575 | origroot=path, |
|
575 | origroot=path, | |
576 | wdirvfs=wdirvfs, |
|
576 | wdirvfs=wdirvfs, | |
577 | hgvfs=hgvfs, |
|
577 | hgvfs=hgvfs, | |
578 | requirements=requirements, |
|
578 | requirements=requirements, | |
579 | supportedrequirements=supportedrequirements, |
|
579 | supportedrequirements=supportedrequirements, | |
580 | sharedpath=storebasepath, |
|
580 | sharedpath=storebasepath, | |
581 | store=store, |
|
581 | store=store, | |
582 | cachevfs=cachevfs, |
|
582 | cachevfs=cachevfs, | |
583 | wcachevfs=wcachevfs, |
|
583 | wcachevfs=wcachevfs, | |
584 | features=features, |
|
584 | features=features, | |
585 | intents=intents) |
|
585 | intents=intents) | |
586 |
|
586 | |||
587 | def loadhgrc(ui, wdirvfs, hgvfs, requirements): |
|
587 | def loadhgrc(ui, wdirvfs, hgvfs, requirements): | |
588 | """Load hgrc files/content into a ui instance. |
|
588 | """Load hgrc files/content into a ui instance. | |
589 |
|
589 | |||
590 | This is called during repository opening to load any additional |
|
590 | This is called during repository opening to load any additional | |
591 | config files or settings relevant to the current repository. |
|
591 | config files or settings relevant to the current repository. | |
592 |
|
592 | |||
593 | Returns a bool indicating whether any additional configs were loaded. |
|
593 | Returns a bool indicating whether any additional configs were loaded. | |
594 |
|
594 | |||
595 | Extensions should monkeypatch this function to modify how per-repo |
|
595 | Extensions should monkeypatch this function to modify how per-repo | |
596 | configs are loaded. For example, an extension may wish to pull in |
|
596 | configs are loaded. For example, an extension may wish to pull in | |
597 | configs from alternate files or sources. |
|
597 | configs from alternate files or sources. | |
598 | """ |
|
598 | """ | |
599 | try: |
|
599 | try: | |
600 | ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base) |
|
600 | ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base) | |
601 | return True |
|
601 | return True | |
602 | except IOError: |
|
602 | except IOError: | |
603 | return False |
|
603 | return False | |
604 |
|
604 | |||
605 | def afterhgrcload(ui, wdirvfs, hgvfs, requirements): |
|
605 | def afterhgrcload(ui, wdirvfs, hgvfs, requirements): | |
606 | """Perform additional actions after .hg/hgrc is loaded. |
|
606 | """Perform additional actions after .hg/hgrc is loaded. | |
607 |
|
607 | |||
608 | This function is called during repository loading immediately after |
|
608 | This function is called during repository loading immediately after | |
609 | the .hg/hgrc file is loaded and before per-repo extensions are loaded. |
|
609 | the .hg/hgrc file is loaded and before per-repo extensions are loaded. | |
610 |
|
610 | |||
611 | The function can be used to validate configs, automatically add |
|
611 | The function can be used to validate configs, automatically add | |
612 | options (including extensions) based on requirements, etc. |
|
612 | options (including extensions) based on requirements, etc. | |
613 | """ |
|
613 | """ | |
614 |
|
614 | |||
615 | # Map of requirements to list of extensions to load automatically when |
|
615 | # Map of requirements to list of extensions to load automatically when | |
616 | # requirement is present. |
|
616 | # requirement is present. | |
617 | autoextensions = { |
|
617 | autoextensions = { | |
618 | b'largefiles': [b'largefiles'], |
|
618 | b'largefiles': [b'largefiles'], | |
619 | b'lfs': [b'lfs'], |
|
619 | b'lfs': [b'lfs'], | |
620 | } |
|
620 | } | |
621 |
|
621 | |||
622 | for requirement, names in sorted(autoextensions.items()): |
|
622 | for requirement, names in sorted(autoextensions.items()): | |
623 | if requirement not in requirements: |
|
623 | if requirement not in requirements: | |
624 | continue |
|
624 | continue | |
625 |
|
625 | |||
626 | for name in names: |
|
626 | for name in names: | |
627 | if not ui.hasconfig(b'extensions', name): |
|
627 | if not ui.hasconfig(b'extensions', name): | |
628 | ui.setconfig(b'extensions', name, b'', source='autoload') |
|
628 | ui.setconfig(b'extensions', name, b'', source='autoload') | |
629 |
|
629 | |||
630 | def gathersupportedrequirements(ui): |
|
630 | def gathersupportedrequirements(ui): | |
631 | """Determine the complete set of recognized requirements.""" |
|
631 | """Determine the complete set of recognized requirements.""" | |
632 | # Start with all requirements supported by this file. |
|
632 | # Start with all requirements supported by this file. | |
633 | supported = set(localrepository._basesupported) |
|
633 | supported = set(localrepository._basesupported) | |
634 |
|
634 | |||
635 | # Execute ``featuresetupfuncs`` entries if they belong to an extension |
|
635 | # Execute ``featuresetupfuncs`` entries if they belong to an extension | |
636 | # relevant to this ui instance. |
|
636 | # relevant to this ui instance. | |
637 | modules = {m.__name__ for n, m in extensions.extensions(ui)} |
|
637 | modules = {m.__name__ for n, m in extensions.extensions(ui)} | |
638 |
|
638 | |||
639 | for fn in featuresetupfuncs: |
|
639 | for fn in featuresetupfuncs: | |
640 | if fn.__module__ in modules: |
|
640 | if fn.__module__ in modules: | |
641 | fn(ui, supported) |
|
641 | fn(ui, supported) | |
642 |
|
642 | |||
643 | # Add derived requirements from registered compression engines. |
|
643 | # Add derived requirements from registered compression engines. | |
644 | for name in util.compengines: |
|
644 | for name in util.compengines: | |
645 | engine = util.compengines[name] |
|
645 | engine = util.compengines[name] | |
646 | if engine.available() and engine.revlogheader(): |
|
646 | if engine.available() and engine.revlogheader(): | |
647 | supported.add(b'exp-compression-%s' % name) |
|
647 | supported.add(b'exp-compression-%s' % name) | |
648 | if engine.name() == 'zstd': |
|
648 | if engine.name() == 'zstd': | |
649 | supported.add(b'revlog-compression-zstd') |
|
649 | supported.add(b'revlog-compression-zstd') | |
650 |
|
650 | |||
651 | return supported |
|
651 | return supported | |
652 |
|
652 | |||
653 | def ensurerequirementsrecognized(requirements, supported): |
|
653 | def ensurerequirementsrecognized(requirements, supported): | |
654 | """Validate that a set of local requirements is recognized. |
|
654 | """Validate that a set of local requirements is recognized. | |
655 |
|
655 | |||
656 | Receives a set of requirements. Raises an ``error.RepoError`` if there |
|
656 | Receives a set of requirements. Raises an ``error.RepoError`` if there | |
657 | exists any requirement in that set that currently loaded code doesn't |
|
657 | exists any requirement in that set that currently loaded code doesn't | |
658 | recognize. |
|
658 | recognize. | |
659 |
|
659 | |||
660 | Returns a set of supported requirements. |
|
660 | Returns a set of supported requirements. | |
661 | """ |
|
661 | """ | |
662 | missing = set() |
|
662 | missing = set() | |
663 |
|
663 | |||
664 | for requirement in requirements: |
|
664 | for requirement in requirements: | |
665 | if requirement in supported: |
|
665 | if requirement in supported: | |
666 | continue |
|
666 | continue | |
667 |
|
667 | |||
668 | if not requirement or not requirement[0:1].isalnum(): |
|
668 | if not requirement or not requirement[0:1].isalnum(): | |
669 | raise error.RequirementError(_(b'.hg/requires file is corrupt')) |
|
669 | raise error.RequirementError(_(b'.hg/requires file is corrupt')) | |
670 |
|
670 | |||
671 | missing.add(requirement) |
|
671 | missing.add(requirement) | |
672 |
|
672 | |||
673 | if missing: |
|
673 | if missing: | |
674 | raise error.RequirementError( |
|
674 | raise error.RequirementError( | |
675 | _(b'repository requires features unknown to this Mercurial: %s') % |
|
675 | _(b'repository requires features unknown to this Mercurial: %s') % | |
676 | b' '.join(sorted(missing)), |
|
676 | b' '.join(sorted(missing)), | |
677 | hint=_(b'see https://mercurial-scm.org/wiki/MissingRequirement ' |
|
677 | hint=_(b'see https://mercurial-scm.org/wiki/MissingRequirement ' | |
678 | b'for more information')) |
|
678 | b'for more information')) | |
679 |
|
679 | |||
680 | def ensurerequirementscompatible(ui, requirements): |
|
680 | def ensurerequirementscompatible(ui, requirements): | |
681 | """Validates that a set of recognized requirements is mutually compatible. |
|
681 | """Validates that a set of recognized requirements is mutually compatible. | |
682 |
|
682 | |||
683 | Some requirements may not be compatible with others or require |
|
683 | Some requirements may not be compatible with others or require | |
684 | config options that aren't enabled. This function is called during |
|
684 | config options that aren't enabled. This function is called during | |
685 | repository opening to ensure that the set of requirements needed |
|
685 | repository opening to ensure that the set of requirements needed | |
686 | to open a repository is sane and compatible with config options. |
|
686 | to open a repository is sane and compatible with config options. | |
687 |
|
687 | |||
688 | Extensions can monkeypatch this function to perform additional |
|
688 | Extensions can monkeypatch this function to perform additional | |
689 | checking. |
|
689 | checking. | |
690 |
|
690 | |||
691 | ``error.RepoError`` should be raised on failure. |
|
691 | ``error.RepoError`` should be raised on failure. | |
692 | """ |
|
692 | """ | |
693 | if b'exp-sparse' in requirements and not sparse.enabled: |
|
693 | if b'exp-sparse' in requirements and not sparse.enabled: | |
694 | raise error.RepoError(_(b'repository is using sparse feature but ' |
|
694 | raise error.RepoError(_(b'repository is using sparse feature but ' | |
695 | b'sparse is not enabled; enable the ' |
|
695 | b'sparse is not enabled; enable the ' | |
696 | b'"sparse" extensions to access')) |
|
696 | b'"sparse" extensions to access')) | |
697 |
|
697 | |||
698 | def makestore(requirements, path, vfstype): |
|
698 | def makestore(requirements, path, vfstype): | |
699 | """Construct a storage object for a repository.""" |
|
699 | """Construct a storage object for a repository.""" | |
700 | if b'store' in requirements: |
|
700 | if b'store' in requirements: | |
701 | if b'fncache' in requirements: |
|
701 | if b'fncache' in requirements: | |
702 | return storemod.fncachestore(path, vfstype, |
|
702 | return storemod.fncachestore(path, vfstype, | |
703 | b'dotencode' in requirements) |
|
703 | b'dotencode' in requirements) | |
704 |
|
704 | |||
705 | return storemod.encodedstore(path, vfstype) |
|
705 | return storemod.encodedstore(path, vfstype) | |
706 |
|
706 | |||
707 | return storemod.basicstore(path, vfstype) |
|
707 | return storemod.basicstore(path, vfstype) | |
708 |
|
708 | |||
709 | def resolvestorevfsoptions(ui, requirements, features): |
|
709 | def resolvestorevfsoptions(ui, requirements, features): | |
710 | """Resolve the options to pass to the store vfs opener. |
|
710 | """Resolve the options to pass to the store vfs opener. | |
711 |
|
711 | |||
712 | The returned dict is used to influence behavior of the storage layer. |
|
712 | The returned dict is used to influence behavior of the storage layer. | |
713 | """ |
|
713 | """ | |
714 | options = {} |
|
714 | options = {} | |
715 |
|
715 | |||
716 | if b'treemanifest' in requirements: |
|
716 | if b'treemanifest' in requirements: | |
717 | options[b'treemanifest'] = True |
|
717 | options[b'treemanifest'] = True | |
718 |
|
718 | |||
719 | # experimental config: format.manifestcachesize |
|
719 | # experimental config: format.manifestcachesize | |
720 | manifestcachesize = ui.configint(b'format', b'manifestcachesize') |
|
720 | manifestcachesize = ui.configint(b'format', b'manifestcachesize') | |
721 | if manifestcachesize is not None: |
|
721 | if manifestcachesize is not None: | |
722 | options[b'manifestcachesize'] = manifestcachesize |
|
722 | options[b'manifestcachesize'] = manifestcachesize | |
723 |
|
723 | |||
724 | # In the absence of another requirement superseding a revlog-related |
|
724 | # In the absence of another requirement superseding a revlog-related | |
725 | # requirement, we have to assume the repo is using revlog version 0. |
|
725 | # requirement, we have to assume the repo is using revlog version 0. | |
726 | # This revlog format is super old and we don't bother trying to parse |
|
726 | # This revlog format is super old and we don't bother trying to parse | |
727 | # opener options for it because those options wouldn't do anything |
|
727 | # opener options for it because those options wouldn't do anything | |
728 | # meaningful on such old repos. |
|
728 | # meaningful on such old repos. | |
729 | if b'revlogv1' in requirements or REVLOGV2_REQUIREMENT in requirements: |
|
729 | if b'revlogv1' in requirements or REVLOGV2_REQUIREMENT in requirements: | |
730 | options.update(resolverevlogstorevfsoptions(ui, requirements, features)) |
|
730 | options.update(resolverevlogstorevfsoptions(ui, requirements, features)) | |
731 |
|
731 | |||
732 | return options |
|
732 | return options | |
733 |
|
733 | |||
734 | def resolverevlogstorevfsoptions(ui, requirements, features): |
|
734 | def resolverevlogstorevfsoptions(ui, requirements, features): | |
735 | """Resolve opener options specific to revlogs.""" |
|
735 | """Resolve opener options specific to revlogs.""" | |
736 |
|
736 | |||
737 | options = {} |
|
737 | options = {} | |
738 | options[b'flagprocessors'] = {} |
|
738 | options[b'flagprocessors'] = {} | |
739 |
|
739 | |||
740 | if b'revlogv1' in requirements: |
|
740 | if b'revlogv1' in requirements: | |
741 | options[b'revlogv1'] = True |
|
741 | options[b'revlogv1'] = True | |
742 | if REVLOGV2_REQUIREMENT in requirements: |
|
742 | if REVLOGV2_REQUIREMENT in requirements: | |
743 | options[b'revlogv2'] = True |
|
743 | options[b'revlogv2'] = True | |
744 |
|
744 | |||
745 | if b'generaldelta' in requirements: |
|
745 | if b'generaldelta' in requirements: | |
746 | options[b'generaldelta'] = True |
|
746 | options[b'generaldelta'] = True | |
747 |
|
747 | |||
748 | # experimental config: format.chunkcachesize |
|
748 | # experimental config: format.chunkcachesize | |
749 | chunkcachesize = ui.configint(b'format', b'chunkcachesize') |
|
749 | chunkcachesize = ui.configint(b'format', b'chunkcachesize') | |
750 | if chunkcachesize is not None: |
|
750 | if chunkcachesize is not None: | |
751 | options[b'chunkcachesize'] = chunkcachesize |
|
751 | options[b'chunkcachesize'] = chunkcachesize | |
752 |
|
752 | |||
753 | deltabothparents = ui.configbool(b'storage', |
|
753 | deltabothparents = ui.configbool(b'storage', | |
754 | b'revlog.optimize-delta-parent-choice') |
|
754 | b'revlog.optimize-delta-parent-choice') | |
755 | options[b'deltabothparents'] = deltabothparents |
|
755 | options[b'deltabothparents'] = deltabothparents | |
756 |
|
756 | |||
757 | lazydelta = ui.configbool(b'storage', b'revlog.reuse-external-delta') |
|
757 | lazydelta = ui.configbool(b'storage', b'revlog.reuse-external-delta') | |
758 | lazydeltabase = False |
|
758 | lazydeltabase = False | |
759 | if lazydelta: |
|
759 | if lazydelta: | |
760 | lazydeltabase = ui.configbool(b'storage', |
|
760 | lazydeltabase = ui.configbool(b'storage', | |
761 | b'revlog.reuse-external-delta-parent') |
|
761 | b'revlog.reuse-external-delta-parent') | |
762 | if lazydeltabase is None: |
|
762 | if lazydeltabase is None: | |
763 | lazydeltabase = not scmutil.gddeltaconfig(ui) |
|
763 | lazydeltabase = not scmutil.gddeltaconfig(ui) | |
764 | options[b'lazydelta'] = lazydelta |
|
764 | options[b'lazydelta'] = lazydelta | |
765 | options[b'lazydeltabase'] = lazydeltabase |
|
765 | options[b'lazydeltabase'] = lazydeltabase | |
766 |
|
766 | |||
767 | chainspan = ui.configbytes(b'experimental', b'maxdeltachainspan') |
|
767 | chainspan = ui.configbytes(b'experimental', b'maxdeltachainspan') | |
768 | if 0 <= chainspan: |
|
768 | if 0 <= chainspan: | |
769 | options[b'maxdeltachainspan'] = chainspan |
|
769 | options[b'maxdeltachainspan'] = chainspan | |
770 |
|
770 | |||
771 | mmapindexthreshold = ui.configbytes(b'experimental', |
|
771 | mmapindexthreshold = ui.configbytes(b'experimental', | |
772 | b'mmapindexthreshold') |
|
772 | b'mmapindexthreshold') | |
773 | if mmapindexthreshold is not None: |
|
773 | if mmapindexthreshold is not None: | |
774 | options[b'mmapindexthreshold'] = mmapindexthreshold |
|
774 | options[b'mmapindexthreshold'] = mmapindexthreshold | |
775 |
|
775 | |||
776 | withsparseread = ui.configbool(b'experimental', b'sparse-read') |
|
776 | withsparseread = ui.configbool(b'experimental', b'sparse-read') | |
777 | srdensitythres = float(ui.config(b'experimental', |
|
777 | srdensitythres = float(ui.config(b'experimental', | |
778 | b'sparse-read.density-threshold')) |
|
778 | b'sparse-read.density-threshold')) | |
779 | srmingapsize = ui.configbytes(b'experimental', |
|
779 | srmingapsize = ui.configbytes(b'experimental', | |
780 | b'sparse-read.min-gap-size') |
|
780 | b'sparse-read.min-gap-size') | |
781 | options[b'with-sparse-read'] = withsparseread |
|
781 | options[b'with-sparse-read'] = withsparseread | |
782 | options[b'sparse-read-density-threshold'] = srdensitythres |
|
782 | options[b'sparse-read-density-threshold'] = srdensitythres | |
783 | options[b'sparse-read-min-gap-size'] = srmingapsize |
|
783 | options[b'sparse-read-min-gap-size'] = srmingapsize | |
784 |
|
784 | |||
785 | sparserevlog = SPARSEREVLOG_REQUIREMENT in requirements |
|
785 | sparserevlog = SPARSEREVLOG_REQUIREMENT in requirements | |
786 | options[b'sparse-revlog'] = sparserevlog |
|
786 | options[b'sparse-revlog'] = sparserevlog | |
787 | if sparserevlog: |
|
787 | if sparserevlog: | |
788 | options[b'generaldelta'] = True |
|
788 | options[b'generaldelta'] = True | |
789 |
|
789 | |||
790 | maxchainlen = None |
|
790 | maxchainlen = None | |
791 | if sparserevlog: |
|
791 | if sparserevlog: | |
792 | maxchainlen = revlogconst.SPARSE_REVLOG_MAX_CHAIN_LENGTH |
|
792 | maxchainlen = revlogconst.SPARSE_REVLOG_MAX_CHAIN_LENGTH | |
793 | # experimental config: format.maxchainlen |
|
793 | # experimental config: format.maxchainlen | |
794 | maxchainlen = ui.configint(b'format', b'maxchainlen', maxchainlen) |
|
794 | maxchainlen = ui.configint(b'format', b'maxchainlen', maxchainlen) | |
795 | if maxchainlen is not None: |
|
795 | if maxchainlen is not None: | |
796 | options[b'maxchainlen'] = maxchainlen |
|
796 | options[b'maxchainlen'] = maxchainlen | |
797 |
|
797 | |||
798 | for r in requirements: |
|
798 | for r in requirements: | |
799 | # we allow multiple compression engine requirement to co-exist because |
|
799 | # we allow multiple compression engine requirement to co-exist because | |
800 | # strickly speaking, revlog seems to support mixed compression style. |
|
800 | # strickly speaking, revlog seems to support mixed compression style. | |
801 | # |
|
801 | # | |
802 | # The compression used for new entries will be "the last one" |
|
802 | # The compression used for new entries will be "the last one" | |
803 | prefix = r.startswith |
|
803 | prefix = r.startswith | |
804 | if prefix('revlog-compression-') or prefix('exp-compression-'): |
|
804 | if prefix('revlog-compression-') or prefix('exp-compression-'): | |
805 | options[b'compengine'] = r.split('-', 2)[2] |
|
805 | options[b'compengine'] = r.split('-', 2)[2] | |
806 |
|
806 | |||
807 | options[b'zlib.level'] = ui.configint(b'storage', b'revlog.zlib.level') |
|
807 | options[b'zlib.level'] = ui.configint(b'storage', b'revlog.zlib.level') | |
808 | if options[b'zlib.level'] is not None: |
|
808 | if options[b'zlib.level'] is not None: | |
809 | if not (0 <= options[b'zlib.level'] <= 9): |
|
809 | if not (0 <= options[b'zlib.level'] <= 9): | |
810 | msg = _('invalid value for `storage.revlog.zlib.level` config: %d') |
|
810 | msg = _('invalid value for `storage.revlog.zlib.level` config: %d') | |
811 | raise error.Abort(msg % options[b'zlib.level']) |
|
811 | raise error.Abort(msg % options[b'zlib.level']) | |
812 | options[b'zstd.level'] = ui.configint(b'storage', b'revlog.zstd.level') |
|
812 | options[b'zstd.level'] = ui.configint(b'storage', b'revlog.zstd.level') | |
813 | if options[b'zstd.level'] is not None: |
|
813 | if options[b'zstd.level'] is not None: | |
814 | if not (0 <= options[b'zstd.level'] <= 22): |
|
814 | if not (0 <= options[b'zstd.level'] <= 22): | |
815 | msg = _('invalid value for `storage.revlog.zstd.level` config: %d') |
|
815 | msg = _('invalid value for `storage.revlog.zstd.level` config: %d') | |
816 | raise error.Abort(msg % options[b'zstd.level']) |
|
816 | raise error.Abort(msg % options[b'zstd.level']) | |
817 |
|
817 | |||
818 | if repository.NARROW_REQUIREMENT in requirements: |
|
818 | if repository.NARROW_REQUIREMENT in requirements: | |
819 | options[b'enableellipsis'] = True |
|
819 | options[b'enableellipsis'] = True | |
820 |
|
820 | |||
821 | return options |
|
821 | return options | |
822 |
|
822 | |||
823 | def makemain(**kwargs): |
|
823 | def makemain(**kwargs): | |
824 | """Produce a type conforming to ``ilocalrepositorymain``.""" |
|
824 | """Produce a type conforming to ``ilocalrepositorymain``.""" | |
825 | return localrepository |
|
825 | return localrepository | |
826 |
|
826 | |||
827 | @interfaceutil.implementer(repository.ilocalrepositoryfilestorage) |
|
827 | @interfaceutil.implementer(repository.ilocalrepositoryfilestorage) | |
828 | class revlogfilestorage(object): |
|
828 | class revlogfilestorage(object): | |
829 | """File storage when using revlogs.""" |
|
829 | """File storage when using revlogs.""" | |
830 |
|
830 | |||
831 | def file(self, path): |
|
831 | def file(self, path): | |
832 | if path[0] == b'/': |
|
832 | if path[0] == b'/': | |
833 | path = path[1:] |
|
833 | path = path[1:] | |
834 |
|
834 | |||
835 | return filelog.filelog(self.svfs, path) |
|
835 | return filelog.filelog(self.svfs, path) | |
836 |
|
836 | |||
837 | @interfaceutil.implementer(repository.ilocalrepositoryfilestorage) |
|
837 | @interfaceutil.implementer(repository.ilocalrepositoryfilestorage) | |
838 | class revlognarrowfilestorage(object): |
|
838 | class revlognarrowfilestorage(object): | |
839 | """File storage when using revlogs and narrow files.""" |
|
839 | """File storage when using revlogs and narrow files.""" | |
840 |
|
840 | |||
841 | def file(self, path): |
|
841 | def file(self, path): | |
842 | if path[0] == b'/': |
|
842 | if path[0] == b'/': | |
843 | path = path[1:] |
|
843 | path = path[1:] | |
844 |
|
844 | |||
845 | return filelog.narrowfilelog(self.svfs, path, self._storenarrowmatch) |
|
845 | return filelog.narrowfilelog(self.svfs, path, self._storenarrowmatch) | |
846 |
|
846 | |||
847 | def makefilestorage(requirements, features, **kwargs): |
|
847 | def makefilestorage(requirements, features, **kwargs): | |
848 | """Produce a type conforming to ``ilocalrepositoryfilestorage``.""" |
|
848 | """Produce a type conforming to ``ilocalrepositoryfilestorage``.""" | |
849 | features.add(repository.REPO_FEATURE_REVLOG_FILE_STORAGE) |
|
849 | features.add(repository.REPO_FEATURE_REVLOG_FILE_STORAGE) | |
850 | features.add(repository.REPO_FEATURE_STREAM_CLONE) |
|
850 | features.add(repository.REPO_FEATURE_STREAM_CLONE) | |
851 |
|
851 | |||
852 | if repository.NARROW_REQUIREMENT in requirements: |
|
852 | if repository.NARROW_REQUIREMENT in requirements: | |
853 | return revlognarrowfilestorage |
|
853 | return revlognarrowfilestorage | |
854 | else: |
|
854 | else: | |
855 | return revlogfilestorage |
|
855 | return revlogfilestorage | |
856 |
|
856 | |||
857 | # List of repository interfaces and factory functions for them. Each |
|
857 | # List of repository interfaces and factory functions for them. Each | |
858 | # will be called in order during ``makelocalrepository()`` to iteratively |
|
858 | # will be called in order during ``makelocalrepository()`` to iteratively | |
859 | # derive the final type for a local repository instance. We capture the |
|
859 | # derive the final type for a local repository instance. We capture the | |
860 | # function as a lambda so we don't hold a reference and the module-level |
|
860 | # function as a lambda so we don't hold a reference and the module-level | |
861 | # functions can be wrapped. |
|
861 | # functions can be wrapped. | |
862 | REPO_INTERFACES = [ |
|
862 | REPO_INTERFACES = [ | |
863 | (repository.ilocalrepositorymain, lambda: makemain), |
|
863 | (repository.ilocalrepositorymain, lambda: makemain), | |
864 | (repository.ilocalrepositoryfilestorage, lambda: makefilestorage), |
|
864 | (repository.ilocalrepositoryfilestorage, lambda: makefilestorage), | |
865 | ] |
|
865 | ] | |
866 |
|
866 | |||
867 | @interfaceutil.implementer(repository.ilocalrepositorymain) |
|
867 | @interfaceutil.implementer(repository.ilocalrepositorymain) | |
868 | class localrepository(object): |
|
868 | class localrepository(object): | |
869 | """Main class for representing local repositories. |
|
869 | """Main class for representing local repositories. | |
870 |
|
870 | |||
871 | All local repositories are instances of this class. |
|
871 | All local repositories are instances of this class. | |
872 |
|
872 | |||
873 | Constructed on its own, instances of this class are not usable as |
|
873 | Constructed on its own, instances of this class are not usable as | |
874 | repository objects. To obtain a usable repository object, call |
|
874 | repository objects. To obtain a usable repository object, call | |
875 | ``hg.repository()``, ``localrepo.instance()``, or |
|
875 | ``hg.repository()``, ``localrepo.instance()``, or | |
876 | ``localrepo.makelocalrepository()``. The latter is the lowest-level. |
|
876 | ``localrepo.makelocalrepository()``. The latter is the lowest-level. | |
877 | ``instance()`` adds support for creating new repositories. |
|
877 | ``instance()`` adds support for creating new repositories. | |
878 | ``hg.repository()`` adds more extension integration, including calling |
|
878 | ``hg.repository()`` adds more extension integration, including calling | |
879 | ``reposetup()``. Generally speaking, ``hg.repository()`` should be |
|
879 | ``reposetup()``. Generally speaking, ``hg.repository()`` should be | |
880 | used. |
|
880 | used. | |
881 | """ |
|
881 | """ | |
882 |
|
882 | |||
883 | # obsolete experimental requirements: |
|
883 | # obsolete experimental requirements: | |
884 | # - manifestv2: An experimental new manifest format that allowed |
|
884 | # - manifestv2: An experimental new manifest format that allowed | |
885 | # for stem compression of long paths. Experiment ended up not |
|
885 | # for stem compression of long paths. Experiment ended up not | |
886 | # being successful (repository sizes went up due to worse delta |
|
886 | # being successful (repository sizes went up due to worse delta | |
887 | # chains), and the code was deleted in 4.6. |
|
887 | # chains), and the code was deleted in 4.6. | |
888 | supportedformats = { |
|
888 | supportedformats = { | |
889 | 'revlogv1', |
|
889 | 'revlogv1', | |
890 | 'generaldelta', |
|
890 | 'generaldelta', | |
891 | 'treemanifest', |
|
891 | 'treemanifest', | |
892 | REVLOGV2_REQUIREMENT, |
|
892 | REVLOGV2_REQUIREMENT, | |
893 | SPARSEREVLOG_REQUIREMENT, |
|
893 | SPARSEREVLOG_REQUIREMENT, | |
894 | } |
|
894 | } | |
895 | _basesupported = supportedformats | { |
|
895 | _basesupported = supportedformats | { | |
896 | 'store', |
|
896 | 'store', | |
897 | 'fncache', |
|
897 | 'fncache', | |
898 | 'shared', |
|
898 | 'shared', | |
899 | 'relshared', |
|
899 | 'relshared', | |
900 | 'dotencode', |
|
900 | 'dotencode', | |
901 | 'exp-sparse', |
|
901 | 'exp-sparse', | |
902 | 'internal-phase' |
|
902 | 'internal-phase' | |
903 | } |
|
903 | } | |
904 |
|
904 | |||
905 | # list of prefix for file which can be written without 'wlock' |
|
905 | # list of prefix for file which can be written without 'wlock' | |
906 | # Extensions should extend this list when needed |
|
906 | # Extensions should extend this list when needed | |
907 | _wlockfreeprefix = { |
|
907 | _wlockfreeprefix = { | |
908 | # We migh consider requiring 'wlock' for the next |
|
908 | # We migh consider requiring 'wlock' for the next | |
909 | # two, but pretty much all the existing code assume |
|
909 | # two, but pretty much all the existing code assume | |
910 | # wlock is not needed so we keep them excluded for |
|
910 | # wlock is not needed so we keep them excluded for | |
911 | # now. |
|
911 | # now. | |
912 | 'hgrc', |
|
912 | 'hgrc', | |
913 | 'requires', |
|
913 | 'requires', | |
914 | # XXX cache is a complicatged business someone |
|
914 | # XXX cache is a complicatged business someone | |
915 | # should investigate this in depth at some point |
|
915 | # should investigate this in depth at some point | |
916 | 'cache/', |
|
916 | 'cache/', | |
917 | # XXX shouldn't be dirstate covered by the wlock? |
|
917 | # XXX shouldn't be dirstate covered by the wlock? | |
918 | 'dirstate', |
|
918 | 'dirstate', | |
919 | # XXX bisect was still a bit too messy at the time |
|
919 | # XXX bisect was still a bit too messy at the time | |
920 | # this changeset was introduced. Someone should fix |
|
920 | # this changeset was introduced. Someone should fix | |
921 | # the remainig bit and drop this line |
|
921 | # the remainig bit and drop this line | |
922 | 'bisect.state', |
|
922 | 'bisect.state', | |
923 | } |
|
923 | } | |
924 |
|
924 | |||
925 | def __init__(self, baseui, ui, origroot, wdirvfs, hgvfs, requirements, |
|
925 | def __init__(self, baseui, ui, origroot, wdirvfs, hgvfs, requirements, | |
926 | supportedrequirements, sharedpath, store, cachevfs, wcachevfs, |
|
926 | supportedrequirements, sharedpath, store, cachevfs, wcachevfs, | |
927 | features, intents=None): |
|
927 | features, intents=None): | |
928 | """Create a new local repository instance. |
|
928 | """Create a new local repository instance. | |
929 |
|
929 | |||
930 | Most callers should use ``hg.repository()``, ``localrepo.instance()``, |
|
930 | Most callers should use ``hg.repository()``, ``localrepo.instance()``, | |
931 | or ``localrepo.makelocalrepository()`` for obtaining a new repository |
|
931 | or ``localrepo.makelocalrepository()`` for obtaining a new repository | |
932 | object. |
|
932 | object. | |
933 |
|
933 | |||
934 | Arguments: |
|
934 | Arguments: | |
935 |
|
935 | |||
936 | baseui |
|
936 | baseui | |
937 | ``ui.ui`` instance that ``ui`` argument was based off of. |
|
937 | ``ui.ui`` instance that ``ui`` argument was based off of. | |
938 |
|
938 | |||
939 | ui |
|
939 | ui | |
940 | ``ui.ui`` instance for use by the repository. |
|
940 | ``ui.ui`` instance for use by the repository. | |
941 |
|
941 | |||
942 | origroot |
|
942 | origroot | |
943 | ``bytes`` path to working directory root of this repository. |
|
943 | ``bytes`` path to working directory root of this repository. | |
944 |
|
944 | |||
945 | wdirvfs |
|
945 | wdirvfs | |
946 | ``vfs.vfs`` rooted at the working directory. |
|
946 | ``vfs.vfs`` rooted at the working directory. | |
947 |
|
947 | |||
948 | hgvfs |
|
948 | hgvfs | |
949 | ``vfs.vfs`` rooted at .hg/ |
|
949 | ``vfs.vfs`` rooted at .hg/ | |
950 |
|
950 | |||
951 | requirements |
|
951 | requirements | |
952 | ``set`` of bytestrings representing repository opening requirements. |
|
952 | ``set`` of bytestrings representing repository opening requirements. | |
953 |
|
953 | |||
954 | supportedrequirements |
|
954 | supportedrequirements | |
955 | ``set`` of bytestrings representing repository requirements that we |
|
955 | ``set`` of bytestrings representing repository requirements that we | |
956 | know how to open. May be a supetset of ``requirements``. |
|
956 | know how to open. May be a supetset of ``requirements``. | |
957 |
|
957 | |||
958 | sharedpath |
|
958 | sharedpath | |
959 | ``bytes`` Defining path to storage base directory. Points to a |
|
959 | ``bytes`` Defining path to storage base directory. Points to a | |
960 | ``.hg/`` directory somewhere. |
|
960 | ``.hg/`` directory somewhere. | |
961 |
|
961 | |||
962 | store |
|
962 | store | |
963 | ``store.basicstore`` (or derived) instance providing access to |
|
963 | ``store.basicstore`` (or derived) instance providing access to | |
964 | versioned storage. |
|
964 | versioned storage. | |
965 |
|
965 | |||
966 | cachevfs |
|
966 | cachevfs | |
967 | ``vfs.vfs`` used for cache files. |
|
967 | ``vfs.vfs`` used for cache files. | |
968 |
|
968 | |||
969 | wcachevfs |
|
969 | wcachevfs | |
970 | ``vfs.vfs`` used for cache files related to the working copy. |
|
970 | ``vfs.vfs`` used for cache files related to the working copy. | |
971 |
|
971 | |||
972 | features |
|
972 | features | |
973 | ``set`` of bytestrings defining features/capabilities of this |
|
973 | ``set`` of bytestrings defining features/capabilities of this | |
974 | instance. |
|
974 | instance. | |
975 |
|
975 | |||
976 | intents |
|
976 | intents | |
977 | ``set`` of system strings indicating what this repo will be used |
|
977 | ``set`` of system strings indicating what this repo will be used | |
978 | for. |
|
978 | for. | |
979 | """ |
|
979 | """ | |
980 | self.baseui = baseui |
|
980 | self.baseui = baseui | |
981 | self.ui = ui |
|
981 | self.ui = ui | |
982 | self.origroot = origroot |
|
982 | self.origroot = origroot | |
983 | # vfs rooted at working directory. |
|
983 | # vfs rooted at working directory. | |
984 | self.wvfs = wdirvfs |
|
984 | self.wvfs = wdirvfs | |
985 | self.root = wdirvfs.base |
|
985 | self.root = wdirvfs.base | |
986 | # vfs rooted at .hg/. Used to access most non-store paths. |
|
986 | # vfs rooted at .hg/. Used to access most non-store paths. | |
987 | self.vfs = hgvfs |
|
987 | self.vfs = hgvfs | |
988 | self.path = hgvfs.base |
|
988 | self.path = hgvfs.base | |
989 | self.requirements = requirements |
|
989 | self.requirements = requirements | |
990 | self.supported = supportedrequirements |
|
990 | self.supported = supportedrequirements | |
991 | self.sharedpath = sharedpath |
|
991 | self.sharedpath = sharedpath | |
992 | self.store = store |
|
992 | self.store = store | |
993 | self.cachevfs = cachevfs |
|
993 | self.cachevfs = cachevfs | |
994 | self.wcachevfs = wcachevfs |
|
994 | self.wcachevfs = wcachevfs | |
995 | self.features = features |
|
995 | self.features = features | |
996 |
|
996 | |||
997 | self.filtername = None |
|
997 | self.filtername = None | |
998 |
|
998 | |||
999 | if (self.ui.configbool('devel', 'all-warnings') or |
|
999 | if (self.ui.configbool('devel', 'all-warnings') or | |
1000 | self.ui.configbool('devel', 'check-locks')): |
|
1000 | self.ui.configbool('devel', 'check-locks')): | |
1001 | self.vfs.audit = self._getvfsward(self.vfs.audit) |
|
1001 | self.vfs.audit = self._getvfsward(self.vfs.audit) | |
1002 | # A list of callback to shape the phase if no data were found. |
|
1002 | # A list of callback to shape the phase if no data were found. | |
1003 | # Callback are in the form: func(repo, roots) --> processed root. |
|
1003 | # Callback are in the form: func(repo, roots) --> processed root. | |
1004 | # This list it to be filled by extension during repo setup |
|
1004 | # This list it to be filled by extension during repo setup | |
1005 | self._phasedefaults = [] |
|
1005 | self._phasedefaults = [] | |
1006 |
|
1006 | |||
1007 | color.setup(self.ui) |
|
1007 | color.setup(self.ui) | |
1008 |
|
1008 | |||
1009 | self.spath = self.store.path |
|
1009 | self.spath = self.store.path | |
1010 | self.svfs = self.store.vfs |
|
1010 | self.svfs = self.store.vfs | |
1011 | self.sjoin = self.store.join |
|
1011 | self.sjoin = self.store.join | |
1012 | if (self.ui.configbool('devel', 'all-warnings') or |
|
1012 | if (self.ui.configbool('devel', 'all-warnings') or | |
1013 | self.ui.configbool('devel', 'check-locks')): |
|
1013 | self.ui.configbool('devel', 'check-locks')): | |
1014 | if util.safehasattr(self.svfs, 'vfs'): # this is filtervfs |
|
1014 | if util.safehasattr(self.svfs, 'vfs'): # this is filtervfs | |
1015 | self.svfs.vfs.audit = self._getsvfsward(self.svfs.vfs.audit) |
|
1015 | self.svfs.vfs.audit = self._getsvfsward(self.svfs.vfs.audit) | |
1016 | else: # standard vfs |
|
1016 | else: # standard vfs | |
1017 | self.svfs.audit = self._getsvfsward(self.svfs.audit) |
|
1017 | self.svfs.audit = self._getsvfsward(self.svfs.audit) | |
1018 |
|
1018 | |||
1019 | self._dirstatevalidatewarned = False |
|
1019 | self._dirstatevalidatewarned = False | |
1020 |
|
1020 | |||
1021 | self._branchcaches = branchmap.BranchMapCache() |
|
1021 | self._branchcaches = branchmap.BranchMapCache() | |
1022 | self._revbranchcache = None |
|
1022 | self._revbranchcache = None | |
1023 | self._filterpats = {} |
|
1023 | self._filterpats = {} | |
1024 | self._datafilters = {} |
|
1024 | self._datafilters = {} | |
1025 | self._transref = self._lockref = self._wlockref = None |
|
1025 | self._transref = self._lockref = self._wlockref = None | |
1026 |
|
1026 | |||
1027 | # A cache for various files under .hg/ that tracks file changes, |
|
1027 | # A cache for various files under .hg/ that tracks file changes, | |
1028 | # (used by the filecache decorator) |
|
1028 | # (used by the filecache decorator) | |
1029 | # |
|
1029 | # | |
1030 | # Maps a property name to its util.filecacheentry |
|
1030 | # Maps a property name to its util.filecacheentry | |
1031 | self._filecache = {} |
|
1031 | self._filecache = {} | |
1032 |
|
1032 | |||
1033 | # hold sets of revision to be filtered |
|
1033 | # hold sets of revision to be filtered | |
1034 | # should be cleared when something might have changed the filter value: |
|
1034 | # should be cleared when something might have changed the filter value: | |
1035 | # - new changesets, |
|
1035 | # - new changesets, | |
1036 | # - phase change, |
|
1036 | # - phase change, | |
1037 | # - new obsolescence marker, |
|
1037 | # - new obsolescence marker, | |
1038 | # - working directory parent change, |
|
1038 | # - working directory parent change, | |
1039 | # - bookmark changes |
|
1039 | # - bookmark changes | |
1040 | self.filteredrevcache = {} |
|
1040 | self.filteredrevcache = {} | |
1041 |
|
1041 | |||
1042 | # post-dirstate-status hooks |
|
1042 | # post-dirstate-status hooks | |
1043 | self._postdsstatus = [] |
|
1043 | self._postdsstatus = [] | |
1044 |
|
1044 | |||
1045 | # generic mapping between names and nodes |
|
1045 | # generic mapping between names and nodes | |
1046 | self.names = namespaces.namespaces() |
|
1046 | self.names = namespaces.namespaces() | |
1047 |
|
1047 | |||
1048 | # Key to signature value. |
|
1048 | # Key to signature value. | |
1049 | self._sparsesignaturecache = {} |
|
1049 | self._sparsesignaturecache = {} | |
1050 | # Signature to cached matcher instance. |
|
1050 | # Signature to cached matcher instance. | |
1051 | self._sparsematchercache = {} |
|
1051 | self._sparsematchercache = {} | |
1052 |
|
1052 | |||
1053 | self._extrafilterid = repoview.extrafilter(ui) |
|
1053 | self._extrafilterid = repoview.extrafilter(ui) | |
1054 |
|
1054 | |||
1055 | def _getvfsward(self, origfunc): |
|
1055 | def _getvfsward(self, origfunc): | |
1056 | """build a ward for self.vfs""" |
|
1056 | """build a ward for self.vfs""" | |
1057 | rref = weakref.ref(self) |
|
1057 | rref = weakref.ref(self) | |
1058 | def checkvfs(path, mode=None): |
|
1058 | def checkvfs(path, mode=None): | |
1059 | ret = origfunc(path, mode=mode) |
|
1059 | ret = origfunc(path, mode=mode) | |
1060 | repo = rref() |
|
1060 | repo = rref() | |
1061 | if (repo is None |
|
1061 | if (repo is None | |
1062 | or not util.safehasattr(repo, '_wlockref') |
|
1062 | or not util.safehasattr(repo, '_wlockref') | |
1063 | or not util.safehasattr(repo, '_lockref')): |
|
1063 | or not util.safehasattr(repo, '_lockref')): | |
1064 | return |
|
1064 | return | |
1065 | if mode in (None, 'r', 'rb'): |
|
1065 | if mode in (None, 'r', 'rb'): | |
1066 | return |
|
1066 | return | |
1067 | if path.startswith(repo.path): |
|
1067 | if path.startswith(repo.path): | |
1068 | # truncate name relative to the repository (.hg) |
|
1068 | # truncate name relative to the repository (.hg) | |
1069 | path = path[len(repo.path) + 1:] |
|
1069 | path = path[len(repo.path) + 1:] | |
1070 | if path.startswith('cache/'): |
|
1070 | if path.startswith('cache/'): | |
1071 | msg = 'accessing cache with vfs instead of cachevfs: "%s"' |
|
1071 | msg = 'accessing cache with vfs instead of cachevfs: "%s"' | |
1072 | repo.ui.develwarn(msg % path, stacklevel=3, config="cache-vfs") |
|
1072 | repo.ui.develwarn(msg % path, stacklevel=3, config="cache-vfs") | |
1073 | if path.startswith('journal.') or path.startswith('undo.'): |
|
1073 | if path.startswith('journal.') or path.startswith('undo.'): | |
1074 | # journal is covered by 'lock' |
|
1074 | # journal is covered by 'lock' | |
1075 | if repo._currentlock(repo._lockref) is None: |
|
1075 | if repo._currentlock(repo._lockref) is None: | |
1076 | repo.ui.develwarn('write with no lock: "%s"' % path, |
|
1076 | repo.ui.develwarn('write with no lock: "%s"' % path, | |
1077 | stacklevel=3, config='check-locks') |
|
1077 | stacklevel=3, config='check-locks') | |
1078 | elif repo._currentlock(repo._wlockref) is None: |
|
1078 | elif repo._currentlock(repo._wlockref) is None: | |
1079 | # rest of vfs files are covered by 'wlock' |
|
1079 | # rest of vfs files are covered by 'wlock' | |
1080 | # |
|
1080 | # | |
1081 | # exclude special files |
|
1081 | # exclude special files | |
1082 | for prefix in self._wlockfreeprefix: |
|
1082 | for prefix in self._wlockfreeprefix: | |
1083 | if path.startswith(prefix): |
|
1083 | if path.startswith(prefix): | |
1084 | return |
|
1084 | return | |
1085 | repo.ui.develwarn('write with no wlock: "%s"' % path, |
|
1085 | repo.ui.develwarn('write with no wlock: "%s"' % path, | |
1086 | stacklevel=3, config='check-locks') |
|
1086 | stacklevel=3, config='check-locks') | |
1087 | return ret |
|
1087 | return ret | |
1088 | return checkvfs |
|
1088 | return checkvfs | |
1089 |
|
1089 | |||
1090 | def _getsvfsward(self, origfunc): |
|
1090 | def _getsvfsward(self, origfunc): | |
1091 | """build a ward for self.svfs""" |
|
1091 | """build a ward for self.svfs""" | |
1092 | rref = weakref.ref(self) |
|
1092 | rref = weakref.ref(self) | |
1093 | def checksvfs(path, mode=None): |
|
1093 | def checksvfs(path, mode=None): | |
1094 | ret = origfunc(path, mode=mode) |
|
1094 | ret = origfunc(path, mode=mode) | |
1095 | repo = rref() |
|
1095 | repo = rref() | |
1096 | if repo is None or not util.safehasattr(repo, '_lockref'): |
|
1096 | if repo is None or not util.safehasattr(repo, '_lockref'): | |
1097 | return |
|
1097 | return | |
1098 | if mode in (None, 'r', 'rb'): |
|
1098 | if mode in (None, 'r', 'rb'): | |
1099 | return |
|
1099 | return | |
1100 | if path.startswith(repo.sharedpath): |
|
1100 | if path.startswith(repo.sharedpath): | |
1101 | # truncate name relative to the repository (.hg) |
|
1101 | # truncate name relative to the repository (.hg) | |
1102 | path = path[len(repo.sharedpath) + 1:] |
|
1102 | path = path[len(repo.sharedpath) + 1:] | |
1103 | if repo._currentlock(repo._lockref) is None: |
|
1103 | if repo._currentlock(repo._lockref) is None: | |
1104 | repo.ui.develwarn('write with no lock: "%s"' % path, |
|
1104 | repo.ui.develwarn('write with no lock: "%s"' % path, | |
1105 | stacklevel=4) |
|
1105 | stacklevel=4) | |
1106 | return ret |
|
1106 | return ret | |
1107 | return checksvfs |
|
1107 | return checksvfs | |
1108 |
|
1108 | |||
1109 | def close(self): |
|
1109 | def close(self): | |
1110 | self._writecaches() |
|
1110 | self._writecaches() | |
1111 |
|
1111 | |||
1112 | def _writecaches(self): |
|
1112 | def _writecaches(self): | |
1113 | if self._revbranchcache: |
|
1113 | if self._revbranchcache: | |
1114 | self._revbranchcache.write() |
|
1114 | self._revbranchcache.write() | |
1115 |
|
1115 | |||
1116 | def _restrictcapabilities(self, caps): |
|
1116 | def _restrictcapabilities(self, caps): | |
1117 | if self.ui.configbool('experimental', 'bundle2-advertise'): |
|
1117 | if self.ui.configbool('experimental', 'bundle2-advertise'): | |
1118 | caps = set(caps) |
|
1118 | caps = set(caps) | |
1119 | capsblob = bundle2.encodecaps(bundle2.getrepocaps(self, |
|
1119 | capsblob = bundle2.encodecaps(bundle2.getrepocaps(self, | |
1120 | role='client')) |
|
1120 | role='client')) | |
1121 | caps.add('bundle2=' + urlreq.quote(capsblob)) |
|
1121 | caps.add('bundle2=' + urlreq.quote(capsblob)) | |
1122 | return caps |
|
1122 | return caps | |
1123 |
|
1123 | |||
1124 | def _writerequirements(self): |
|
1124 | def _writerequirements(self): | |
1125 | scmutil.writerequires(self.vfs, self.requirements) |
|
1125 | scmutil.writerequires(self.vfs, self.requirements) | |
1126 |
|
1126 | |||
1127 | # Don't cache auditor/nofsauditor, or you'll end up with reference cycle: |
|
1127 | # Don't cache auditor/nofsauditor, or you'll end up with reference cycle: | |
1128 | # self -> auditor -> self._checknested -> self |
|
1128 | # self -> auditor -> self._checknested -> self | |
1129 |
|
1129 | |||
1130 | @property |
|
1130 | @property | |
1131 | def auditor(self): |
|
1131 | def auditor(self): | |
1132 | # This is only used by context.workingctx.match in order to |
|
1132 | # This is only used by context.workingctx.match in order to | |
1133 | # detect files in subrepos. |
|
1133 | # detect files in subrepos. | |
1134 | return pathutil.pathauditor(self.root, callback=self._checknested) |
|
1134 | return pathutil.pathauditor(self.root, callback=self._checknested) | |
1135 |
|
1135 | |||
1136 | @property |
|
1136 | @property | |
1137 | def nofsauditor(self): |
|
1137 | def nofsauditor(self): | |
1138 | # This is only used by context.basectx.match in order to detect |
|
1138 | # This is only used by context.basectx.match in order to detect | |
1139 | # files in subrepos. |
|
1139 | # files in subrepos. | |
1140 | return pathutil.pathauditor(self.root, callback=self._checknested, |
|
1140 | return pathutil.pathauditor(self.root, callback=self._checknested, | |
1141 | realfs=False, cached=True) |
|
1141 | realfs=False, cached=True) | |
1142 |
|
1142 | |||
1143 | def _checknested(self, path): |
|
1143 | def _checknested(self, path): | |
1144 | """Determine if path is a legal nested repository.""" |
|
1144 | """Determine if path is a legal nested repository.""" | |
1145 | if not path.startswith(self.root): |
|
1145 | if not path.startswith(self.root): | |
1146 | return False |
|
1146 | return False | |
1147 | subpath = path[len(self.root) + 1:] |
|
1147 | subpath = path[len(self.root) + 1:] | |
1148 | normsubpath = util.pconvert(subpath) |
|
1148 | normsubpath = util.pconvert(subpath) | |
1149 |
|
1149 | |||
1150 | # XXX: Checking against the current working copy is wrong in |
|
1150 | # XXX: Checking against the current working copy is wrong in | |
1151 | # the sense that it can reject things like |
|
1151 | # the sense that it can reject things like | |
1152 | # |
|
1152 | # | |
1153 | # $ hg cat -r 10 sub/x.txt |
|
1153 | # $ hg cat -r 10 sub/x.txt | |
1154 | # |
|
1154 | # | |
1155 | # if sub/ is no longer a subrepository in the working copy |
|
1155 | # if sub/ is no longer a subrepository in the working copy | |
1156 | # parent revision. |
|
1156 | # parent revision. | |
1157 | # |
|
1157 | # | |
1158 | # However, it can of course also allow things that would have |
|
1158 | # However, it can of course also allow things that would have | |
1159 | # been rejected before, such as the above cat command if sub/ |
|
1159 | # been rejected before, such as the above cat command if sub/ | |
1160 | # is a subrepository now, but was a normal directory before. |
|
1160 | # is a subrepository now, but was a normal directory before. | |
1161 | # The old path auditor would have rejected by mistake since it |
|
1161 | # The old path auditor would have rejected by mistake since it | |
1162 | # panics when it sees sub/.hg/. |
|
1162 | # panics when it sees sub/.hg/. | |
1163 | # |
|
1163 | # | |
1164 | # All in all, checking against the working copy seems sensible |
|
1164 | # All in all, checking against the working copy seems sensible | |
1165 | # since we want to prevent access to nested repositories on |
|
1165 | # since we want to prevent access to nested repositories on | |
1166 | # the filesystem *now*. |
|
1166 | # the filesystem *now*. | |
1167 | ctx = self[None] |
|
1167 | ctx = self[None] | |
1168 | parts = util.splitpath(subpath) |
|
1168 | parts = util.splitpath(subpath) | |
1169 | while parts: |
|
1169 | while parts: | |
1170 | prefix = '/'.join(parts) |
|
1170 | prefix = '/'.join(parts) | |
1171 | if prefix in ctx.substate: |
|
1171 | if prefix in ctx.substate: | |
1172 | if prefix == normsubpath: |
|
1172 | if prefix == normsubpath: | |
1173 | return True |
|
1173 | return True | |
1174 | else: |
|
1174 | else: | |
1175 | sub = ctx.sub(prefix) |
|
1175 | sub = ctx.sub(prefix) | |
1176 | return sub.checknested(subpath[len(prefix) + 1:]) |
|
1176 | return sub.checknested(subpath[len(prefix) + 1:]) | |
1177 | else: |
|
1177 | else: | |
1178 | parts.pop() |
|
1178 | parts.pop() | |
1179 | return False |
|
1179 | return False | |
1180 |
|
1180 | |||
1181 | def peer(self): |
|
1181 | def peer(self): | |
1182 | return localpeer(self) # not cached to avoid reference cycle |
|
1182 | return localpeer(self) # not cached to avoid reference cycle | |
1183 |
|
1183 | |||
1184 | def unfiltered(self): |
|
1184 | def unfiltered(self): | |
1185 | """Return unfiltered version of the repository |
|
1185 | """Return unfiltered version of the repository | |
1186 |
|
1186 | |||
1187 | Intended to be overwritten by filtered repo.""" |
|
1187 | Intended to be overwritten by filtered repo.""" | |
1188 | return self |
|
1188 | return self | |
1189 |
|
1189 | |||
1190 | def filtered(self, name, visibilityexceptions=None): |
|
1190 | def filtered(self, name, visibilityexceptions=None): | |
1191 | """Return a filtered version of a repository |
|
1191 | """Return a filtered version of a repository | |
1192 |
|
1192 | |||
1193 | The `name` parameter is the identifier of the requested view. This |
|
1193 | The `name` parameter is the identifier of the requested view. This | |
1194 | will return a repoview object set "exactly" to the specified view. |
|
1194 | will return a repoview object set "exactly" to the specified view. | |
1195 |
|
1195 | |||
1196 | This function does not apply recursive filtering to a repository. For |
|
1196 | This function does not apply recursive filtering to a repository. For | |
1197 | example calling `repo.filtered("served")` will return a repoview using |
|
1197 | example calling `repo.filtered("served")` will return a repoview using | |
1198 | the "served" view, regardless of the initial view used by `repo`. |
|
1198 | the "served" view, regardless of the initial view used by `repo`. | |
1199 |
|
1199 | |||
1200 | In other word, there is always only one level of `repoview` "filtering". |
|
1200 | In other word, there is always only one level of `repoview` "filtering". | |
1201 | """ |
|
1201 | """ | |
1202 | if self._extrafilterid is not None and '%' not in name: |
|
1202 | if self._extrafilterid is not None and '%' not in name: | |
1203 | name = name + '%' + self._extrafilterid |
|
1203 | name = name + '%' + self._extrafilterid | |
1204 |
|
1204 | |||
1205 | cls = repoview.newtype(self.unfiltered().__class__) |
|
1205 | cls = repoview.newtype(self.unfiltered().__class__) | |
1206 | return cls(self, name, visibilityexceptions) |
|
1206 | return cls(self, name, visibilityexceptions) | |
1207 |
|
1207 | |||
1208 | @repofilecache('bookmarks', 'bookmarks.current') |
|
1208 | @repofilecache('bookmarks', 'bookmarks.current') | |
1209 | def _bookmarks(self): |
|
1209 | def _bookmarks(self): | |
1210 | return bookmarks.bmstore(self) |
|
1210 | return bookmarks.bmstore(self) | |
1211 |
|
1211 | |||
1212 | @property |
|
1212 | @property | |
1213 | def _activebookmark(self): |
|
1213 | def _activebookmark(self): | |
1214 | return self._bookmarks.active |
|
1214 | return self._bookmarks.active | |
1215 |
|
1215 | |||
1216 | # _phasesets depend on changelog. what we need is to call |
|
1216 | # _phasesets depend on changelog. what we need is to call | |
1217 | # _phasecache.invalidate() if '00changelog.i' was changed, but it |
|
1217 | # _phasecache.invalidate() if '00changelog.i' was changed, but it | |
1218 | # can't be easily expressed in filecache mechanism. |
|
1218 | # can't be easily expressed in filecache mechanism. | |
1219 | @storecache('phaseroots', '00changelog.i') |
|
1219 | @storecache('phaseroots', '00changelog.i') | |
1220 | def _phasecache(self): |
|
1220 | def _phasecache(self): | |
1221 | return phases.phasecache(self, self._phasedefaults) |
|
1221 | return phases.phasecache(self, self._phasedefaults) | |
1222 |
|
1222 | |||
1223 | @storecache('obsstore') |
|
1223 | @storecache('obsstore') | |
1224 | def obsstore(self): |
|
1224 | def obsstore(self): | |
1225 | return obsolete.makestore(self.ui, self) |
|
1225 | return obsolete.makestore(self.ui, self) | |
1226 |
|
1226 | |||
1227 | @storecache('00changelog.i') |
|
1227 | @storecache('00changelog.i') | |
1228 | def changelog(self): |
|
1228 | def changelog(self): | |
1229 | return changelog.changelog(self.svfs, |
|
1229 | return changelog.changelog(self.svfs, | |
1230 | trypending=txnutil.mayhavepending(self.root)) |
|
1230 | trypending=txnutil.mayhavepending(self.root)) | |
1231 |
|
1231 | |||
1232 | @storecache('00manifest.i') |
|
1232 | @storecache('00manifest.i') | |
1233 | def manifestlog(self): |
|
1233 | def manifestlog(self): | |
1234 | rootstore = manifest.manifestrevlog(self.svfs) |
|
1234 | rootstore = manifest.manifestrevlog(self.svfs) | |
1235 | return manifest.manifestlog(self.svfs, self, rootstore, |
|
1235 | return manifest.manifestlog(self.svfs, self, rootstore, | |
1236 | self._storenarrowmatch) |
|
1236 | self._storenarrowmatch) | |
1237 |
|
1237 | |||
1238 | @repofilecache('dirstate') |
|
1238 | @repofilecache('dirstate') | |
1239 | def dirstate(self): |
|
1239 | def dirstate(self): | |
1240 | return self._makedirstate() |
|
1240 | return self._makedirstate() | |
1241 |
|
1241 | |||
1242 | def _makedirstate(self): |
|
1242 | def _makedirstate(self): | |
1243 | """Extension point for wrapping the dirstate per-repo.""" |
|
1243 | """Extension point for wrapping the dirstate per-repo.""" | |
1244 | sparsematchfn = lambda: sparse.matcher(self) |
|
1244 | sparsematchfn = lambda: sparse.matcher(self) | |
1245 |
|
1245 | |||
1246 | return dirstate.dirstate(self.vfs, self.ui, self.root, |
|
1246 | return dirstate.dirstate(self.vfs, self.ui, self.root, | |
1247 | self._dirstatevalidate, sparsematchfn) |
|
1247 | self._dirstatevalidate, sparsematchfn) | |
1248 |
|
1248 | |||
1249 | def _dirstatevalidate(self, node): |
|
1249 | def _dirstatevalidate(self, node): | |
1250 | try: |
|
1250 | try: | |
1251 | self.changelog.rev(node) |
|
1251 | self.changelog.rev(node) | |
1252 | return node |
|
1252 | return node | |
1253 | except error.LookupError: |
|
1253 | except error.LookupError: | |
1254 | if not self._dirstatevalidatewarned: |
|
1254 | if not self._dirstatevalidatewarned: | |
1255 | self._dirstatevalidatewarned = True |
|
1255 | self._dirstatevalidatewarned = True | |
1256 | self.ui.warn(_("warning: ignoring unknown" |
|
1256 | self.ui.warn(_("warning: ignoring unknown" | |
1257 | " working parent %s!\n") % short(node)) |
|
1257 | " working parent %s!\n") % short(node)) | |
1258 | return nullid |
|
1258 | return nullid | |
1259 |
|
1259 | |||
1260 | @storecache(narrowspec.FILENAME) |
|
1260 | @storecache(narrowspec.FILENAME) | |
1261 | def narrowpats(self): |
|
1261 | def narrowpats(self): | |
1262 | """matcher patterns for this repository's narrowspec |
|
1262 | """matcher patterns for this repository's narrowspec | |
1263 |
|
1263 | |||
1264 | A tuple of (includes, excludes). |
|
1264 | A tuple of (includes, excludes). | |
1265 | """ |
|
1265 | """ | |
1266 | return narrowspec.load(self) |
|
1266 | return narrowspec.load(self) | |
1267 |
|
1267 | |||
1268 | @storecache(narrowspec.FILENAME) |
|
1268 | @storecache(narrowspec.FILENAME) | |
1269 | def _storenarrowmatch(self): |
|
1269 | def _storenarrowmatch(self): | |
1270 | if repository.NARROW_REQUIREMENT not in self.requirements: |
|
1270 | if repository.NARROW_REQUIREMENT not in self.requirements: | |
1271 | return matchmod.always() |
|
1271 | return matchmod.always() | |
1272 | include, exclude = self.narrowpats |
|
1272 | include, exclude = self.narrowpats | |
1273 | return narrowspec.match(self.root, include=include, exclude=exclude) |
|
1273 | return narrowspec.match(self.root, include=include, exclude=exclude) | |
1274 |
|
1274 | |||
1275 | @storecache(narrowspec.FILENAME) |
|
1275 | @storecache(narrowspec.FILENAME) | |
1276 | def _narrowmatch(self): |
|
1276 | def _narrowmatch(self): | |
1277 | if repository.NARROW_REQUIREMENT not in self.requirements: |
|
1277 | if repository.NARROW_REQUIREMENT not in self.requirements: | |
1278 | return matchmod.always() |
|
1278 | return matchmod.always() | |
1279 | narrowspec.checkworkingcopynarrowspec(self) |
|
1279 | narrowspec.checkworkingcopynarrowspec(self) | |
1280 | include, exclude = self.narrowpats |
|
1280 | include, exclude = self.narrowpats | |
1281 | return narrowspec.match(self.root, include=include, exclude=exclude) |
|
1281 | return narrowspec.match(self.root, include=include, exclude=exclude) | |
1282 |
|
1282 | |||
1283 | def narrowmatch(self, match=None, includeexact=False): |
|
1283 | def narrowmatch(self, match=None, includeexact=False): | |
1284 | """matcher corresponding the the repo's narrowspec |
|
1284 | """matcher corresponding the the repo's narrowspec | |
1285 |
|
1285 | |||
1286 | If `match` is given, then that will be intersected with the narrow |
|
1286 | If `match` is given, then that will be intersected with the narrow | |
1287 | matcher. |
|
1287 | matcher. | |
1288 |
|
1288 | |||
1289 | If `includeexact` is True, then any exact matches from `match` will |
|
1289 | If `includeexact` is True, then any exact matches from `match` will | |
1290 | be included even if they're outside the narrowspec. |
|
1290 | be included even if they're outside the narrowspec. | |
1291 | """ |
|
1291 | """ | |
1292 | if match: |
|
1292 | if match: | |
1293 | if includeexact and not self._narrowmatch.always(): |
|
1293 | if includeexact and not self._narrowmatch.always(): | |
1294 | # do not exclude explicitly-specified paths so that they can |
|
1294 | # do not exclude explicitly-specified paths so that they can | |
1295 | # be warned later on |
|
1295 | # be warned later on | |
1296 | em = matchmod.exact(match.files()) |
|
1296 | em = matchmod.exact(match.files()) | |
1297 | nm = matchmod.unionmatcher([self._narrowmatch, em]) |
|
1297 | nm = matchmod.unionmatcher([self._narrowmatch, em]) | |
1298 | return matchmod.intersectmatchers(match, nm) |
|
1298 | return matchmod.intersectmatchers(match, nm) | |
1299 | return matchmod.intersectmatchers(match, self._narrowmatch) |
|
1299 | return matchmod.intersectmatchers(match, self._narrowmatch) | |
1300 | return self._narrowmatch |
|
1300 | return self._narrowmatch | |
1301 |
|
1301 | |||
1302 | def setnarrowpats(self, newincludes, newexcludes): |
|
1302 | def setnarrowpats(self, newincludes, newexcludes): | |
1303 | narrowspec.save(self, newincludes, newexcludes) |
|
1303 | narrowspec.save(self, newincludes, newexcludes) | |
1304 | self.invalidate(clearfilecache=True) |
|
1304 | self.invalidate(clearfilecache=True) | |
1305 |
|
1305 | |||
1306 | def __getitem__(self, changeid): |
|
1306 | def __getitem__(self, changeid): | |
1307 | if changeid is None: |
|
1307 | if changeid is None: | |
1308 | return context.workingctx(self) |
|
1308 | return context.workingctx(self) | |
1309 | if isinstance(changeid, context.basectx): |
|
1309 | if isinstance(changeid, context.basectx): | |
1310 | return changeid |
|
1310 | return changeid | |
1311 | if isinstance(changeid, slice): |
|
1311 | if isinstance(changeid, slice): | |
1312 | # wdirrev isn't contiguous so the slice shouldn't include it |
|
1312 | # wdirrev isn't contiguous so the slice shouldn't include it | |
1313 | return [self[i] |
|
1313 | return [self[i] | |
1314 | for i in pycompat.xrange(*changeid.indices(len(self))) |
|
1314 | for i in pycompat.xrange(*changeid.indices(len(self))) | |
1315 | if i not in self.changelog.filteredrevs] |
|
1315 | if i not in self.changelog.filteredrevs] | |
1316 | try: |
|
1316 | try: | |
1317 | if isinstance(changeid, int): |
|
1317 | if isinstance(changeid, int): | |
1318 | node = self.changelog.node(changeid) |
|
1318 | node = self.changelog.node(changeid) | |
1319 | rev = changeid |
|
1319 | rev = changeid | |
1320 | elif changeid == 'null': |
|
1320 | elif changeid == 'null': | |
1321 | node = nullid |
|
1321 | node = nullid | |
1322 | rev = nullrev |
|
1322 | rev = nullrev | |
1323 | elif changeid == 'tip': |
|
1323 | elif changeid == 'tip': | |
1324 | node = self.changelog.tip() |
|
1324 | node = self.changelog.tip() | |
1325 | rev = self.changelog.rev(node) |
|
1325 | rev = self.changelog.rev(node) | |
1326 | elif changeid == '.': |
|
1326 | elif changeid == '.': | |
1327 | # this is a hack to delay/avoid loading obsmarkers |
|
1327 | # this is a hack to delay/avoid loading obsmarkers | |
1328 | # when we know that '.' won't be hidden |
|
1328 | # when we know that '.' won't be hidden | |
1329 | node = self.dirstate.p1() |
|
1329 | node = self.dirstate.p1() | |
1330 | rev = self.unfiltered().changelog.rev(node) |
|
1330 | rev = self.unfiltered().changelog.rev(node) | |
1331 | elif len(changeid) == 20: |
|
1331 | elif len(changeid) == 20: | |
1332 | try: |
|
1332 | try: | |
1333 | node = changeid |
|
1333 | node = changeid | |
1334 | rev = self.changelog.rev(changeid) |
|
1334 | rev = self.changelog.rev(changeid) | |
1335 | except error.FilteredLookupError: |
|
1335 | except error.FilteredLookupError: | |
1336 | changeid = hex(changeid) # for the error message |
|
1336 | changeid = hex(changeid) # for the error message | |
1337 | raise |
|
1337 | raise | |
1338 | except LookupError: |
|
1338 | except LookupError: | |
1339 | # check if it might have come from damaged dirstate |
|
1339 | # check if it might have come from damaged dirstate | |
1340 | # |
|
1340 | # | |
1341 | # XXX we could avoid the unfiltered if we had a recognizable |
|
1341 | # XXX we could avoid the unfiltered if we had a recognizable | |
1342 | # exception for filtered changeset access |
|
1342 | # exception for filtered changeset access | |
1343 | if (self.local() |
|
1343 | if (self.local() | |
1344 | and changeid in self.unfiltered().dirstate.parents()): |
|
1344 | and changeid in self.unfiltered().dirstate.parents()): | |
1345 | msg = _("working directory has unknown parent '%s'!") |
|
1345 | msg = _("working directory has unknown parent '%s'!") | |
1346 | raise error.Abort(msg % short(changeid)) |
|
1346 | raise error.Abort(msg % short(changeid)) | |
1347 | changeid = hex(changeid) # for the error message |
|
1347 | changeid = hex(changeid) # for the error message | |
1348 | raise |
|
1348 | raise | |
1349 |
|
1349 | |||
1350 | elif len(changeid) == 40: |
|
1350 | elif len(changeid) == 40: | |
1351 | node = bin(changeid) |
|
1351 | node = bin(changeid) | |
1352 | rev = self.changelog.rev(node) |
|
1352 | rev = self.changelog.rev(node) | |
1353 | else: |
|
1353 | else: | |
1354 | raise error.ProgrammingError( |
|
1354 | raise error.ProgrammingError( | |
1355 | "unsupported changeid '%s' of type %s" % |
|
1355 | "unsupported changeid '%s' of type %s" % | |
1356 | (changeid, type(changeid))) |
|
1356 | (changeid, type(changeid))) | |
1357 |
|
1357 | |||
1358 | return context.changectx(self, rev, node) |
|
1358 | return context.changectx(self, rev, node) | |
1359 |
|
1359 | |||
1360 | except (error.FilteredIndexError, error.FilteredLookupError): |
|
1360 | except (error.FilteredIndexError, error.FilteredLookupError): | |
1361 | raise error.FilteredRepoLookupError(_("filtered revision '%s'") |
|
1361 | raise error.FilteredRepoLookupError(_("filtered revision '%s'") | |
1362 | % pycompat.bytestr(changeid)) |
|
1362 | % pycompat.bytestr(changeid)) | |
1363 | except (IndexError, LookupError): |
|
1363 | except (IndexError, LookupError): | |
1364 | raise error.RepoLookupError( |
|
1364 | raise error.RepoLookupError( | |
1365 | _("unknown revision '%s'") % pycompat.bytestr(changeid)) |
|
1365 | _("unknown revision '%s'") % pycompat.bytestr(changeid)) | |
1366 | except error.WdirUnsupported: |
|
1366 | except error.WdirUnsupported: | |
1367 | return context.workingctx(self) |
|
1367 | return context.workingctx(self) | |
1368 |
|
1368 | |||
1369 | def __contains__(self, changeid): |
|
1369 | def __contains__(self, changeid): | |
1370 | """True if the given changeid exists |
|
1370 | """True if the given changeid exists | |
1371 |
|
1371 | |||
1372 | error.AmbiguousPrefixLookupError is raised if an ambiguous node |
|
1372 | error.AmbiguousPrefixLookupError is raised if an ambiguous node | |
1373 | specified. |
|
1373 | specified. | |
1374 | """ |
|
1374 | """ | |
1375 | try: |
|
1375 | try: | |
1376 | self[changeid] |
|
1376 | self[changeid] | |
1377 | return True |
|
1377 | return True | |
1378 | except error.RepoLookupError: |
|
1378 | except error.RepoLookupError: | |
1379 | return False |
|
1379 | return False | |
1380 |
|
1380 | |||
1381 | def __nonzero__(self): |
|
1381 | def __nonzero__(self): | |
1382 | return True |
|
1382 | return True | |
1383 |
|
1383 | |||
1384 | __bool__ = __nonzero__ |
|
1384 | __bool__ = __nonzero__ | |
1385 |
|
1385 | |||
1386 | def __len__(self): |
|
1386 | def __len__(self): | |
1387 | # no need to pay the cost of repoview.changelog |
|
1387 | # no need to pay the cost of repoview.changelog | |
1388 | unfi = self.unfiltered() |
|
1388 | unfi = self.unfiltered() | |
1389 | return len(unfi.changelog) |
|
1389 | return len(unfi.changelog) | |
1390 |
|
1390 | |||
1391 | def __iter__(self): |
|
1391 | def __iter__(self): | |
1392 | return iter(self.changelog) |
|
1392 | return iter(self.changelog) | |
1393 |
|
1393 | |||
1394 | def revs(self, expr, *args): |
|
1394 | def revs(self, expr, *args): | |
1395 | '''Find revisions matching a revset. |
|
1395 | '''Find revisions matching a revset. | |
1396 |
|
1396 | |||
1397 | The revset is specified as a string ``expr`` that may contain |
|
1397 | The revset is specified as a string ``expr`` that may contain | |
1398 | %-formatting to escape certain types. See ``revsetlang.formatspec``. |
|
1398 | %-formatting to escape certain types. See ``revsetlang.formatspec``. | |
1399 |
|
1399 | |||
1400 | Revset aliases from the configuration are not expanded. To expand |
|
1400 | Revset aliases from the configuration are not expanded. To expand | |
1401 | user aliases, consider calling ``scmutil.revrange()`` or |
|
1401 | user aliases, consider calling ``scmutil.revrange()`` or | |
1402 | ``repo.anyrevs([expr], user=True)``. |
|
1402 | ``repo.anyrevs([expr], user=True)``. | |
1403 |
|
1403 | |||
1404 | Returns a revset.abstractsmartset, which is a list-like interface |
|
1404 | Returns a revset.abstractsmartset, which is a list-like interface | |
1405 | that contains integer revisions. |
|
1405 | that contains integer revisions. | |
1406 | ''' |
|
1406 | ''' | |
1407 | tree = revsetlang.spectree(expr, *args) |
|
1407 | tree = revsetlang.spectree(expr, *args) | |
1408 | return revset.makematcher(tree)(self) |
|
1408 | return revset.makematcher(tree)(self) | |
1409 |
|
1409 | |||
1410 | def set(self, expr, *args): |
|
1410 | def set(self, expr, *args): | |
1411 | '''Find revisions matching a revset and emit changectx instances. |
|
1411 | '''Find revisions matching a revset and emit changectx instances. | |
1412 |
|
1412 | |||
1413 | This is a convenience wrapper around ``revs()`` that iterates the |
|
1413 | This is a convenience wrapper around ``revs()`` that iterates the | |
1414 | result and is a generator of changectx instances. |
|
1414 | result and is a generator of changectx instances. | |
1415 |
|
1415 | |||
1416 | Revset aliases from the configuration are not expanded. To expand |
|
1416 | Revset aliases from the configuration are not expanded. To expand | |
1417 | user aliases, consider calling ``scmutil.revrange()``. |
|
1417 | user aliases, consider calling ``scmutil.revrange()``. | |
1418 | ''' |
|
1418 | ''' | |
1419 | for r in self.revs(expr, *args): |
|
1419 | for r in self.revs(expr, *args): | |
1420 | yield self[r] |
|
1420 | yield self[r] | |
1421 |
|
1421 | |||
1422 | def anyrevs(self, specs, user=False, localalias=None): |
|
1422 | def anyrevs(self, specs, user=False, localalias=None): | |
1423 | '''Find revisions matching one of the given revsets. |
|
1423 | '''Find revisions matching one of the given revsets. | |
1424 |
|
1424 | |||
1425 | Revset aliases from the configuration are not expanded by default. To |
|
1425 | Revset aliases from the configuration are not expanded by default. To | |
1426 | expand user aliases, specify ``user=True``. To provide some local |
|
1426 | expand user aliases, specify ``user=True``. To provide some local | |
1427 | definitions overriding user aliases, set ``localalias`` to |
|
1427 | definitions overriding user aliases, set ``localalias`` to | |
1428 | ``{name: definitionstring}``. |
|
1428 | ``{name: definitionstring}``. | |
1429 | ''' |
|
1429 | ''' | |
1430 | if user: |
|
1430 | if user: | |
1431 | m = revset.matchany(self.ui, specs, |
|
1431 | m = revset.matchany(self.ui, specs, | |
1432 | lookup=revset.lookupfn(self), |
|
1432 | lookup=revset.lookupfn(self), | |
1433 | localalias=localalias) |
|
1433 | localalias=localalias) | |
1434 | else: |
|
1434 | else: | |
1435 | m = revset.matchany(None, specs, localalias=localalias) |
|
1435 | m = revset.matchany(None, specs, localalias=localalias) | |
1436 | return m(self) |
|
1436 | return m(self) | |
1437 |
|
1437 | |||
1438 | def url(self): |
|
1438 | def url(self): | |
1439 | return 'file:' + self.root |
|
1439 | return 'file:' + self.root | |
1440 |
|
1440 | |||
1441 | def hook(self, name, throw=False, **args): |
|
1441 | def hook(self, name, throw=False, **args): | |
1442 | """Call a hook, passing this repo instance. |
|
1442 | """Call a hook, passing this repo instance. | |
1443 |
|
1443 | |||
1444 | This a convenience method to aid invoking hooks. Extensions likely |
|
1444 | This a convenience method to aid invoking hooks. Extensions likely | |
1445 | won't call this unless they have registered a custom hook or are |
|
1445 | won't call this unless they have registered a custom hook or are | |
1446 | replacing code that is expected to call a hook. |
|
1446 | replacing code that is expected to call a hook. | |
1447 | """ |
|
1447 | """ | |
1448 | return hook.hook(self.ui, self, name, throw, **args) |
|
1448 | return hook.hook(self.ui, self, name, throw, **args) | |
1449 |
|
1449 | |||
1450 | @filteredpropertycache |
|
1450 | @filteredpropertycache | |
1451 | def _tagscache(self): |
|
1451 | def _tagscache(self): | |
1452 | '''Returns a tagscache object that contains various tags related |
|
1452 | '''Returns a tagscache object that contains various tags related | |
1453 | caches.''' |
|
1453 | caches.''' | |
1454 |
|
1454 | |||
1455 | # This simplifies its cache management by having one decorated |
|
1455 | # This simplifies its cache management by having one decorated | |
1456 | # function (this one) and the rest simply fetch things from it. |
|
1456 | # function (this one) and the rest simply fetch things from it. | |
1457 | class tagscache(object): |
|
1457 | class tagscache(object): | |
1458 | def __init__(self): |
|
1458 | def __init__(self): | |
1459 | # These two define the set of tags for this repository. tags |
|
1459 | # These two define the set of tags for this repository. tags | |
1460 | # maps tag name to node; tagtypes maps tag name to 'global' or |
|
1460 | # maps tag name to node; tagtypes maps tag name to 'global' or | |
1461 | # 'local'. (Global tags are defined by .hgtags across all |
|
1461 | # 'local'. (Global tags are defined by .hgtags across all | |
1462 | # heads, and local tags are defined in .hg/localtags.) |
|
1462 | # heads, and local tags are defined in .hg/localtags.) | |
1463 | # They constitute the in-memory cache of tags. |
|
1463 | # They constitute the in-memory cache of tags. | |
1464 | self.tags = self.tagtypes = None |
|
1464 | self.tags = self.tagtypes = None | |
1465 |
|
1465 | |||
1466 | self.nodetagscache = self.tagslist = None |
|
1466 | self.nodetagscache = self.tagslist = None | |
1467 |
|
1467 | |||
1468 | cache = tagscache() |
|
1468 | cache = tagscache() | |
1469 | cache.tags, cache.tagtypes = self._findtags() |
|
1469 | cache.tags, cache.tagtypes = self._findtags() | |
1470 |
|
1470 | |||
1471 | return cache |
|
1471 | return cache | |
1472 |
|
1472 | |||
1473 | def tags(self): |
|
1473 | def tags(self): | |
1474 | '''return a mapping of tag to node''' |
|
1474 | '''return a mapping of tag to node''' | |
1475 | t = {} |
|
1475 | t = {} | |
1476 | if self.changelog.filteredrevs: |
|
1476 | if self.changelog.filteredrevs: | |
1477 | tags, tt = self._findtags() |
|
1477 | tags, tt = self._findtags() | |
1478 | else: |
|
1478 | else: | |
1479 | tags = self._tagscache.tags |
|
1479 | tags = self._tagscache.tags | |
1480 | rev = self.changelog.rev |
|
1480 | rev = self.changelog.rev | |
1481 | for k, v in tags.iteritems(): |
|
1481 | for k, v in tags.iteritems(): | |
1482 | try: |
|
1482 | try: | |
1483 | # ignore tags to unknown nodes |
|
1483 | # ignore tags to unknown nodes | |
1484 | rev(v) |
|
1484 | rev(v) | |
1485 | t[k] = v |
|
1485 | t[k] = v | |
1486 | except (error.LookupError, ValueError): |
|
1486 | except (error.LookupError, ValueError): | |
1487 | pass |
|
1487 | pass | |
1488 | return t |
|
1488 | return t | |
1489 |
|
1489 | |||
1490 | def _findtags(self): |
|
1490 | def _findtags(self): | |
1491 | '''Do the hard work of finding tags. Return a pair of dicts |
|
1491 | '''Do the hard work of finding tags. Return a pair of dicts | |
1492 | (tags, tagtypes) where tags maps tag name to node, and tagtypes |
|
1492 | (tags, tagtypes) where tags maps tag name to node, and tagtypes | |
1493 | maps tag name to a string like \'global\' or \'local\'. |
|
1493 | maps tag name to a string like \'global\' or \'local\'. | |
1494 | Subclasses or extensions are free to add their own tags, but |
|
1494 | Subclasses or extensions are free to add their own tags, but | |
1495 | should be aware that the returned dicts will be retained for the |
|
1495 | should be aware that the returned dicts will be retained for the | |
1496 | duration of the localrepo object.''' |
|
1496 | duration of the localrepo object.''' | |
1497 |
|
1497 | |||
1498 | # XXX what tagtype should subclasses/extensions use? Currently |
|
1498 | # XXX what tagtype should subclasses/extensions use? Currently | |
1499 | # mq and bookmarks add tags, but do not set the tagtype at all. |
|
1499 | # mq and bookmarks add tags, but do not set the tagtype at all. | |
1500 | # Should each extension invent its own tag type? Should there |
|
1500 | # Should each extension invent its own tag type? Should there | |
1501 | # be one tagtype for all such "virtual" tags? Or is the status |
|
1501 | # be one tagtype for all such "virtual" tags? Or is the status | |
1502 | # quo fine? |
|
1502 | # quo fine? | |
1503 |
|
1503 | |||
1504 |
|
1504 | |||
1505 | # map tag name to (node, hist) |
|
1505 | # map tag name to (node, hist) | |
1506 | alltags = tagsmod.findglobaltags(self.ui, self) |
|
1506 | alltags = tagsmod.findglobaltags(self.ui, self) | |
1507 | # map tag name to tag type |
|
1507 | # map tag name to tag type | |
1508 | tagtypes = dict((tag, 'global') for tag in alltags) |
|
1508 | tagtypes = dict((tag, 'global') for tag in alltags) | |
1509 |
|
1509 | |||
1510 | tagsmod.readlocaltags(self.ui, self, alltags, tagtypes) |
|
1510 | tagsmod.readlocaltags(self.ui, self, alltags, tagtypes) | |
1511 |
|
1511 | |||
1512 | # Build the return dicts. Have to re-encode tag names because |
|
1512 | # Build the return dicts. Have to re-encode tag names because | |
1513 | # the tags module always uses UTF-8 (in order not to lose info |
|
1513 | # the tags module always uses UTF-8 (in order not to lose info | |
1514 | # writing to the cache), but the rest of Mercurial wants them in |
|
1514 | # writing to the cache), but the rest of Mercurial wants them in | |
1515 | # local encoding. |
|
1515 | # local encoding. | |
1516 | tags = {} |
|
1516 | tags = {} | |
1517 | for (name, (node, hist)) in alltags.iteritems(): |
|
1517 | for (name, (node, hist)) in alltags.iteritems(): | |
1518 | if node != nullid: |
|
1518 | if node != nullid: | |
1519 | tags[encoding.tolocal(name)] = node |
|
1519 | tags[encoding.tolocal(name)] = node | |
1520 | tags['tip'] = self.changelog.tip() |
|
1520 | tags['tip'] = self.changelog.tip() | |
1521 | tagtypes = dict([(encoding.tolocal(name), value) |
|
1521 | tagtypes = dict([(encoding.tolocal(name), value) | |
1522 | for (name, value) in tagtypes.iteritems()]) |
|
1522 | for (name, value) in tagtypes.iteritems()]) | |
1523 | return (tags, tagtypes) |
|
1523 | return (tags, tagtypes) | |
1524 |
|
1524 | |||
1525 | def tagtype(self, tagname): |
|
1525 | def tagtype(self, tagname): | |
1526 | ''' |
|
1526 | ''' | |
1527 | return the type of the given tag. result can be: |
|
1527 | return the type of the given tag. result can be: | |
1528 |
|
1528 | |||
1529 | 'local' : a local tag |
|
1529 | 'local' : a local tag | |
1530 | 'global' : a global tag |
|
1530 | 'global' : a global tag | |
1531 | None : tag does not exist |
|
1531 | None : tag does not exist | |
1532 | ''' |
|
1532 | ''' | |
1533 |
|
1533 | |||
1534 | return self._tagscache.tagtypes.get(tagname) |
|
1534 | return self._tagscache.tagtypes.get(tagname) | |
1535 |
|
1535 | |||
1536 | def tagslist(self): |
|
1536 | def tagslist(self): | |
1537 | '''return a list of tags ordered by revision''' |
|
1537 | '''return a list of tags ordered by revision''' | |
1538 | if not self._tagscache.tagslist: |
|
1538 | if not self._tagscache.tagslist: | |
1539 | l = [] |
|
1539 | l = [] | |
1540 | for t, n in self.tags().iteritems(): |
|
1540 | for t, n in self.tags().iteritems(): | |
1541 | l.append((self.changelog.rev(n), t, n)) |
|
1541 | l.append((self.changelog.rev(n), t, n)) | |
1542 | self._tagscache.tagslist = [(t, n) for r, t, n in sorted(l)] |
|
1542 | self._tagscache.tagslist = [(t, n) for r, t, n in sorted(l)] | |
1543 |
|
1543 | |||
1544 | return self._tagscache.tagslist |
|
1544 | return self._tagscache.tagslist | |
1545 |
|
1545 | |||
1546 | def nodetags(self, node): |
|
1546 | def nodetags(self, node): | |
1547 | '''return the tags associated with a node''' |
|
1547 | '''return the tags associated with a node''' | |
1548 | if not self._tagscache.nodetagscache: |
|
1548 | if not self._tagscache.nodetagscache: | |
1549 | nodetagscache = {} |
|
1549 | nodetagscache = {} | |
1550 | for t, n in self._tagscache.tags.iteritems(): |
|
1550 | for t, n in self._tagscache.tags.iteritems(): | |
1551 | nodetagscache.setdefault(n, []).append(t) |
|
1551 | nodetagscache.setdefault(n, []).append(t) | |
1552 | for tags in nodetagscache.itervalues(): |
|
1552 | for tags in nodetagscache.itervalues(): | |
1553 | tags.sort() |
|
1553 | tags.sort() | |
1554 | self._tagscache.nodetagscache = nodetagscache |
|
1554 | self._tagscache.nodetagscache = nodetagscache | |
1555 | return self._tagscache.nodetagscache.get(node, []) |
|
1555 | return self._tagscache.nodetagscache.get(node, []) | |
1556 |
|
1556 | |||
1557 | def nodebookmarks(self, node): |
|
1557 | def nodebookmarks(self, node): | |
1558 | """return the list of bookmarks pointing to the specified node""" |
|
1558 | """return the list of bookmarks pointing to the specified node""" | |
1559 | return self._bookmarks.names(node) |
|
1559 | return self._bookmarks.names(node) | |
1560 |
|
1560 | |||
1561 | def branchmap(self): |
|
1561 | def branchmap(self): | |
1562 | '''returns a dictionary {branch: [branchheads]} with branchheads |
|
1562 | '''returns a dictionary {branch: [branchheads]} with branchheads | |
1563 | ordered by increasing revision number''' |
|
1563 | ordered by increasing revision number''' | |
1564 | return self._branchcaches[self] |
|
1564 | return self._branchcaches[self] | |
1565 |
|
1565 | |||
1566 | @unfilteredmethod |
|
1566 | @unfilteredmethod | |
1567 | def revbranchcache(self): |
|
1567 | def revbranchcache(self): | |
1568 | if not self._revbranchcache: |
|
1568 | if not self._revbranchcache: | |
1569 | self._revbranchcache = branchmap.revbranchcache(self.unfiltered()) |
|
1569 | self._revbranchcache = branchmap.revbranchcache(self.unfiltered()) | |
1570 | return self._revbranchcache |
|
1570 | return self._revbranchcache | |
1571 |
|
1571 | |||
1572 | def branchtip(self, branch, ignoremissing=False): |
|
1572 | def branchtip(self, branch, ignoremissing=False): | |
1573 | '''return the tip node for a given branch |
|
1573 | '''return the tip node for a given branch | |
1574 |
|
1574 | |||
1575 | If ignoremissing is True, then this method will not raise an error. |
|
1575 | If ignoremissing is True, then this method will not raise an error. | |
1576 | This is helpful for callers that only expect None for a missing branch |
|
1576 | This is helpful for callers that only expect None for a missing branch | |
1577 | (e.g. namespace). |
|
1577 | (e.g. namespace). | |
1578 |
|
1578 | |||
1579 | ''' |
|
1579 | ''' | |
1580 | try: |
|
1580 | try: | |
1581 | return self.branchmap().branchtip(branch) |
|
1581 | return self.branchmap().branchtip(branch) | |
1582 | except KeyError: |
|
1582 | except KeyError: | |
1583 | if not ignoremissing: |
|
1583 | if not ignoremissing: | |
1584 | raise error.RepoLookupError(_("unknown branch '%s'") % branch) |
|
1584 | raise error.RepoLookupError(_("unknown branch '%s'") % branch) | |
1585 | else: |
|
1585 | else: | |
1586 | pass |
|
1586 | pass | |
1587 |
|
1587 | |||
1588 | def lookup(self, key): |
|
1588 | def lookup(self, key): | |
1589 | node = scmutil.revsymbol(self, key).node() |
|
1589 | node = scmutil.revsymbol(self, key).node() | |
1590 | if node is None: |
|
1590 | if node is None: | |
1591 | raise error.RepoLookupError(_("unknown revision '%s'") % key) |
|
1591 | raise error.RepoLookupError(_("unknown revision '%s'") % key) | |
1592 | return node |
|
1592 | return node | |
1593 |
|
1593 | |||
1594 | def lookupbranch(self, key): |
|
1594 | def lookupbranch(self, key): | |
1595 | if self.branchmap().hasbranch(key): |
|
1595 | if self.branchmap().hasbranch(key): | |
1596 | return key |
|
1596 | return key | |
1597 |
|
1597 | |||
1598 | return scmutil.revsymbol(self, key).branch() |
|
1598 | return scmutil.revsymbol(self, key).branch() | |
1599 |
|
1599 | |||
1600 | def known(self, nodes): |
|
1600 | def known(self, nodes): | |
1601 | cl = self.changelog |
|
1601 | cl = self.changelog | |
1602 | nm = cl.nodemap |
|
1602 | nm = cl.nodemap | |
1603 | filtered = cl.filteredrevs |
|
1603 | filtered = cl.filteredrevs | |
1604 | result = [] |
|
1604 | result = [] | |
1605 | for n in nodes: |
|
1605 | for n in nodes: | |
1606 | r = nm.get(n) |
|
1606 | r = nm.get(n) | |
1607 | resp = not (r is None or r in filtered) |
|
1607 | resp = not (r is None or r in filtered) | |
1608 | result.append(resp) |
|
1608 | result.append(resp) | |
1609 | return result |
|
1609 | return result | |
1610 |
|
1610 | |||
1611 | def local(self): |
|
1611 | def local(self): | |
1612 | return self |
|
1612 | return self | |
1613 |
|
1613 | |||
1614 | def publishing(self): |
|
1614 | def publishing(self): | |
1615 | # it's safe (and desirable) to trust the publish flag unconditionally |
|
1615 | # it's safe (and desirable) to trust the publish flag unconditionally | |
1616 | # so that we don't finalize changes shared between users via ssh or nfs |
|
1616 | # so that we don't finalize changes shared between users via ssh or nfs | |
1617 | return self.ui.configbool('phases', 'publish', untrusted=True) |
|
1617 | return self.ui.configbool('phases', 'publish', untrusted=True) | |
1618 |
|
1618 | |||
1619 | def cancopy(self): |
|
1619 | def cancopy(self): | |
1620 | # so statichttprepo's override of local() works |
|
1620 | # so statichttprepo's override of local() works | |
1621 | if not self.local(): |
|
1621 | if not self.local(): | |
1622 | return False |
|
1622 | return False | |
1623 | if not self.publishing(): |
|
1623 | if not self.publishing(): | |
1624 | return True |
|
1624 | return True | |
1625 | # if publishing we can't copy if there is filtered content |
|
1625 | # if publishing we can't copy if there is filtered content | |
1626 | return not self.filtered('visible').changelog.filteredrevs |
|
1626 | return not self.filtered('visible').changelog.filteredrevs | |
1627 |
|
1627 | |||
1628 | def shared(self): |
|
1628 | def shared(self): | |
1629 | '''the type of shared repository (None if not shared)''' |
|
1629 | '''the type of shared repository (None if not shared)''' | |
1630 | if self.sharedpath != self.path: |
|
1630 | if self.sharedpath != self.path: | |
1631 | return 'store' |
|
1631 | return 'store' | |
1632 | return None |
|
1632 | return None | |
1633 |
|
1633 | |||
1634 | def wjoin(self, f, *insidef): |
|
1634 | def wjoin(self, f, *insidef): | |
1635 | return self.vfs.reljoin(self.root, f, *insidef) |
|
1635 | return self.vfs.reljoin(self.root, f, *insidef) | |
1636 |
|
1636 | |||
1637 | def setparents(self, p1, p2=nullid): |
|
1637 | def setparents(self, p1, p2=nullid): | |
1638 | with self.dirstate.parentchange(): |
|
1638 | with self.dirstate.parentchange(): | |
1639 | copies = self.dirstate.setparents(p1, p2) |
|
1639 | copies = self.dirstate.setparents(p1, p2) | |
1640 | pctx = self[p1] |
|
1640 | pctx = self[p1] | |
1641 | if copies: |
|
1641 | if copies: | |
1642 | # Adjust copy records, the dirstate cannot do it, it |
|
1642 | # Adjust copy records, the dirstate cannot do it, it | |
1643 | # requires access to parents manifests. Preserve them |
|
1643 | # requires access to parents manifests. Preserve them | |
1644 | # only for entries added to first parent. |
|
1644 | # only for entries added to first parent. | |
1645 | for f in copies: |
|
1645 | for f in copies: | |
1646 | if f not in pctx and copies[f] in pctx: |
|
1646 | if f not in pctx and copies[f] in pctx: | |
1647 | self.dirstate.copy(copies[f], f) |
|
1647 | self.dirstate.copy(copies[f], f) | |
1648 | if p2 == nullid: |
|
1648 | if p2 == nullid: | |
1649 | for f, s in sorted(self.dirstate.copies().items()): |
|
1649 | for f, s in sorted(self.dirstate.copies().items()): | |
1650 | if f not in pctx and s not in pctx: |
|
1650 | if f not in pctx and s not in pctx: | |
1651 | self.dirstate.copy(None, f) |
|
1651 | self.dirstate.copy(None, f) | |
1652 |
|
1652 | |||
1653 | def filectx(self, path, changeid=None, fileid=None, changectx=None): |
|
1653 | def filectx(self, path, changeid=None, fileid=None, changectx=None): | |
1654 | """changeid must be a changeset revision, if specified. |
|
1654 | """changeid must be a changeset revision, if specified. | |
1655 | fileid can be a file revision or node.""" |
|
1655 | fileid can be a file revision or node.""" | |
1656 | return context.filectx(self, path, changeid, fileid, |
|
1656 | return context.filectx(self, path, changeid, fileid, | |
1657 | changectx=changectx) |
|
1657 | changectx=changectx) | |
1658 |
|
1658 | |||
1659 | def getcwd(self): |
|
1659 | def getcwd(self): | |
1660 | return self.dirstate.getcwd() |
|
1660 | return self.dirstate.getcwd() | |
1661 |
|
1661 | |||
1662 | def pathto(self, f, cwd=None): |
|
1662 | def pathto(self, f, cwd=None): | |
1663 | return self.dirstate.pathto(f, cwd) |
|
1663 | return self.dirstate.pathto(f, cwd) | |
1664 |
|
1664 | |||
1665 | def _loadfilter(self, filter): |
|
1665 | def _loadfilter(self, filter): | |
1666 | if filter not in self._filterpats: |
|
1666 | if filter not in self._filterpats: | |
1667 | l = [] |
|
1667 | l = [] | |
1668 | for pat, cmd in self.ui.configitems(filter): |
|
1668 | for pat, cmd in self.ui.configitems(filter): | |
1669 | if cmd == '!': |
|
1669 | if cmd == '!': | |
1670 | continue |
|
1670 | continue | |
1671 | mf = matchmod.match(self.root, '', [pat]) |
|
1671 | mf = matchmod.match(self.root, '', [pat]) | |
1672 | fn = None |
|
1672 | fn = None | |
1673 | params = cmd |
|
1673 | params = cmd | |
1674 | for name, filterfn in self._datafilters.iteritems(): |
|
1674 | for name, filterfn in self._datafilters.iteritems(): | |
1675 | if cmd.startswith(name): |
|
1675 | if cmd.startswith(name): | |
1676 | fn = filterfn |
|
1676 | fn = filterfn | |
1677 | params = cmd[len(name):].lstrip() |
|
1677 | params = cmd[len(name):].lstrip() | |
1678 | break |
|
1678 | break | |
1679 | if not fn: |
|
1679 | if not fn: | |
1680 | fn = lambda s, c, **kwargs: procutil.filter(s, c) |
|
1680 | fn = lambda s, c, **kwargs: procutil.filter(s, c) | |
1681 | # Wrap old filters not supporting keyword arguments |
|
1681 | # Wrap old filters not supporting keyword arguments | |
1682 | if not pycompat.getargspec(fn)[2]: |
|
1682 | if not pycompat.getargspec(fn)[2]: | |
1683 | oldfn = fn |
|
1683 | oldfn = fn | |
1684 | fn = lambda s, c, **kwargs: oldfn(s, c) |
|
1684 | fn = lambda s, c, **kwargs: oldfn(s, c) | |
1685 | l.append((mf, fn, params)) |
|
1685 | l.append((mf, fn, params)) | |
1686 | self._filterpats[filter] = l |
|
1686 | self._filterpats[filter] = l | |
1687 | return self._filterpats[filter] |
|
1687 | return self._filterpats[filter] | |
1688 |
|
1688 | |||
1689 | def _filter(self, filterpats, filename, data): |
|
1689 | def _filter(self, filterpats, filename, data): | |
1690 | for mf, fn, cmd in filterpats: |
|
1690 | for mf, fn, cmd in filterpats: | |
1691 | if mf(filename): |
|
1691 | if mf(filename): | |
1692 | self.ui.debug("filtering %s through %s\n" % (filename, cmd)) |
|
1692 | self.ui.debug("filtering %s through %s\n" % (filename, cmd)) | |
1693 | data = fn(data, cmd, ui=self.ui, repo=self, filename=filename) |
|
1693 | data = fn(data, cmd, ui=self.ui, repo=self, filename=filename) | |
1694 | break |
|
1694 | break | |
1695 |
|
1695 | |||
1696 | return data |
|
1696 | return data | |
1697 |
|
1697 | |||
1698 | @unfilteredpropertycache |
|
1698 | @unfilteredpropertycache | |
1699 | def _encodefilterpats(self): |
|
1699 | def _encodefilterpats(self): | |
1700 | return self._loadfilter('encode') |
|
1700 | return self._loadfilter('encode') | |
1701 |
|
1701 | |||
1702 | @unfilteredpropertycache |
|
1702 | @unfilteredpropertycache | |
1703 | def _decodefilterpats(self): |
|
1703 | def _decodefilterpats(self): | |
1704 | return self._loadfilter('decode') |
|
1704 | return self._loadfilter('decode') | |
1705 |
|
1705 | |||
1706 | def adddatafilter(self, name, filter): |
|
1706 | def adddatafilter(self, name, filter): | |
1707 | self._datafilters[name] = filter |
|
1707 | self._datafilters[name] = filter | |
1708 |
|
1708 | |||
1709 | def wread(self, filename): |
|
1709 | def wread(self, filename): | |
1710 | if self.wvfs.islink(filename): |
|
1710 | if self.wvfs.islink(filename): | |
1711 | data = self.wvfs.readlink(filename) |
|
1711 | data = self.wvfs.readlink(filename) | |
1712 | else: |
|
1712 | else: | |
1713 | data = self.wvfs.read(filename) |
|
1713 | data = self.wvfs.read(filename) | |
1714 | return self._filter(self._encodefilterpats, filename, data) |
|
1714 | return self._filter(self._encodefilterpats, filename, data) | |
1715 |
|
1715 | |||
1716 | def wwrite(self, filename, data, flags, backgroundclose=False, **kwargs): |
|
1716 | def wwrite(self, filename, data, flags, backgroundclose=False, **kwargs): | |
1717 | """write ``data`` into ``filename`` in the working directory |
|
1717 | """write ``data`` into ``filename`` in the working directory | |
1718 |
|
1718 | |||
1719 | This returns length of written (maybe decoded) data. |
|
1719 | This returns length of written (maybe decoded) data. | |
1720 | """ |
|
1720 | """ | |
1721 | data = self._filter(self._decodefilterpats, filename, data) |
|
1721 | data = self._filter(self._decodefilterpats, filename, data) | |
1722 | if 'l' in flags: |
|
1722 | if 'l' in flags: | |
1723 | self.wvfs.symlink(data, filename) |
|
1723 | self.wvfs.symlink(data, filename) | |
1724 | else: |
|
1724 | else: | |
1725 | self.wvfs.write(filename, data, backgroundclose=backgroundclose, |
|
1725 | self.wvfs.write(filename, data, backgroundclose=backgroundclose, | |
1726 | **kwargs) |
|
1726 | **kwargs) | |
1727 | if 'x' in flags: |
|
1727 | if 'x' in flags: | |
1728 | self.wvfs.setflags(filename, False, True) |
|
1728 | self.wvfs.setflags(filename, False, True) | |
1729 | else: |
|
1729 | else: | |
1730 | self.wvfs.setflags(filename, False, False) |
|
1730 | self.wvfs.setflags(filename, False, False) | |
1731 | return len(data) |
|
1731 | return len(data) | |
1732 |
|
1732 | |||
1733 | def wwritedata(self, filename, data): |
|
1733 | def wwritedata(self, filename, data): | |
1734 | return self._filter(self._decodefilterpats, filename, data) |
|
1734 | return self._filter(self._decodefilterpats, filename, data) | |
1735 |
|
1735 | |||
1736 | def currenttransaction(self): |
|
1736 | def currenttransaction(self): | |
1737 | """return the current transaction or None if non exists""" |
|
1737 | """return the current transaction or None if non exists""" | |
1738 | if self._transref: |
|
1738 | if self._transref: | |
1739 | tr = self._transref() |
|
1739 | tr = self._transref() | |
1740 | else: |
|
1740 | else: | |
1741 | tr = None |
|
1741 | tr = None | |
1742 |
|
1742 | |||
1743 | if tr and tr.running(): |
|
1743 | if tr and tr.running(): | |
1744 | return tr |
|
1744 | return tr | |
1745 | return None |
|
1745 | return None | |
1746 |
|
1746 | |||
1747 | def transaction(self, desc, report=None): |
|
1747 | def transaction(self, desc, report=None): | |
1748 | if (self.ui.configbool('devel', 'all-warnings') |
|
1748 | if (self.ui.configbool('devel', 'all-warnings') | |
1749 | or self.ui.configbool('devel', 'check-locks')): |
|
1749 | or self.ui.configbool('devel', 'check-locks')): | |
1750 | if self._currentlock(self._lockref) is None: |
|
1750 | if self._currentlock(self._lockref) is None: | |
1751 | raise error.ProgrammingError('transaction requires locking') |
|
1751 | raise error.ProgrammingError('transaction requires locking') | |
1752 | tr = self.currenttransaction() |
|
1752 | tr = self.currenttransaction() | |
1753 | if tr is not None: |
|
1753 | if tr is not None: | |
1754 | return tr.nest(name=desc) |
|
1754 | return tr.nest(name=desc) | |
1755 |
|
1755 | |||
1756 | # abort here if the journal already exists |
|
1756 | # abort here if the journal already exists | |
1757 | if self.svfs.exists("journal"): |
|
1757 | if self.svfs.exists("journal"): | |
1758 | raise error.RepoError( |
|
1758 | raise error.RepoError( | |
1759 | _("abandoned transaction found"), |
|
1759 | _("abandoned transaction found"), | |
1760 | hint=_("run 'hg recover' to clean up transaction")) |
|
1760 | hint=_("run 'hg recover' to clean up transaction")) | |
1761 |
|
1761 | |||
1762 | idbase = "%.40f#%f" % (random.random(), time.time()) |
|
1762 | idbase = "%.40f#%f" % (random.random(), time.time()) | |
1763 | ha = hex(hashlib.sha1(idbase).digest()) |
|
1763 | ha = hex(hashlib.sha1(idbase).digest()) | |
1764 | txnid = 'TXN:' + ha |
|
1764 | txnid = 'TXN:' + ha | |
1765 | self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid) |
|
1765 | self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid) | |
1766 |
|
1766 | |||
1767 | self._writejournal(desc) |
|
1767 | self._writejournal(desc) | |
1768 | renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] |
|
1768 | renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] | |
1769 | if report: |
|
1769 | if report: | |
1770 | rp = report |
|
1770 | rp = report | |
1771 | else: |
|
1771 | else: | |
1772 | rp = self.ui.warn |
|
1772 | rp = self.ui.warn | |
1773 | vfsmap = {'plain': self.vfs, 'store': self.svfs} # root of .hg/ |
|
1773 | vfsmap = {'plain': self.vfs, 'store': self.svfs} # root of .hg/ | |
1774 | # we must avoid cyclic reference between repo and transaction. |
|
1774 | # we must avoid cyclic reference between repo and transaction. | |
1775 | reporef = weakref.ref(self) |
|
1775 | reporef = weakref.ref(self) | |
1776 | # Code to track tag movement |
|
1776 | # Code to track tag movement | |
1777 | # |
|
1777 | # | |
1778 | # Since tags are all handled as file content, it is actually quite hard |
|
1778 | # Since tags are all handled as file content, it is actually quite hard | |
1779 | # to track these movement from a code perspective. So we fallback to a |
|
1779 | # to track these movement from a code perspective. So we fallback to a | |
1780 | # tracking at the repository level. One could envision to track changes |
|
1780 | # tracking at the repository level. One could envision to track changes | |
1781 | # to the '.hgtags' file through changegroup apply but that fails to |
|
1781 | # to the '.hgtags' file through changegroup apply but that fails to | |
1782 | # cope with case where transaction expose new heads without changegroup |
|
1782 | # cope with case where transaction expose new heads without changegroup | |
1783 | # being involved (eg: phase movement). |
|
1783 | # being involved (eg: phase movement). | |
1784 | # |
|
1784 | # | |
1785 | # For now, We gate the feature behind a flag since this likely comes |
|
1785 | # For now, We gate the feature behind a flag since this likely comes | |
1786 | # with performance impacts. The current code run more often than needed |
|
1786 | # with performance impacts. The current code run more often than needed | |
1787 | # and do not use caches as much as it could. The current focus is on |
|
1787 | # and do not use caches as much as it could. The current focus is on | |
1788 | # the behavior of the feature so we disable it by default. The flag |
|
1788 | # the behavior of the feature so we disable it by default. The flag | |
1789 | # will be removed when we are happy with the performance impact. |
|
1789 | # will be removed when we are happy with the performance impact. | |
1790 | # |
|
1790 | # | |
1791 | # Once this feature is no longer experimental move the following |
|
1791 | # Once this feature is no longer experimental move the following | |
1792 | # documentation to the appropriate help section: |
|
1792 | # documentation to the appropriate help section: | |
1793 | # |
|
1793 | # | |
1794 | # The ``HG_TAG_MOVED`` variable will be set if the transaction touched |
|
1794 | # The ``HG_TAG_MOVED`` variable will be set if the transaction touched | |
1795 | # tags (new or changed or deleted tags). In addition the details of |
|
1795 | # tags (new or changed or deleted tags). In addition the details of | |
1796 | # these changes are made available in a file at: |
|
1796 | # these changes are made available in a file at: | |
1797 | # ``REPOROOT/.hg/changes/tags.changes``. |
|
1797 | # ``REPOROOT/.hg/changes/tags.changes``. | |
1798 | # Make sure you check for HG_TAG_MOVED before reading that file as it |
|
1798 | # Make sure you check for HG_TAG_MOVED before reading that file as it | |
1799 | # might exist from a previous transaction even if no tag were touched |
|
1799 | # might exist from a previous transaction even if no tag were touched | |
1800 | # in this one. Changes are recorded in a line base format:: |
|
1800 | # in this one. Changes are recorded in a line base format:: | |
1801 | # |
|
1801 | # | |
1802 | # <action> <hex-node> <tag-name>\n |
|
1802 | # <action> <hex-node> <tag-name>\n | |
1803 | # |
|
1803 | # | |
1804 | # Actions are defined as follow: |
|
1804 | # Actions are defined as follow: | |
1805 | # "-R": tag is removed, |
|
1805 | # "-R": tag is removed, | |
1806 | # "+A": tag is added, |
|
1806 | # "+A": tag is added, | |
1807 | # "-M": tag is moved (old value), |
|
1807 | # "-M": tag is moved (old value), | |
1808 | # "+M": tag is moved (new value), |
|
1808 | # "+M": tag is moved (new value), | |
1809 | tracktags = lambda x: None |
|
1809 | tracktags = lambda x: None | |
1810 | # experimental config: experimental.hook-track-tags |
|
1810 | # experimental config: experimental.hook-track-tags | |
1811 | shouldtracktags = self.ui.configbool('experimental', 'hook-track-tags') |
|
1811 | shouldtracktags = self.ui.configbool('experimental', 'hook-track-tags') | |
1812 | if desc != 'strip' and shouldtracktags: |
|
1812 | if desc != 'strip' and shouldtracktags: | |
1813 | oldheads = self.changelog.headrevs() |
|
1813 | oldheads = self.changelog.headrevs() | |
1814 | def tracktags(tr2): |
|
1814 | def tracktags(tr2): | |
1815 | repo = reporef() |
|
1815 | repo = reporef() | |
1816 | oldfnodes = tagsmod.fnoderevs(repo.ui, repo, oldheads) |
|
1816 | oldfnodes = tagsmod.fnoderevs(repo.ui, repo, oldheads) | |
1817 | newheads = repo.changelog.headrevs() |
|
1817 | newheads = repo.changelog.headrevs() | |
1818 | newfnodes = tagsmod.fnoderevs(repo.ui, repo, newheads) |
|
1818 | newfnodes = tagsmod.fnoderevs(repo.ui, repo, newheads) | |
1819 | # notes: we compare lists here. |
|
1819 | # notes: we compare lists here. | |
1820 | # As we do it only once buiding set would not be cheaper |
|
1820 | # As we do it only once buiding set would not be cheaper | |
1821 | changes = tagsmod.difftags(repo.ui, repo, oldfnodes, newfnodes) |
|
1821 | changes = tagsmod.difftags(repo.ui, repo, oldfnodes, newfnodes) | |
1822 | if changes: |
|
1822 | if changes: | |
1823 | tr2.hookargs['tag_moved'] = '1' |
|
1823 | tr2.hookargs['tag_moved'] = '1' | |
1824 | with repo.vfs('changes/tags.changes', 'w', |
|
1824 | with repo.vfs('changes/tags.changes', 'w', | |
1825 | atomictemp=True) as changesfile: |
|
1825 | atomictemp=True) as changesfile: | |
1826 | # note: we do not register the file to the transaction |
|
1826 | # note: we do not register the file to the transaction | |
1827 | # because we needs it to still exist on the transaction |
|
1827 | # because we needs it to still exist on the transaction | |
1828 | # is close (for txnclose hooks) |
|
1828 | # is close (for txnclose hooks) | |
1829 | tagsmod.writediff(changesfile, changes) |
|
1829 | tagsmod.writediff(changesfile, changes) | |
1830 | def validate(tr2): |
|
1830 | def validate(tr2): | |
1831 | """will run pre-closing hooks""" |
|
1831 | """will run pre-closing hooks""" | |
1832 | # XXX the transaction API is a bit lacking here so we take a hacky |
|
1832 | # XXX the transaction API is a bit lacking here so we take a hacky | |
1833 | # path for now |
|
1833 | # path for now | |
1834 | # |
|
1834 | # | |
1835 | # We cannot add this as a "pending" hooks since the 'tr.hookargs' |
|
1835 | # We cannot add this as a "pending" hooks since the 'tr.hookargs' | |
1836 | # dict is copied before these run. In addition we needs the data |
|
1836 | # dict is copied before these run. In addition we needs the data | |
1837 | # available to in memory hooks too. |
|
1837 | # available to in memory hooks too. | |
1838 | # |
|
1838 | # | |
1839 | # Moreover, we also need to make sure this runs before txnclose |
|
1839 | # Moreover, we also need to make sure this runs before txnclose | |
1840 | # hooks and there is no "pending" mechanism that would execute |
|
1840 | # hooks and there is no "pending" mechanism that would execute | |
1841 | # logic only if hooks are about to run. |
|
1841 | # logic only if hooks are about to run. | |
1842 | # |
|
1842 | # | |
1843 | # Fixing this limitation of the transaction is also needed to track |
|
1843 | # Fixing this limitation of the transaction is also needed to track | |
1844 | # other families of changes (bookmarks, phases, obsolescence). |
|
1844 | # other families of changes (bookmarks, phases, obsolescence). | |
1845 | # |
|
1845 | # | |
1846 | # This will have to be fixed before we remove the experimental |
|
1846 | # This will have to be fixed before we remove the experimental | |
1847 | # gating. |
|
1847 | # gating. | |
1848 | tracktags(tr2) |
|
1848 | tracktags(tr2) | |
1849 | repo = reporef() |
|
1849 | repo = reporef() | |
1850 | if repo.ui.configbool('experimental', 'single-head-per-branch'): |
|
1850 | if repo.ui.configbool('experimental', 'single-head-per-branch'): | |
1851 | scmutil.enforcesinglehead(repo, tr2, desc) |
|
1851 | scmutil.enforcesinglehead(repo, tr2, desc) | |
1852 | if hook.hashook(repo.ui, 'pretxnclose-bookmark'): |
|
1852 | if hook.hashook(repo.ui, 'pretxnclose-bookmark'): | |
1853 | for name, (old, new) in sorted(tr.changes['bookmarks'].items()): |
|
1853 | for name, (old, new) in sorted(tr.changes['bookmarks'].items()): | |
1854 | args = tr.hookargs.copy() |
|
1854 | args = tr.hookargs.copy() | |
1855 | args.update(bookmarks.preparehookargs(name, old, new)) |
|
1855 | args.update(bookmarks.preparehookargs(name, old, new)) | |
1856 | repo.hook('pretxnclose-bookmark', throw=True, |
|
1856 | repo.hook('pretxnclose-bookmark', throw=True, | |
1857 | **pycompat.strkwargs(args)) |
|
1857 | **pycompat.strkwargs(args)) | |
1858 | if hook.hashook(repo.ui, 'pretxnclose-phase'): |
|
1858 | if hook.hashook(repo.ui, 'pretxnclose-phase'): | |
1859 | cl = repo.unfiltered().changelog |
|
1859 | cl = repo.unfiltered().changelog | |
1860 | for rev, (old, new) in tr.changes['phases'].items(): |
|
1860 | for rev, (old, new) in tr.changes['phases'].items(): | |
1861 | args = tr.hookargs.copy() |
|
1861 | args = tr.hookargs.copy() | |
1862 | node = hex(cl.node(rev)) |
|
1862 | node = hex(cl.node(rev)) | |
1863 | args.update(phases.preparehookargs(node, old, new)) |
|
1863 | args.update(phases.preparehookargs(node, old, new)) | |
1864 | repo.hook('pretxnclose-phase', throw=True, |
|
1864 | repo.hook('pretxnclose-phase', throw=True, | |
1865 | **pycompat.strkwargs(args)) |
|
1865 | **pycompat.strkwargs(args)) | |
1866 |
|
1866 | |||
1867 | repo.hook('pretxnclose', throw=True, |
|
1867 | repo.hook('pretxnclose', throw=True, | |
1868 | **pycompat.strkwargs(tr.hookargs)) |
|
1868 | **pycompat.strkwargs(tr.hookargs)) | |
1869 | def releasefn(tr, success): |
|
1869 | def releasefn(tr, success): | |
1870 | repo = reporef() |
|
1870 | repo = reporef() | |
1871 | if success: |
|
1871 | if success: | |
1872 | # this should be explicitly invoked here, because |
|
1872 | # this should be explicitly invoked here, because | |
1873 | # in-memory changes aren't written out at closing |
|
1873 | # in-memory changes aren't written out at closing | |
1874 | # transaction, if tr.addfilegenerator (via |
|
1874 | # transaction, if tr.addfilegenerator (via | |
1875 | # dirstate.write or so) isn't invoked while |
|
1875 | # dirstate.write or so) isn't invoked while | |
1876 | # transaction running |
|
1876 | # transaction running | |
1877 | repo.dirstate.write(None) |
|
1877 | repo.dirstate.write(None) | |
1878 | else: |
|
1878 | else: | |
1879 | # discard all changes (including ones already written |
|
1879 | # discard all changes (including ones already written | |
1880 | # out) in this transaction |
|
1880 | # out) in this transaction | |
1881 | narrowspec.restorebackup(self, 'journal.narrowspec') |
|
1881 | narrowspec.restorebackup(self, 'journal.narrowspec') | |
1882 | narrowspec.restorewcbackup(self, 'journal.narrowspec.dirstate') |
|
1882 | narrowspec.restorewcbackup(self, 'journal.narrowspec.dirstate') | |
1883 | repo.dirstate.restorebackup(None, 'journal.dirstate') |
|
1883 | repo.dirstate.restorebackup(None, 'journal.dirstate') | |
1884 |
|
1884 | |||
1885 | repo.invalidate(clearfilecache=True) |
|
1885 | repo.invalidate(clearfilecache=True) | |
1886 |
|
1886 | |||
1887 | tr = transaction.transaction(rp, self.svfs, vfsmap, |
|
1887 | tr = transaction.transaction(rp, self.svfs, vfsmap, | |
1888 | "journal", |
|
1888 | "journal", | |
1889 | "undo", |
|
1889 | "undo", | |
1890 | aftertrans(renames), |
|
1890 | aftertrans(renames), | |
1891 | self.store.createmode, |
|
1891 | self.store.createmode, | |
1892 | validator=validate, |
|
1892 | validator=validate, | |
1893 | releasefn=releasefn, |
|
1893 | releasefn=releasefn, | |
1894 | checkambigfiles=_cachedfiles, |
|
1894 | checkambigfiles=_cachedfiles, | |
1895 | name=desc) |
|
1895 | name=desc) | |
1896 | tr.changes['origrepolen'] = len(self) |
|
1896 | tr.changes['origrepolen'] = len(self) | |
1897 | tr.changes['obsmarkers'] = set() |
|
1897 | tr.changes['obsmarkers'] = set() | |
1898 | tr.changes['phases'] = {} |
|
1898 | tr.changes['phases'] = {} | |
1899 | tr.changes['bookmarks'] = {} |
|
1899 | tr.changes['bookmarks'] = {} | |
1900 |
|
1900 | |||
1901 | tr.hookargs['txnid'] = txnid |
|
1901 | tr.hookargs['txnid'] = txnid | |
1902 | tr.hookargs['txnname'] = desc |
|
1902 | tr.hookargs['txnname'] = desc | |
1903 | # note: writing the fncache only during finalize mean that the file is |
|
1903 | # note: writing the fncache only during finalize mean that the file is | |
1904 | # outdated when running hooks. As fncache is used for streaming clone, |
|
1904 | # outdated when running hooks. As fncache is used for streaming clone, | |
1905 | # this is not expected to break anything that happen during the hooks. |
|
1905 | # this is not expected to break anything that happen during the hooks. | |
1906 | tr.addfinalize('flush-fncache', self.store.write) |
|
1906 | tr.addfinalize('flush-fncache', self.store.write) | |
1907 | def txnclosehook(tr2): |
|
1907 | def txnclosehook(tr2): | |
1908 | """To be run if transaction is successful, will schedule a hook run |
|
1908 | """To be run if transaction is successful, will schedule a hook run | |
1909 | """ |
|
1909 | """ | |
1910 | # Don't reference tr2 in hook() so we don't hold a reference. |
|
1910 | # Don't reference tr2 in hook() so we don't hold a reference. | |
1911 | # This reduces memory consumption when there are multiple |
|
1911 | # This reduces memory consumption when there are multiple | |
1912 | # transactions per lock. This can likely go away if issue5045 |
|
1912 | # transactions per lock. This can likely go away if issue5045 | |
1913 | # fixes the function accumulation. |
|
1913 | # fixes the function accumulation. | |
1914 | hookargs = tr2.hookargs |
|
1914 | hookargs = tr2.hookargs | |
1915 |
|
1915 | |||
1916 | def hookfunc(): |
|
1916 | def hookfunc(): | |
1917 | repo = reporef() |
|
1917 | repo = reporef() | |
1918 | if hook.hashook(repo.ui, 'txnclose-bookmark'): |
|
1918 | if hook.hashook(repo.ui, 'txnclose-bookmark'): | |
1919 | bmchanges = sorted(tr.changes['bookmarks'].items()) |
|
1919 | bmchanges = sorted(tr.changes['bookmarks'].items()) | |
1920 | for name, (old, new) in bmchanges: |
|
1920 | for name, (old, new) in bmchanges: | |
1921 | args = tr.hookargs.copy() |
|
1921 | args = tr.hookargs.copy() | |
1922 | args.update(bookmarks.preparehookargs(name, old, new)) |
|
1922 | args.update(bookmarks.preparehookargs(name, old, new)) | |
1923 | repo.hook('txnclose-bookmark', throw=False, |
|
1923 | repo.hook('txnclose-bookmark', throw=False, | |
1924 | **pycompat.strkwargs(args)) |
|
1924 | **pycompat.strkwargs(args)) | |
1925 |
|
1925 | |||
1926 | if hook.hashook(repo.ui, 'txnclose-phase'): |
|
1926 | if hook.hashook(repo.ui, 'txnclose-phase'): | |
1927 | cl = repo.unfiltered().changelog |
|
1927 | cl = repo.unfiltered().changelog | |
1928 | phasemv = sorted(tr.changes['phases'].items()) |
|
1928 | phasemv = sorted(tr.changes['phases'].items()) | |
1929 | for rev, (old, new) in phasemv: |
|
1929 | for rev, (old, new) in phasemv: | |
1930 | args = tr.hookargs.copy() |
|
1930 | args = tr.hookargs.copy() | |
1931 | node = hex(cl.node(rev)) |
|
1931 | node = hex(cl.node(rev)) | |
1932 | args.update(phases.preparehookargs(node, old, new)) |
|
1932 | args.update(phases.preparehookargs(node, old, new)) | |
1933 | repo.hook('txnclose-phase', throw=False, |
|
1933 | repo.hook('txnclose-phase', throw=False, | |
1934 | **pycompat.strkwargs(args)) |
|
1934 | **pycompat.strkwargs(args)) | |
1935 |
|
1935 | |||
1936 | repo.hook('txnclose', throw=False, |
|
1936 | repo.hook('txnclose', throw=False, | |
1937 | **pycompat.strkwargs(hookargs)) |
|
1937 | **pycompat.strkwargs(hookargs)) | |
1938 | reporef()._afterlock(hookfunc) |
|
1938 | reporef()._afterlock(hookfunc) | |
1939 | tr.addfinalize('txnclose-hook', txnclosehook) |
|
1939 | tr.addfinalize('txnclose-hook', txnclosehook) | |
1940 | # Include a leading "-" to make it happen before the transaction summary |
|
1940 | # Include a leading "-" to make it happen before the transaction summary | |
1941 | # reports registered via scmutil.registersummarycallback() whose names |
|
1941 | # reports registered via scmutil.registersummarycallback() whose names | |
1942 | # are 00-txnreport etc. That way, the caches will be warm when the |
|
1942 | # are 00-txnreport etc. That way, the caches will be warm when the | |
1943 | # callbacks run. |
|
1943 | # callbacks run. | |
1944 | tr.addpostclose('-warm-cache', self._buildcacheupdater(tr)) |
|
1944 | tr.addpostclose('-warm-cache', self._buildcacheupdater(tr)) | |
1945 | def txnaborthook(tr2): |
|
1945 | def txnaborthook(tr2): | |
1946 | """To be run if transaction is aborted |
|
1946 | """To be run if transaction is aborted | |
1947 | """ |
|
1947 | """ | |
1948 | reporef().hook('txnabort', throw=False, |
|
1948 | reporef().hook('txnabort', throw=False, | |
1949 | **pycompat.strkwargs(tr2.hookargs)) |
|
1949 | **pycompat.strkwargs(tr2.hookargs)) | |
1950 | tr.addabort('txnabort-hook', txnaborthook) |
|
1950 | tr.addabort('txnabort-hook', txnaborthook) | |
1951 | # avoid eager cache invalidation. in-memory data should be identical |
|
1951 | # avoid eager cache invalidation. in-memory data should be identical | |
1952 | # to stored data if transaction has no error. |
|
1952 | # to stored data if transaction has no error. | |
1953 | tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats) |
|
1953 | tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats) | |
1954 | self._transref = weakref.ref(tr) |
|
1954 | self._transref = weakref.ref(tr) | |
1955 | scmutil.registersummarycallback(self, tr, desc) |
|
1955 | scmutil.registersummarycallback(self, tr, desc) | |
1956 | return tr |
|
1956 | return tr | |
1957 |
|
1957 | |||
1958 | def _journalfiles(self): |
|
1958 | def _journalfiles(self): | |
1959 | return ((self.svfs, 'journal'), |
|
1959 | return ((self.svfs, 'journal'), | |
1960 | (self.svfs, 'journal.narrowspec'), |
|
1960 | (self.svfs, 'journal.narrowspec'), | |
1961 | (self.vfs, 'journal.narrowspec.dirstate'), |
|
1961 | (self.vfs, 'journal.narrowspec.dirstate'), | |
1962 | (self.vfs, 'journal.dirstate'), |
|
1962 | (self.vfs, 'journal.dirstate'), | |
1963 | (self.vfs, 'journal.branch'), |
|
1963 | (self.vfs, 'journal.branch'), | |
1964 | (self.vfs, 'journal.desc'), |
|
1964 | (self.vfs, 'journal.desc'), | |
1965 | (self.vfs, 'journal.bookmarks'), |
|
1965 | (self.vfs, 'journal.bookmarks'), | |
1966 | (self.svfs, 'journal.phaseroots')) |
|
1966 | (self.svfs, 'journal.phaseroots')) | |
1967 |
|
1967 | |||
1968 | def undofiles(self): |
|
1968 | def undofiles(self): | |
1969 | return [(vfs, undoname(x)) for vfs, x in self._journalfiles()] |
|
1969 | return [(vfs, undoname(x)) for vfs, x in self._journalfiles()] | |
1970 |
|
1970 | |||
1971 | @unfilteredmethod |
|
1971 | @unfilteredmethod | |
1972 | def _writejournal(self, desc): |
|
1972 | def _writejournal(self, desc): | |
1973 | self.dirstate.savebackup(None, 'journal.dirstate') |
|
1973 | self.dirstate.savebackup(None, 'journal.dirstate') | |
1974 | narrowspec.savewcbackup(self, 'journal.narrowspec.dirstate') |
|
1974 | narrowspec.savewcbackup(self, 'journal.narrowspec.dirstate') | |
1975 | narrowspec.savebackup(self, 'journal.narrowspec') |
|
1975 | narrowspec.savebackup(self, 'journal.narrowspec') | |
1976 | self.vfs.write("journal.branch", |
|
1976 | self.vfs.write("journal.branch", | |
1977 | encoding.fromlocal(self.dirstate.branch())) |
|
1977 | encoding.fromlocal(self.dirstate.branch())) | |
1978 | self.vfs.write("journal.desc", |
|
1978 | self.vfs.write("journal.desc", | |
1979 | "%d\n%s\n" % (len(self), desc)) |
|
1979 | "%d\n%s\n" % (len(self), desc)) | |
1980 | self.vfs.write("journal.bookmarks", |
|
1980 | self.vfs.write("journal.bookmarks", | |
1981 | self.vfs.tryread("bookmarks")) |
|
1981 | self.vfs.tryread("bookmarks")) | |
1982 | self.svfs.write("journal.phaseroots", |
|
1982 | self.svfs.write("journal.phaseroots", | |
1983 | self.svfs.tryread("phaseroots")) |
|
1983 | self.svfs.tryread("phaseroots")) | |
1984 |
|
1984 | |||
1985 | def recover(self): |
|
1985 | def recover(self): | |
1986 | with self.lock(): |
|
1986 | with self.lock(): | |
1987 | if self.svfs.exists("journal"): |
|
1987 | if self.svfs.exists("journal"): | |
1988 | self.ui.status(_("rolling back interrupted transaction\n")) |
|
1988 | self.ui.status(_("rolling back interrupted transaction\n")) | |
1989 | vfsmap = {'': self.svfs, |
|
1989 | vfsmap = {'': self.svfs, | |
1990 | 'plain': self.vfs,} |
|
1990 | 'plain': self.vfs,} | |
1991 | transaction.rollback(self.svfs, vfsmap, "journal", |
|
1991 | transaction.rollback(self.svfs, vfsmap, "journal", | |
1992 | self.ui.warn, |
|
1992 | self.ui.warn, | |
1993 | checkambigfiles=_cachedfiles) |
|
1993 | checkambigfiles=_cachedfiles) | |
1994 | self.invalidate() |
|
1994 | self.invalidate() | |
1995 | return True |
|
1995 | return True | |
1996 | else: |
|
1996 | else: | |
1997 | self.ui.warn(_("no interrupted transaction available\n")) |
|
1997 | self.ui.warn(_("no interrupted transaction available\n")) | |
1998 | return False |
|
1998 | return False | |
1999 |
|
1999 | |||
2000 | def rollback(self, dryrun=False, force=False): |
|
2000 | def rollback(self, dryrun=False, force=False): | |
2001 | wlock = lock = dsguard = None |
|
2001 | wlock = lock = dsguard = None | |
2002 | try: |
|
2002 | try: | |
2003 | wlock = self.wlock() |
|
2003 | wlock = self.wlock() | |
2004 | lock = self.lock() |
|
2004 | lock = self.lock() | |
2005 | if self.svfs.exists("undo"): |
|
2005 | if self.svfs.exists("undo"): | |
2006 | dsguard = dirstateguard.dirstateguard(self, 'rollback') |
|
2006 | dsguard = dirstateguard.dirstateguard(self, 'rollback') | |
2007 |
|
2007 | |||
2008 | return self._rollback(dryrun, force, dsguard) |
|
2008 | return self._rollback(dryrun, force, dsguard) | |
2009 | else: |
|
2009 | else: | |
2010 | self.ui.warn(_("no rollback information available\n")) |
|
2010 | self.ui.warn(_("no rollback information available\n")) | |
2011 | return 1 |
|
2011 | return 1 | |
2012 | finally: |
|
2012 | finally: | |
2013 | release(dsguard, lock, wlock) |
|
2013 | release(dsguard, lock, wlock) | |
2014 |
|
2014 | |||
2015 | @unfilteredmethod # Until we get smarter cache management |
|
2015 | @unfilteredmethod # Until we get smarter cache management | |
2016 | def _rollback(self, dryrun, force, dsguard): |
|
2016 | def _rollback(self, dryrun, force, dsguard): | |
2017 | ui = self.ui |
|
2017 | ui = self.ui | |
2018 | try: |
|
2018 | try: | |
2019 | args = self.vfs.read('undo.desc').splitlines() |
|
2019 | args = self.vfs.read('undo.desc').splitlines() | |
2020 | (oldlen, desc, detail) = (int(args[0]), args[1], None) |
|
2020 | (oldlen, desc, detail) = (int(args[0]), args[1], None) | |
2021 | if len(args) >= 3: |
|
2021 | if len(args) >= 3: | |
2022 | detail = args[2] |
|
2022 | detail = args[2] | |
2023 | oldtip = oldlen - 1 |
|
2023 | oldtip = oldlen - 1 | |
2024 |
|
2024 | |||
2025 | if detail and ui.verbose: |
|
2025 | if detail and ui.verbose: | |
2026 | msg = (_('repository tip rolled back to revision %d' |
|
2026 | msg = (_('repository tip rolled back to revision %d' | |
2027 | ' (undo %s: %s)\n') |
|
2027 | ' (undo %s: %s)\n') | |
2028 | % (oldtip, desc, detail)) |
|
2028 | % (oldtip, desc, detail)) | |
2029 | else: |
|
2029 | else: | |
2030 | msg = (_('repository tip rolled back to revision %d' |
|
2030 | msg = (_('repository tip rolled back to revision %d' | |
2031 | ' (undo %s)\n') |
|
2031 | ' (undo %s)\n') | |
2032 | % (oldtip, desc)) |
|
2032 | % (oldtip, desc)) | |
2033 | except IOError: |
|
2033 | except IOError: | |
2034 | msg = _('rolling back unknown transaction\n') |
|
2034 | msg = _('rolling back unknown transaction\n') | |
2035 | desc = None |
|
2035 | desc = None | |
2036 |
|
2036 | |||
2037 | if not force and self['.'] != self['tip'] and desc == 'commit': |
|
2037 | if not force and self['.'] != self['tip'] and desc == 'commit': | |
2038 | raise error.Abort( |
|
2038 | raise error.Abort( | |
2039 | _('rollback of last commit while not checked out ' |
|
2039 | _('rollback of last commit while not checked out ' | |
2040 | 'may lose data'), hint=_('use -f to force')) |
|
2040 | 'may lose data'), hint=_('use -f to force')) | |
2041 |
|
2041 | |||
2042 | ui.status(msg) |
|
2042 | ui.status(msg) | |
2043 | if dryrun: |
|
2043 | if dryrun: | |
2044 | return 0 |
|
2044 | return 0 | |
2045 |
|
2045 | |||
2046 | parents = self.dirstate.parents() |
|
2046 | parents = self.dirstate.parents() | |
2047 | self.destroying() |
|
2047 | self.destroying() | |
2048 | vfsmap = {'plain': self.vfs, '': self.svfs} |
|
2048 | vfsmap = {'plain': self.vfs, '': self.svfs} | |
2049 | transaction.rollback(self.svfs, vfsmap, 'undo', ui.warn, |
|
2049 | transaction.rollback(self.svfs, vfsmap, 'undo', ui.warn, | |
2050 | checkambigfiles=_cachedfiles) |
|
2050 | checkambigfiles=_cachedfiles) | |
2051 | if self.vfs.exists('undo.bookmarks'): |
|
2051 | if self.vfs.exists('undo.bookmarks'): | |
2052 | self.vfs.rename('undo.bookmarks', 'bookmarks', checkambig=True) |
|
2052 | self.vfs.rename('undo.bookmarks', 'bookmarks', checkambig=True) | |
2053 | if self.svfs.exists('undo.phaseroots'): |
|
2053 | if self.svfs.exists('undo.phaseroots'): | |
2054 | self.svfs.rename('undo.phaseroots', 'phaseroots', checkambig=True) |
|
2054 | self.svfs.rename('undo.phaseroots', 'phaseroots', checkambig=True) | |
2055 | self.invalidate() |
|
2055 | self.invalidate() | |
2056 |
|
2056 | |||
2057 | parentgone = any(p not in self.changelog.nodemap for p in parents) |
|
2057 | parentgone = any(p not in self.changelog.nodemap for p in parents) | |
2058 | if parentgone: |
|
2058 | if parentgone: | |
2059 | # prevent dirstateguard from overwriting already restored one |
|
2059 | # prevent dirstateguard from overwriting already restored one | |
2060 | dsguard.close() |
|
2060 | dsguard.close() | |
2061 |
|
2061 | |||
2062 | narrowspec.restorebackup(self, 'undo.narrowspec') |
|
2062 | narrowspec.restorebackup(self, 'undo.narrowspec') | |
2063 | narrowspec.restorewcbackup(self, 'undo.narrowspec.dirstate') |
|
2063 | narrowspec.restorewcbackup(self, 'undo.narrowspec.dirstate') | |
2064 | self.dirstate.restorebackup(None, 'undo.dirstate') |
|
2064 | self.dirstate.restorebackup(None, 'undo.dirstate') | |
2065 | try: |
|
2065 | try: | |
2066 | branch = self.vfs.read('undo.branch') |
|
2066 | branch = self.vfs.read('undo.branch') | |
2067 | self.dirstate.setbranch(encoding.tolocal(branch)) |
|
2067 | self.dirstate.setbranch(encoding.tolocal(branch)) | |
2068 | except IOError: |
|
2068 | except IOError: | |
2069 | ui.warn(_('named branch could not be reset: ' |
|
2069 | ui.warn(_('named branch could not be reset: ' | |
2070 | 'current branch is still \'%s\'\n') |
|
2070 | 'current branch is still \'%s\'\n') | |
2071 | % self.dirstate.branch()) |
|
2071 | % self.dirstate.branch()) | |
2072 |
|
2072 | |||
2073 | parents = tuple([p.rev() for p in self[None].parents()]) |
|
2073 | parents = tuple([p.rev() for p in self[None].parents()]) | |
2074 | if len(parents) > 1: |
|
2074 | if len(parents) > 1: | |
2075 | ui.status(_('working directory now based on ' |
|
2075 | ui.status(_('working directory now based on ' | |
2076 | 'revisions %d and %d\n') % parents) |
|
2076 | 'revisions %d and %d\n') % parents) | |
2077 | else: |
|
2077 | else: | |
2078 | ui.status(_('working directory now based on ' |
|
2078 | ui.status(_('working directory now based on ' | |
2079 | 'revision %d\n') % parents) |
|
2079 | 'revision %d\n') % parents) | |
2080 | mergemod.mergestate.clean(self, self['.'].node()) |
|
2080 | mergemod.mergestate.clean(self, self['.'].node()) | |
2081 |
|
2081 | |||
2082 | # TODO: if we know which new heads may result from this rollback, pass |
|
2082 | # TODO: if we know which new heads may result from this rollback, pass | |
2083 | # them to destroy(), which will prevent the branchhead cache from being |
|
2083 | # them to destroy(), which will prevent the branchhead cache from being | |
2084 | # invalidated. |
|
2084 | # invalidated. | |
2085 | self.destroyed() |
|
2085 | self.destroyed() | |
2086 | return 0 |
|
2086 | return 0 | |
2087 |
|
2087 | |||
2088 | def _buildcacheupdater(self, newtransaction): |
|
2088 | def _buildcacheupdater(self, newtransaction): | |
2089 | """called during transaction to build the callback updating cache |
|
2089 | """called during transaction to build the callback updating cache | |
2090 |
|
2090 | |||
2091 | Lives on the repository to help extension who might want to augment |
|
2091 | Lives on the repository to help extension who might want to augment | |
2092 | this logic. For this purpose, the created transaction is passed to the |
|
2092 | this logic. For this purpose, the created transaction is passed to the | |
2093 | method. |
|
2093 | method. | |
2094 | """ |
|
2094 | """ | |
2095 | # we must avoid cyclic reference between repo and transaction. |
|
2095 | # we must avoid cyclic reference between repo and transaction. | |
2096 | reporef = weakref.ref(self) |
|
2096 | reporef = weakref.ref(self) | |
2097 | def updater(tr): |
|
2097 | def updater(tr): | |
2098 | repo = reporef() |
|
2098 | repo = reporef() | |
2099 | repo.updatecaches(tr) |
|
2099 | repo.updatecaches(tr) | |
2100 | return updater |
|
2100 | return updater | |
2101 |
|
2101 | |||
2102 | @unfilteredmethod |
|
2102 | @unfilteredmethod | |
2103 | def updatecaches(self, tr=None, full=False): |
|
2103 | def updatecaches(self, tr=None, full=False): | |
2104 | """warm appropriate caches |
|
2104 | """warm appropriate caches | |
2105 |
|
2105 | |||
2106 | If this function is called after a transaction closed. The transaction |
|
2106 | If this function is called after a transaction closed. The transaction | |
2107 | will be available in the 'tr' argument. This can be used to selectively |
|
2107 | will be available in the 'tr' argument. This can be used to selectively | |
2108 | update caches relevant to the changes in that transaction. |
|
2108 | update caches relevant to the changes in that transaction. | |
2109 |
|
2109 | |||
2110 | If 'full' is set, make sure all caches the function knows about have |
|
2110 | If 'full' is set, make sure all caches the function knows about have | |
2111 | up-to-date data. Even the ones usually loaded more lazily. |
|
2111 | up-to-date data. Even the ones usually loaded more lazily. | |
2112 | """ |
|
2112 | """ | |
2113 | if tr is not None and tr.hookargs.get('source') == 'strip': |
|
2113 | if tr is not None and tr.hookargs.get('source') == 'strip': | |
2114 | # During strip, many caches are invalid but |
|
2114 | # During strip, many caches are invalid but | |
2115 | # later call to `destroyed` will refresh them. |
|
2115 | # later call to `destroyed` will refresh them. | |
2116 | return |
|
2116 | return | |
2117 |
|
2117 | |||
2118 | if tr is None or tr.changes['origrepolen'] < len(self): |
|
2118 | if tr is None or tr.changes['origrepolen'] < len(self): | |
2119 | # accessing the 'ser ved' branchmap should refresh all the others, |
|
2119 | # accessing the 'ser ved' branchmap should refresh all the others, | |
2120 | self.ui.debug('updating the branch cache\n') |
|
2120 | self.ui.debug('updating the branch cache\n') | |
2121 | self.filtered('served').branchmap() |
|
2121 | self.filtered('served').branchmap() | |
2122 | self.filtered('served.hidden').branchmap() |
|
2122 | self.filtered('served.hidden').branchmap() | |
2123 |
|
2123 | |||
2124 | if full: |
|
2124 | if full: | |
2125 | unfi = self.unfiltered() |
|
2125 | unfi = self.unfiltered() | |
2126 | rbc = unfi.revbranchcache() |
|
2126 | rbc = unfi.revbranchcache() | |
2127 | for r in unfi.changelog: |
|
2127 | for r in unfi.changelog: | |
2128 | rbc.branchinfo(r) |
|
2128 | rbc.branchinfo(r) | |
2129 | rbc.write() |
|
2129 | rbc.write() | |
2130 |
|
2130 | |||
2131 | # ensure the working copy parents are in the manifestfulltextcache |
|
2131 | # ensure the working copy parents are in the manifestfulltextcache | |
2132 | for ctx in self['.'].parents(): |
|
2132 | for ctx in self['.'].parents(): | |
2133 | ctx.manifest() # accessing the manifest is enough |
|
2133 | ctx.manifest() # accessing the manifest is enough | |
2134 |
|
2134 | |||
2135 | # accessing fnode cache warms the cache |
|
2135 | # accessing fnode cache warms the cache | |
2136 | tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs()) |
|
2136 | tagsmod.fnoderevs(self.ui, unfi, unfi.changelog.revs()) | |
2137 | # accessing tags warm the cache |
|
2137 | # accessing tags warm the cache | |
2138 | self.tags() |
|
2138 | self.tags() | |
2139 | self.filtered('served').tags() |
|
2139 | self.filtered('served').tags() | |
2140 |
|
2140 | |||
2141 | def invalidatecaches(self): |
|
2141 | def invalidatecaches(self): | |
2142 |
|
2142 | |||
2143 | if r'_tagscache' in vars(self): |
|
2143 | if r'_tagscache' in vars(self): | |
2144 | # can't use delattr on proxy |
|
2144 | # can't use delattr on proxy | |
2145 | del self.__dict__[r'_tagscache'] |
|
2145 | del self.__dict__[r'_tagscache'] | |
2146 |
|
2146 | |||
2147 | self._branchcaches.clear() |
|
2147 | self._branchcaches.clear() | |
2148 | self.invalidatevolatilesets() |
|
2148 | self.invalidatevolatilesets() | |
2149 | self._sparsesignaturecache.clear() |
|
2149 | self._sparsesignaturecache.clear() | |
2150 |
|
2150 | |||
2151 | def invalidatevolatilesets(self): |
|
2151 | def invalidatevolatilesets(self): | |
2152 | self.filteredrevcache.clear() |
|
2152 | self.filteredrevcache.clear() | |
2153 | obsolete.clearobscaches(self) |
|
2153 | obsolete.clearobscaches(self) | |
2154 |
|
2154 | |||
2155 | def invalidatedirstate(self): |
|
2155 | def invalidatedirstate(self): | |
2156 | '''Invalidates the dirstate, causing the next call to dirstate |
|
2156 | '''Invalidates the dirstate, causing the next call to dirstate | |
2157 | to check if it was modified since the last time it was read, |
|
2157 | to check if it was modified since the last time it was read, | |
2158 | rereading it if it has. |
|
2158 | rereading it if it has. | |
2159 |
|
2159 | |||
2160 | This is different to dirstate.invalidate() that it doesn't always |
|
2160 | This is different to dirstate.invalidate() that it doesn't always | |
2161 | rereads the dirstate. Use dirstate.invalidate() if you want to |
|
2161 | rereads the dirstate. Use dirstate.invalidate() if you want to | |
2162 | explicitly read the dirstate again (i.e. restoring it to a previous |
|
2162 | explicitly read the dirstate again (i.e. restoring it to a previous | |
2163 | known good state).''' |
|
2163 | known good state).''' | |
2164 | if hasunfilteredcache(self, r'dirstate'): |
|
2164 | if hasunfilteredcache(self, r'dirstate'): | |
2165 | for k in self.dirstate._filecache: |
|
2165 | for k in self.dirstate._filecache: | |
2166 | try: |
|
2166 | try: | |
2167 | delattr(self.dirstate, k) |
|
2167 | delattr(self.dirstate, k) | |
2168 | except AttributeError: |
|
2168 | except AttributeError: | |
2169 | pass |
|
2169 | pass | |
2170 | delattr(self.unfiltered(), r'dirstate') |
|
2170 | delattr(self.unfiltered(), r'dirstate') | |
2171 |
|
2171 | |||
2172 | def invalidate(self, clearfilecache=False): |
|
2172 | def invalidate(self, clearfilecache=False): | |
2173 | '''Invalidates both store and non-store parts other than dirstate |
|
2173 | '''Invalidates both store and non-store parts other than dirstate | |
2174 |
|
2174 | |||
2175 | If a transaction is running, invalidation of store is omitted, |
|
2175 | If a transaction is running, invalidation of store is omitted, | |
2176 | because discarding in-memory changes might cause inconsistency |
|
2176 | because discarding in-memory changes might cause inconsistency | |
2177 | (e.g. incomplete fncache causes unintentional failure, but |
|
2177 | (e.g. incomplete fncache causes unintentional failure, but | |
2178 | redundant one doesn't). |
|
2178 | redundant one doesn't). | |
2179 | ''' |
|
2179 | ''' | |
2180 | unfiltered = self.unfiltered() # all file caches are stored unfiltered |
|
2180 | unfiltered = self.unfiltered() # all file caches are stored unfiltered | |
2181 | for k in list(self._filecache.keys()): |
|
2181 | for k in list(self._filecache.keys()): | |
2182 | # dirstate is invalidated separately in invalidatedirstate() |
|
2182 | # dirstate is invalidated separately in invalidatedirstate() | |
2183 | if k == 'dirstate': |
|
2183 | if k == 'dirstate': | |
2184 | continue |
|
2184 | continue | |
2185 | if (k == 'changelog' and |
|
2185 | if (k == 'changelog' and | |
2186 | self.currenttransaction() and |
|
2186 | self.currenttransaction() and | |
2187 | self.changelog._delayed): |
|
2187 | self.changelog._delayed): | |
2188 | # The changelog object may store unwritten revisions. We don't |
|
2188 | # The changelog object may store unwritten revisions. We don't | |
2189 | # want to lose them. |
|
2189 | # want to lose them. | |
2190 | # TODO: Solve the problem instead of working around it. |
|
2190 | # TODO: Solve the problem instead of working around it. | |
2191 | continue |
|
2191 | continue | |
2192 |
|
2192 | |||
2193 | if clearfilecache: |
|
2193 | if clearfilecache: | |
2194 | del self._filecache[k] |
|
2194 | del self._filecache[k] | |
2195 | try: |
|
2195 | try: | |
2196 | delattr(unfiltered, k) |
|
2196 | delattr(unfiltered, k) | |
2197 | except AttributeError: |
|
2197 | except AttributeError: | |
2198 | pass |
|
2198 | pass | |
2199 | self.invalidatecaches() |
|
2199 | self.invalidatecaches() | |
2200 | if not self.currenttransaction(): |
|
2200 | if not self.currenttransaction(): | |
2201 | # TODO: Changing contents of store outside transaction |
|
2201 | # TODO: Changing contents of store outside transaction | |
2202 | # causes inconsistency. We should make in-memory store |
|
2202 | # causes inconsistency. We should make in-memory store | |
2203 | # changes detectable, and abort if changed. |
|
2203 | # changes detectable, and abort if changed. | |
2204 | self.store.invalidatecaches() |
|
2204 | self.store.invalidatecaches() | |
2205 |
|
2205 | |||
2206 | def invalidateall(self): |
|
2206 | def invalidateall(self): | |
2207 | '''Fully invalidates both store and non-store parts, causing the |
|
2207 | '''Fully invalidates both store and non-store parts, causing the | |
2208 | subsequent operation to reread any outside changes.''' |
|
2208 | subsequent operation to reread any outside changes.''' | |
2209 | # extension should hook this to invalidate its caches |
|
2209 | # extension should hook this to invalidate its caches | |
2210 | self.invalidate() |
|
2210 | self.invalidate() | |
2211 | self.invalidatedirstate() |
|
2211 | self.invalidatedirstate() | |
2212 |
|
2212 | |||
2213 | @unfilteredmethod |
|
2213 | @unfilteredmethod | |
2214 | def _refreshfilecachestats(self, tr): |
|
2214 | def _refreshfilecachestats(self, tr): | |
2215 | """Reload stats of cached files so that they are flagged as valid""" |
|
2215 | """Reload stats of cached files so that they are flagged as valid""" | |
2216 | for k, ce in self._filecache.items(): |
|
2216 | for k, ce in self._filecache.items(): | |
2217 | k = pycompat.sysstr(k) |
|
2217 | k = pycompat.sysstr(k) | |
2218 | if k == r'dirstate' or k not in self.__dict__: |
|
2218 | if k == r'dirstate' or k not in self.__dict__: | |
2219 | continue |
|
2219 | continue | |
2220 | ce.refresh() |
|
2220 | ce.refresh() | |
2221 |
|
2221 | |||
2222 | def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc, |
|
2222 | def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc, | |
2223 | inheritchecker=None, parentenvvar=None): |
|
2223 | inheritchecker=None, parentenvvar=None): | |
2224 | parentlock = None |
|
2224 | parentlock = None | |
2225 | # the contents of parentenvvar are used by the underlying lock to |
|
2225 | # the contents of parentenvvar are used by the underlying lock to | |
2226 | # determine whether it can be inherited |
|
2226 | # determine whether it can be inherited | |
2227 | if parentenvvar is not None: |
|
2227 | if parentenvvar is not None: | |
2228 | parentlock = encoding.environ.get(parentenvvar) |
|
2228 | parentlock = encoding.environ.get(parentenvvar) | |
2229 |
|
2229 | |||
2230 | timeout = 0 |
|
2230 | timeout = 0 | |
2231 | warntimeout = 0 |
|
2231 | warntimeout = 0 | |
2232 | if wait: |
|
2232 | if wait: | |
2233 | timeout = self.ui.configint("ui", "timeout") |
|
2233 | timeout = self.ui.configint("ui", "timeout") | |
2234 | warntimeout = self.ui.configint("ui", "timeout.warn") |
|
2234 | warntimeout = self.ui.configint("ui", "timeout.warn") | |
2235 | # internal config: ui.signal-safe-lock |
|
2235 | # internal config: ui.signal-safe-lock | |
2236 | signalsafe = self.ui.configbool('ui', 'signal-safe-lock') |
|
2236 | signalsafe = self.ui.configbool('ui', 'signal-safe-lock') | |
2237 |
|
2237 | |||
2238 | l = lockmod.trylock(self.ui, vfs, lockname, timeout, warntimeout, |
|
2238 | l = lockmod.trylock(self.ui, vfs, lockname, timeout, warntimeout, | |
2239 | releasefn=releasefn, |
|
2239 | releasefn=releasefn, | |
2240 | acquirefn=acquirefn, desc=desc, |
|
2240 | acquirefn=acquirefn, desc=desc, | |
2241 | inheritchecker=inheritchecker, |
|
2241 | inheritchecker=inheritchecker, | |
2242 | parentlock=parentlock, |
|
2242 | parentlock=parentlock, | |
2243 | signalsafe=signalsafe) |
|
2243 | signalsafe=signalsafe) | |
2244 | return l |
|
2244 | return l | |
2245 |
|
2245 | |||
2246 | def _afterlock(self, callback): |
|
2246 | def _afterlock(self, callback): | |
2247 | """add a callback to be run when the repository is fully unlocked |
|
2247 | """add a callback to be run when the repository is fully unlocked | |
2248 |
|
2248 | |||
2249 | The callback will be executed when the outermost lock is released |
|
2249 | The callback will be executed when the outermost lock is released | |
2250 | (with wlock being higher level than 'lock').""" |
|
2250 | (with wlock being higher level than 'lock').""" | |
2251 | for ref in (self._wlockref, self._lockref): |
|
2251 | for ref in (self._wlockref, self._lockref): | |
2252 | l = ref and ref() |
|
2252 | l = ref and ref() | |
2253 | if l and l.held: |
|
2253 | if l and l.held: | |
2254 | l.postrelease.append(callback) |
|
2254 | l.postrelease.append(callback) | |
2255 | break |
|
2255 | break | |
2256 | else: # no lock have been found. |
|
2256 | else: # no lock have been found. | |
2257 | callback() |
|
2257 | callback() | |
2258 |
|
2258 | |||
2259 | def lock(self, wait=True): |
|
2259 | def lock(self, wait=True): | |
2260 | '''Lock the repository store (.hg/store) and return a weak reference |
|
2260 | '''Lock the repository store (.hg/store) and return a weak reference | |
2261 | to the lock. Use this before modifying the store (e.g. committing or |
|
2261 | to the lock. Use this before modifying the store (e.g. committing or | |
2262 | stripping). If you are opening a transaction, get a lock as well.) |
|
2262 | stripping). If you are opening a transaction, get a lock as well.) | |
2263 |
|
2263 | |||
2264 | If both 'lock' and 'wlock' must be acquired, ensure you always acquires |
|
2264 | If both 'lock' and 'wlock' must be acquired, ensure you always acquires | |
2265 | 'wlock' first to avoid a dead-lock hazard.''' |
|
2265 | 'wlock' first to avoid a dead-lock hazard.''' | |
2266 | l = self._currentlock(self._lockref) |
|
2266 | l = self._currentlock(self._lockref) | |
2267 | if l is not None: |
|
2267 | if l is not None: | |
2268 | l.lock() |
|
2268 | l.lock() | |
2269 | return l |
|
2269 | return l | |
2270 |
|
2270 | |||
2271 | l = self._lock(vfs=self.svfs, |
|
2271 | l = self._lock(vfs=self.svfs, | |
2272 | lockname="lock", |
|
2272 | lockname="lock", | |
2273 | wait=wait, |
|
2273 | wait=wait, | |
2274 | releasefn=None, |
|
2274 | releasefn=None, | |
2275 | acquirefn=self.invalidate, |
|
2275 | acquirefn=self.invalidate, | |
2276 | desc=_('repository %s') % self.origroot) |
|
2276 | desc=_('repository %s') % self.origroot) | |
2277 | self._lockref = weakref.ref(l) |
|
2277 | self._lockref = weakref.ref(l) | |
2278 | return l |
|
2278 | return l | |
2279 |
|
2279 | |||
2280 | def _wlockchecktransaction(self): |
|
2280 | def _wlockchecktransaction(self): | |
2281 | if self.currenttransaction() is not None: |
|
2281 | if self.currenttransaction() is not None: | |
2282 | raise error.LockInheritanceContractViolation( |
|
2282 | raise error.LockInheritanceContractViolation( | |
2283 | 'wlock cannot be inherited in the middle of a transaction') |
|
2283 | 'wlock cannot be inherited in the middle of a transaction') | |
2284 |
|
2284 | |||
2285 | def wlock(self, wait=True): |
|
2285 | def wlock(self, wait=True): | |
2286 | '''Lock the non-store parts of the repository (everything under |
|
2286 | '''Lock the non-store parts of the repository (everything under | |
2287 | .hg except .hg/store) and return a weak reference to the lock. |
|
2287 | .hg except .hg/store) and return a weak reference to the lock. | |
2288 |
|
2288 | |||
2289 | Use this before modifying files in .hg. |
|
2289 | Use this before modifying files in .hg. | |
2290 |
|
2290 | |||
2291 | If both 'lock' and 'wlock' must be acquired, ensure you always acquires |
|
2291 | If both 'lock' and 'wlock' must be acquired, ensure you always acquires | |
2292 | 'wlock' first to avoid a dead-lock hazard.''' |
|
2292 | 'wlock' first to avoid a dead-lock hazard.''' | |
2293 | l = self._wlockref and self._wlockref() |
|
2293 | l = self._wlockref and self._wlockref() | |
2294 | if l is not None and l.held: |
|
2294 | if l is not None and l.held: | |
2295 | l.lock() |
|
2295 | l.lock() | |
2296 | return l |
|
2296 | return l | |
2297 |
|
2297 | |||
2298 | # We do not need to check for non-waiting lock acquisition. Such |
|
2298 | # We do not need to check for non-waiting lock acquisition. Such | |
2299 | # acquisition would not cause dead-lock as they would just fail. |
|
2299 | # acquisition would not cause dead-lock as they would just fail. | |
2300 | if wait and (self.ui.configbool('devel', 'all-warnings') |
|
2300 | if wait and (self.ui.configbool('devel', 'all-warnings') | |
2301 | or self.ui.configbool('devel', 'check-locks')): |
|
2301 | or self.ui.configbool('devel', 'check-locks')): | |
2302 | if self._currentlock(self._lockref) is not None: |
|
2302 | if self._currentlock(self._lockref) is not None: | |
2303 | self.ui.develwarn('"wlock" acquired after "lock"') |
|
2303 | self.ui.develwarn('"wlock" acquired after "lock"') | |
2304 |
|
2304 | |||
2305 | def unlock(): |
|
2305 | def unlock(): | |
2306 | if self.dirstate.pendingparentchange(): |
|
2306 | if self.dirstate.pendingparentchange(): | |
2307 | self.dirstate.invalidate() |
|
2307 | self.dirstate.invalidate() | |
2308 | else: |
|
2308 | else: | |
2309 | self.dirstate.write(None) |
|
2309 | self.dirstate.write(None) | |
2310 |
|
2310 | |||
2311 | self._filecache['dirstate'].refresh() |
|
2311 | self._filecache['dirstate'].refresh() | |
2312 |
|
2312 | |||
2313 | l = self._lock(self.vfs, "wlock", wait, unlock, |
|
2313 | l = self._lock(self.vfs, "wlock", wait, unlock, | |
2314 | self.invalidatedirstate, _('working directory of %s') % |
|
2314 | self.invalidatedirstate, _('working directory of %s') % | |
2315 | self.origroot, |
|
2315 | self.origroot, | |
2316 | inheritchecker=self._wlockchecktransaction, |
|
2316 | inheritchecker=self._wlockchecktransaction, | |
2317 | parentenvvar='HG_WLOCK_LOCKER') |
|
2317 | parentenvvar='HG_WLOCK_LOCKER') | |
2318 | self._wlockref = weakref.ref(l) |
|
2318 | self._wlockref = weakref.ref(l) | |
2319 | return l |
|
2319 | return l | |
2320 |
|
2320 | |||
2321 | def _currentlock(self, lockref): |
|
2321 | def _currentlock(self, lockref): | |
2322 | """Returns the lock if it's held, or None if it's not.""" |
|
2322 | """Returns the lock if it's held, or None if it's not.""" | |
2323 | if lockref is None: |
|
2323 | if lockref is None: | |
2324 | return None |
|
2324 | return None | |
2325 | l = lockref() |
|
2325 | l = lockref() | |
2326 | if l is None or not l.held: |
|
2326 | if l is None or not l.held: | |
2327 | return None |
|
2327 | return None | |
2328 | return l |
|
2328 | return l | |
2329 |
|
2329 | |||
2330 | def currentwlock(self): |
|
2330 | def currentwlock(self): | |
2331 | """Returns the wlock if it's held, or None if it's not.""" |
|
2331 | """Returns the wlock if it's held, or None if it's not.""" | |
2332 | return self._currentlock(self._wlockref) |
|
2332 | return self._currentlock(self._wlockref) | |
2333 |
|
2333 | |||
2334 | def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist, |
|
2334 | def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist, | |
2335 | includecopymeta): |
|
2335 | includecopymeta): | |
2336 | """ |
|
2336 | """ | |
2337 | commit an individual file as part of a larger transaction |
|
2337 | commit an individual file as part of a larger transaction | |
2338 | """ |
|
2338 | """ | |
2339 |
|
2339 | |||
2340 | fname = fctx.path() |
|
2340 | fname = fctx.path() | |
2341 | fparent1 = manifest1.get(fname, nullid) |
|
2341 | fparent1 = manifest1.get(fname, nullid) | |
2342 | fparent2 = manifest2.get(fname, nullid) |
|
2342 | fparent2 = manifest2.get(fname, nullid) | |
2343 | if isinstance(fctx, context.filectx): |
|
2343 | if isinstance(fctx, context.filectx): | |
2344 | node = fctx.filenode() |
|
2344 | node = fctx.filenode() | |
2345 | if node in [fparent1, fparent2]: |
|
2345 | if node in [fparent1, fparent2]: | |
2346 | self.ui.debug('reusing %s filelog entry\n' % fname) |
|
2346 | self.ui.debug('reusing %s filelog entry\n' % fname) | |
2347 | if manifest1.flags(fname) != fctx.flags(): |
|
2347 | if manifest1.flags(fname) != fctx.flags(): | |
2348 | changelist.append(fname) |
|
2348 | changelist.append(fname) | |
2349 | return node |
|
2349 | return node | |
2350 |
|
2350 | |||
2351 | flog = self.file(fname) |
|
2351 | flog = self.file(fname) | |
2352 | meta = {} |
|
2352 | meta = {} | |
2353 | cfname = fctx.copysource() |
|
2353 | cfname = fctx.copysource() | |
2354 | if cfname and cfname != fname: |
|
2354 | if cfname and cfname != fname: | |
2355 | # Mark the new revision of this file as a copy of another |
|
2355 | # Mark the new revision of this file as a copy of another | |
2356 | # file. This copy data will effectively act as a parent |
|
2356 | # file. This copy data will effectively act as a parent | |
2357 | # of this new revision. If this is a merge, the first |
|
2357 | # of this new revision. If this is a merge, the first | |
2358 | # parent will be the nullid (meaning "look up the copy data") |
|
2358 | # parent will be the nullid (meaning "look up the copy data") | |
2359 | # and the second one will be the other parent. For example: |
|
2359 | # and the second one will be the other parent. For example: | |
2360 | # |
|
2360 | # | |
2361 | # 0 --- 1 --- 3 rev1 changes file foo |
|
2361 | # 0 --- 1 --- 3 rev1 changes file foo | |
2362 | # \ / rev2 renames foo to bar and changes it |
|
2362 | # \ / rev2 renames foo to bar and changes it | |
2363 | # \- 2 -/ rev3 should have bar with all changes and |
|
2363 | # \- 2 -/ rev3 should have bar with all changes and | |
2364 | # should record that bar descends from |
|
2364 | # should record that bar descends from | |
2365 | # bar in rev2 and foo in rev1 |
|
2365 | # bar in rev2 and foo in rev1 | |
2366 | # |
|
2366 | # | |
2367 | # this allows this merge to succeed: |
|
2367 | # this allows this merge to succeed: | |
2368 | # |
|
2368 | # | |
2369 | # 0 --- 1 --- 3 rev4 reverts the content change from rev2 |
|
2369 | # 0 --- 1 --- 3 rev4 reverts the content change from rev2 | |
2370 | # \ / merging rev3 and rev4 should use bar@rev2 |
|
2370 | # \ / merging rev3 and rev4 should use bar@rev2 | |
2371 | # \- 2 --- 4 as the merge base |
|
2371 | # \- 2 --- 4 as the merge base | |
2372 | # |
|
2372 | # | |
2373 |
|
2373 | |||
2374 | cnode = manifest1.get(cfname) |
|
2374 | cnode = manifest1.get(cfname) | |
2375 | newfparent = fparent2 |
|
2375 | newfparent = fparent2 | |
2376 |
|
2376 | |||
2377 | if manifest2: # branch merge |
|
2377 | if manifest2: # branch merge | |
2378 | if fparent2 == nullid or cnode is None: # copied on remote side |
|
2378 | if fparent2 == nullid or cnode is None: # copied on remote side | |
2379 | if cfname in manifest2: |
|
2379 | if cfname in manifest2: | |
2380 | cnode = manifest2[cfname] |
|
2380 | cnode = manifest2[cfname] | |
2381 | newfparent = fparent1 |
|
2381 | newfparent = fparent1 | |
2382 |
|
2382 | |||
2383 | # Here, we used to search backwards through history to try to find |
|
2383 | # Here, we used to search backwards through history to try to find | |
2384 | # where the file copy came from if the source of a copy was not in |
|
2384 | # where the file copy came from if the source of a copy was not in | |
2385 | # the parent directory. However, this doesn't actually make sense to |
|
2385 | # the parent directory. However, this doesn't actually make sense to | |
2386 | # do (what does a copy from something not in your working copy even |
|
2386 | # do (what does a copy from something not in your working copy even | |
2387 | # mean?) and it causes bugs (eg, issue4476). Instead, we will warn |
|
2387 | # mean?) and it causes bugs (eg, issue4476). Instead, we will warn | |
2388 | # the user that copy information was dropped, so if they didn't |
|
2388 | # the user that copy information was dropped, so if they didn't | |
2389 | # expect this outcome it can be fixed, but this is the correct |
|
2389 | # expect this outcome it can be fixed, but this is the correct | |
2390 | # behavior in this circumstance. |
|
2390 | # behavior in this circumstance. | |
2391 |
|
2391 | |||
2392 | if cnode: |
|
2392 | if cnode: | |
2393 | self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(cnode))) |
|
2393 | self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(cnode))) | |
2394 | if includecopymeta: |
|
2394 | if includecopymeta: | |
2395 | meta["copy"] = cfname |
|
2395 | meta["copy"] = cfname | |
2396 | meta["copyrev"] = hex(cnode) |
|
2396 | meta["copyrev"] = hex(cnode) | |
2397 | fparent1, fparent2 = nullid, newfparent |
|
2397 | fparent1, fparent2 = nullid, newfparent | |
2398 | else: |
|
2398 | else: | |
2399 | self.ui.warn(_("warning: can't find ancestor for '%s' " |
|
2399 | self.ui.warn(_("warning: can't find ancestor for '%s' " | |
2400 | "copied from '%s'!\n") % (fname, cfname)) |
|
2400 | "copied from '%s'!\n") % (fname, cfname)) | |
2401 |
|
2401 | |||
2402 | elif fparent1 == nullid: |
|
2402 | elif fparent1 == nullid: | |
2403 | fparent1, fparent2 = fparent2, nullid |
|
2403 | fparent1, fparent2 = fparent2, nullid | |
2404 | elif fparent2 != nullid: |
|
2404 | elif fparent2 != nullid: | |
2405 | # is one parent an ancestor of the other? |
|
2405 | # is one parent an ancestor of the other? | |
2406 | fparentancestors = flog.commonancestorsheads(fparent1, fparent2) |
|
2406 | fparentancestors = flog.commonancestorsheads(fparent1, fparent2) | |
2407 | if fparent1 in fparentancestors: |
|
2407 | if fparent1 in fparentancestors: | |
2408 | fparent1, fparent2 = fparent2, nullid |
|
2408 | fparent1, fparent2 = fparent2, nullid | |
2409 | elif fparent2 in fparentancestors: |
|
2409 | elif fparent2 in fparentancestors: | |
2410 | fparent2 = nullid |
|
2410 | fparent2 = nullid | |
2411 |
|
2411 | |||
2412 | # is the file changed? |
|
2412 | # is the file changed? | |
2413 | text = fctx.data() |
|
2413 | text = fctx.data() | |
2414 | if fparent2 != nullid or flog.cmp(fparent1, text) or meta: |
|
2414 | if fparent2 != nullid or flog.cmp(fparent1, text) or meta: | |
2415 | changelist.append(fname) |
|
2415 | changelist.append(fname) | |
2416 | return flog.add(text, meta, tr, linkrev, fparent1, fparent2) |
|
2416 | return flog.add(text, meta, tr, linkrev, fparent1, fparent2) | |
2417 | # are just the flags changed during merge? |
|
2417 | # are just the flags changed during merge? | |
2418 | elif fname in manifest1 and manifest1.flags(fname) != fctx.flags(): |
|
2418 | elif fname in manifest1 and manifest1.flags(fname) != fctx.flags(): | |
2419 | changelist.append(fname) |
|
2419 | changelist.append(fname) | |
2420 |
|
2420 | |||
2421 | return fparent1 |
|
2421 | return fparent1 | |
2422 |
|
2422 | |||
2423 | def checkcommitpatterns(self, wctx, vdirs, match, status, fail): |
|
2423 | def checkcommitpatterns(self, wctx, vdirs, match, status, fail): | |
2424 | """check for commit arguments that aren't committable""" |
|
2424 | """check for commit arguments that aren't committable""" | |
2425 | if match.isexact() or match.prefix(): |
|
2425 | if match.isexact() or match.prefix(): | |
2426 | matched = set(status.modified + status.added + status.removed) |
|
2426 | matched = set(status.modified + status.added + status.removed) | |
2427 |
|
2427 | |||
2428 | for f in match.files(): |
|
2428 | for f in match.files(): | |
2429 | f = self.dirstate.normalize(f) |
|
2429 | f = self.dirstate.normalize(f) | |
2430 | if f == '.' or f in matched or f in wctx.substate: |
|
2430 | if f == '.' or f in matched or f in wctx.substate: | |
2431 | continue |
|
2431 | continue | |
2432 | if f in status.deleted: |
|
2432 | if f in status.deleted: | |
2433 | fail(f, _('file not found!')) |
|
2433 | fail(f, _('file not found!')) | |
2434 | if f in vdirs: # visited directory |
|
2434 | if f in vdirs: # visited directory | |
2435 | d = f + '/' |
|
2435 | d = f + '/' | |
2436 | for mf in matched: |
|
2436 | for mf in matched: | |
2437 | if mf.startswith(d): |
|
2437 | if mf.startswith(d): | |
2438 | break |
|
2438 | break | |
2439 | else: |
|
2439 | else: | |
2440 | fail(f, _("no match under directory!")) |
|
2440 | fail(f, _("no match under directory!")) | |
2441 | elif f not in self.dirstate: |
|
2441 | elif f not in self.dirstate: | |
2442 | fail(f, _("file not tracked!")) |
|
2442 | fail(f, _("file not tracked!")) | |
2443 |
|
2443 | |||
2444 | @unfilteredmethod |
|
2444 | @unfilteredmethod | |
2445 | def commit(self, text="", user=None, date=None, match=None, force=False, |
|
2445 | def commit(self, text="", user=None, date=None, match=None, force=False, | |
2446 | editor=False, extra=None): |
|
2446 | editor=False, extra=None): | |
2447 | """Add a new revision to current repository. |
|
2447 | """Add a new revision to current repository. | |
2448 |
|
2448 | |||
2449 | Revision information is gathered from the working directory, |
|
2449 | Revision information is gathered from the working directory, | |
2450 | match can be used to filter the committed files. If editor is |
|
2450 | match can be used to filter the committed files. If editor is | |
2451 | supplied, it is called to get a commit message. |
|
2451 | supplied, it is called to get a commit message. | |
2452 | """ |
|
2452 | """ | |
2453 | if extra is None: |
|
2453 | if extra is None: | |
2454 | extra = {} |
|
2454 | extra = {} | |
2455 |
|
2455 | |||
2456 | def fail(f, msg): |
|
2456 | def fail(f, msg): | |
2457 | raise error.Abort('%s: %s' % (f, msg)) |
|
2457 | raise error.Abort('%s: %s' % (f, msg)) | |
2458 |
|
2458 | |||
2459 | if not match: |
|
2459 | if not match: | |
2460 | match = matchmod.always() |
|
2460 | match = matchmod.always() | |
2461 |
|
2461 | |||
2462 | if not force: |
|
2462 | if not force: | |
2463 | vdirs = [] |
|
2463 | vdirs = [] | |
2464 | match.explicitdir = vdirs.append |
|
2464 | match.explicitdir = vdirs.append | |
2465 | match.bad = fail |
|
2465 | match.bad = fail | |
2466 |
|
2466 | |||
2467 | # lock() for recent changelog (see issue4368) |
|
2467 | # lock() for recent changelog (see issue4368) | |
2468 | with self.wlock(), self.lock(): |
|
2468 | with self.wlock(), self.lock(): | |
2469 | wctx = self[None] |
|
2469 | wctx = self[None] | |
2470 | merge = len(wctx.parents()) > 1 |
|
2470 | merge = len(wctx.parents()) > 1 | |
2471 |
|
2471 | |||
2472 | if not force and merge and not match.always(): |
|
2472 | if not force and merge and not match.always(): | |
2473 | raise error.Abort(_('cannot partially commit a merge ' |
|
2473 | raise error.Abort(_('cannot partially commit a merge ' | |
2474 | '(do not specify files or patterns)')) |
|
2474 | '(do not specify files or patterns)')) | |
2475 |
|
2475 | |||
2476 | status = self.status(match=match, clean=force) |
|
2476 | status = self.status(match=match, clean=force) | |
2477 | if force: |
|
2477 | if force: | |
2478 | status.modified.extend(status.clean) # mq may commit clean files |
|
2478 | status.modified.extend(status.clean) # mq may commit clean files | |
2479 |
|
2479 | |||
2480 | # check subrepos |
|
2480 | # check subrepos | |
2481 | subs, commitsubs, newstate = subrepoutil.precommit( |
|
2481 | subs, commitsubs, newstate = subrepoutil.precommit( | |
2482 | self.ui, wctx, status, match, force=force) |
|
2482 | self.ui, wctx, status, match, force=force) | |
2483 |
|
2483 | |||
2484 | # make sure all explicit patterns are matched |
|
2484 | # make sure all explicit patterns are matched | |
2485 | if not force: |
|
2485 | if not force: | |
2486 | self.checkcommitpatterns(wctx, vdirs, match, status, fail) |
|
2486 | self.checkcommitpatterns(wctx, vdirs, match, status, fail) | |
2487 |
|
2487 | |||
2488 | cctx = context.workingcommitctx(self, status, |
|
2488 | cctx = context.workingcommitctx(self, status, | |
2489 | text, user, date, extra) |
|
2489 | text, user, date, extra) | |
2490 |
|
2490 | |||
2491 | # internal config: ui.allowemptycommit |
|
2491 | # internal config: ui.allowemptycommit | |
2492 | allowemptycommit = (wctx.branch() != wctx.p1().branch() |
|
2492 | allowemptycommit = (wctx.branch() != wctx.p1().branch() | |
2493 | or extra.get('close') or merge or cctx.files() |
|
2493 | or extra.get('close') or merge or cctx.files() | |
2494 | or self.ui.configbool('ui', 'allowemptycommit')) |
|
2494 | or self.ui.configbool('ui', 'allowemptycommit')) | |
2495 | if not allowemptycommit: |
|
2495 | if not allowemptycommit: | |
2496 | return None |
|
2496 | return None | |
2497 |
|
2497 | |||
2498 | if merge and cctx.deleted(): |
|
2498 | if merge and cctx.deleted(): | |
2499 | raise error.Abort(_("cannot commit merge with missing files")) |
|
2499 | raise error.Abort(_("cannot commit merge with missing files")) | |
2500 |
|
2500 | |||
2501 | ms = mergemod.mergestate.read(self) |
|
2501 | ms = mergemod.mergestate.read(self) | |
2502 | mergeutil.checkunresolved(ms) |
|
2502 | mergeutil.checkunresolved(ms) | |
2503 |
|
2503 | |||
2504 | if editor: |
|
2504 | if editor: | |
2505 | cctx._text = editor(self, cctx, subs) |
|
2505 | cctx._text = editor(self, cctx, subs) | |
2506 | edited = (text != cctx._text) |
|
2506 | edited = (text != cctx._text) | |
2507 |
|
2507 | |||
2508 | # Save commit message in case this transaction gets rolled back |
|
2508 | # Save commit message in case this transaction gets rolled back | |
2509 | # (e.g. by a pretxncommit hook). Leave the content alone on |
|
2509 | # (e.g. by a pretxncommit hook). Leave the content alone on | |
2510 | # the assumption that the user will use the same editor again. |
|
2510 | # the assumption that the user will use the same editor again. | |
2511 | msgfn = self.savecommitmessage(cctx._text) |
|
2511 | msgfn = self.savecommitmessage(cctx._text) | |
2512 |
|
2512 | |||
2513 | # commit subs and write new state |
|
2513 | # commit subs and write new state | |
2514 | if subs: |
|
2514 | if subs: | |
2515 | uipathfn = scmutil.getuipathfn(self) |
|
2515 | uipathfn = scmutil.getuipathfn(self) | |
2516 | for s in sorted(commitsubs): |
|
2516 | for s in sorted(commitsubs): | |
2517 | sub = wctx.sub(s) |
|
2517 | sub = wctx.sub(s) | |
2518 | self.ui.status(_('committing subrepository %s\n') % |
|
2518 | self.ui.status(_('committing subrepository %s\n') % | |
2519 | uipathfn(subrepoutil.subrelpath(sub))) |
|
2519 | uipathfn(subrepoutil.subrelpath(sub))) | |
2520 | sr = sub.commit(cctx._text, user, date) |
|
2520 | sr = sub.commit(cctx._text, user, date) | |
2521 | newstate[s] = (newstate[s][0], sr) |
|
2521 | newstate[s] = (newstate[s][0], sr) | |
2522 | subrepoutil.writestate(self, newstate) |
|
2522 | subrepoutil.writestate(self, newstate) | |
2523 |
|
2523 | |||
2524 | p1, p2 = self.dirstate.parents() |
|
2524 | p1, p2 = self.dirstate.parents() | |
2525 | hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '') |
|
2525 | hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '') | |
2526 | try: |
|
2526 | try: | |
2527 | self.hook("precommit", throw=True, parent1=hookp1, |
|
2527 | self.hook("precommit", throw=True, parent1=hookp1, | |
2528 | parent2=hookp2) |
|
2528 | parent2=hookp2) | |
2529 | with self.transaction('commit'): |
|
2529 | with self.transaction('commit'): | |
2530 | ret = self.commitctx(cctx, True) |
|
2530 | ret = self.commitctx(cctx, True) | |
2531 | # update bookmarks, dirstate and mergestate |
|
2531 | # update bookmarks, dirstate and mergestate | |
2532 | bookmarks.update(self, [p1, p2], ret) |
|
2532 | bookmarks.update(self, [p1, p2], ret) | |
2533 | cctx.markcommitted(ret) |
|
2533 | cctx.markcommitted(ret) | |
2534 | ms.reset() |
|
2534 | ms.reset() | |
2535 | except: # re-raises |
|
2535 | except: # re-raises | |
2536 | if edited: |
|
2536 | if edited: | |
2537 | self.ui.write( |
|
2537 | self.ui.write( | |
2538 | _('note: commit message saved in %s\n') % msgfn) |
|
2538 | _('note: commit message saved in %s\n') % msgfn) | |
2539 | raise |
|
2539 | raise | |
2540 |
|
2540 | |||
2541 | def commithook(): |
|
2541 | def commithook(): | |
2542 | # hack for command that use a temporary commit (eg: histedit) |
|
2542 | # hack for command that use a temporary commit (eg: histedit) | |
2543 | # temporary commit got stripped before hook release |
|
2543 | # temporary commit got stripped before hook release | |
2544 | if self.changelog.hasnode(ret): |
|
2544 | if self.changelog.hasnode(ret): | |
2545 | self.hook("commit", node=hex(ret), parent1=hookp1, |
|
2545 | self.hook("commit", node=hex(ret), parent1=hookp1, | |
2546 | parent2=hookp2) |
|
2546 | parent2=hookp2) | |
2547 | self._afterlock(commithook) |
|
2547 | self._afterlock(commithook) | |
2548 | return ret |
|
2548 | return ret | |
2549 |
|
2549 | |||
2550 | @unfilteredmethod |
|
2550 | @unfilteredmethod | |
2551 | def commitctx(self, ctx, error=False): |
|
2551 | def commitctx(self, ctx, error=False): | |
2552 | """Add a new revision to current repository. |
|
2552 | """Add a new revision to current repository. | |
2553 | Revision information is passed via the context argument. |
|
2553 | Revision information is passed via the context argument. | |
2554 |
|
2554 | |||
2555 | ctx.files() should list all files involved in this commit, i.e. |
|
2555 | ctx.files() should list all files involved in this commit, i.e. | |
2556 | modified/added/removed files. On merge, it may be wider than the |
|
2556 | modified/added/removed files. On merge, it may be wider than the | |
2557 | ctx.files() to be committed, since any file nodes derived directly |
|
2557 | ctx.files() to be committed, since any file nodes derived directly | |
2558 | from p1 or p2 are excluded from the committed ctx.files(). |
|
2558 | from p1 or p2 are excluded from the committed ctx.files(). | |
2559 | """ |
|
2559 | """ | |
2560 |
|
2560 | |||
2561 | p1, p2 = ctx.p1(), ctx.p2() |
|
2561 | p1, p2 = ctx.p1(), ctx.p2() | |
2562 | user = ctx.user() |
|
2562 | user = ctx.user() | |
2563 |
|
2563 | |||
2564 | writecopiesto = self.ui.config('experimental', 'copies.write-to') |
|
2564 | writecopiesto = self.ui.config('experimental', 'copies.write-to') | |
2565 | writefilecopymeta = writecopiesto != 'changeset-only' |
|
2565 | writefilecopymeta = writecopiesto != 'changeset-only' | |
2566 | p1copies, p2copies = None, None |
|
2566 | p1copies, p2copies = None, None | |
2567 | if writecopiesto in ('changeset-only', 'compatibility'): |
|
2567 | if writecopiesto in ('changeset-only', 'compatibility'): | |
2568 | p1copies = ctx.p1copies() |
|
2568 | p1copies = ctx.p1copies() | |
2569 | p2copies = ctx.p2copies() |
|
2569 | p2copies = ctx.p2copies() | |
2570 | with self.lock(), self.transaction("commit") as tr: |
|
2570 | with self.lock(), self.transaction("commit") as tr: | |
2571 | trp = weakref.proxy(tr) |
|
2571 | trp = weakref.proxy(tr) | |
2572 |
|
2572 | |||
2573 | if ctx.manifestnode(): |
|
2573 | if ctx.manifestnode(): | |
2574 | # reuse an existing manifest revision |
|
2574 | # reuse an existing manifest revision | |
2575 | self.ui.debug('reusing known manifest\n') |
|
2575 | self.ui.debug('reusing known manifest\n') | |
2576 | mn = ctx.manifestnode() |
|
2576 | mn = ctx.manifestnode() | |
2577 | files = ctx.files() |
|
2577 | files = ctx.files() | |
2578 | elif ctx.files(): |
|
2578 | elif ctx.files(): | |
2579 | m1ctx = p1.manifestctx() |
|
2579 | m1ctx = p1.manifestctx() | |
2580 | m2ctx = p2.manifestctx() |
|
2580 | m2ctx = p2.manifestctx() | |
2581 | mctx = m1ctx.copy() |
|
2581 | mctx = m1ctx.copy() | |
2582 |
|
2582 | |||
2583 | m = mctx.read() |
|
2583 | m = mctx.read() | |
2584 | m1 = m1ctx.read() |
|
2584 | m1 = m1ctx.read() | |
2585 | m2 = m2ctx.read() |
|
2585 | m2 = m2ctx.read() | |
2586 |
|
2586 | |||
2587 | # check in files |
|
2587 | # check in files | |
2588 | added = [] |
|
2588 | added = [] | |
2589 | changed = [] |
|
2589 | changed = [] | |
2590 | removed = list(ctx.removed()) |
|
2590 | removed = list(ctx.removed()) | |
2591 | linkrev = len(self) |
|
2591 | linkrev = len(self) | |
2592 | self.ui.note(_("committing files:\n")) |
|
2592 | self.ui.note(_("committing files:\n")) | |
2593 | uipathfn = scmutil.getuipathfn(self) |
|
2593 | uipathfn = scmutil.getuipathfn(self) | |
2594 | for f in sorted(ctx.modified() + ctx.added()): |
|
2594 | for f in sorted(ctx.modified() + ctx.added()): | |
2595 | self.ui.note(uipathfn(f) + "\n") |
|
2595 | self.ui.note(uipathfn(f) + "\n") | |
2596 | try: |
|
2596 | try: | |
2597 | fctx = ctx[f] |
|
2597 | fctx = ctx[f] | |
2598 | if fctx is None: |
|
2598 | if fctx is None: | |
2599 | removed.append(f) |
|
2599 | removed.append(f) | |
2600 | else: |
|
2600 | else: | |
2601 | added.append(f) |
|
2601 | added.append(f) | |
2602 | m[f] = self._filecommit(fctx, m1, m2, linkrev, |
|
2602 | m[f] = self._filecommit(fctx, m1, m2, linkrev, | |
2603 | trp, changed, |
|
2603 | trp, changed, | |
2604 | writefilecopymeta) |
|
2604 | writefilecopymeta) | |
2605 | m.setflag(f, fctx.flags()) |
|
2605 | m.setflag(f, fctx.flags()) | |
2606 | except OSError: |
|
2606 | except OSError: | |
2607 | self.ui.warn(_("trouble committing %s!\n") % |
|
2607 | self.ui.warn(_("trouble committing %s!\n") % | |
2608 | uipathfn(f)) |
|
2608 | uipathfn(f)) | |
2609 | raise |
|
2609 | raise | |
2610 | except IOError as inst: |
|
2610 | except IOError as inst: | |
2611 | errcode = getattr(inst, 'errno', errno.ENOENT) |
|
2611 | errcode = getattr(inst, 'errno', errno.ENOENT) | |
2612 | if error or errcode and errcode != errno.ENOENT: |
|
2612 | if error or errcode and errcode != errno.ENOENT: | |
2613 | self.ui.warn(_("trouble committing %s!\n") % |
|
2613 | self.ui.warn(_("trouble committing %s!\n") % | |
2614 | uipathfn(f)) |
|
2614 | uipathfn(f)) | |
2615 | raise |
|
2615 | raise | |
2616 |
|
2616 | |||
2617 | # update manifest |
|
2617 | # update manifest | |
2618 | removed = [f for f in sorted(removed) if f in m1 or f in m2] |
|
2618 | removed = [f for f in sorted(removed) if f in m1 or f in m2] | |
2619 | drop = [f for f in removed if f in m] |
|
2619 | drop = [f for f in removed if f in m] | |
2620 | for f in drop: |
|
2620 | for f in drop: | |
2621 | del m[f] |
|
2621 | del m[f] | |
2622 | files = changed + removed |
|
2622 | files = changed + removed | |
2623 | md = None |
|
2623 | md = None | |
2624 | if not files: |
|
2624 | if not files: | |
2625 | # if no "files" actually changed in terms of the changelog, |
|
2625 | # if no "files" actually changed in terms of the changelog, | |
2626 | # try hard to detect unmodified manifest entry so that the |
|
2626 | # try hard to detect unmodified manifest entry so that the | |
2627 | # exact same commit can be reproduced later on convert. |
|
2627 | # exact same commit can be reproduced later on convert. | |
2628 | md = m1.diff(m, scmutil.matchfiles(self, ctx.files())) |
|
2628 | md = m1.diff(m, scmutil.matchfiles(self, ctx.files())) | |
2629 | if not files and md: |
|
2629 | if not files and md: | |
2630 | self.ui.debug('not reusing manifest (no file change in ' |
|
2630 | self.ui.debug('not reusing manifest (no file change in ' | |
2631 | 'changelog, but manifest differs)\n') |
|
2631 | 'changelog, but manifest differs)\n') | |
2632 | if files or md: |
|
2632 | if files or md: | |
2633 | self.ui.note(_("committing manifest\n")) |
|
2633 | self.ui.note(_("committing manifest\n")) | |
2634 | # we're using narrowmatch here since it's already applied at |
|
2634 | # we're using narrowmatch here since it's already applied at | |
2635 | # other stages (such as dirstate.walk), so we're already |
|
2635 | # other stages (such as dirstate.walk), so we're already | |
2636 | # ignoring things outside of narrowspec in most cases. The |
|
2636 | # ignoring things outside of narrowspec in most cases. The | |
2637 | # one case where we might have files outside the narrowspec |
|
2637 | # one case where we might have files outside the narrowspec | |
2638 | # at this point is merges, and we already error out in the |
|
2638 | # at this point is merges, and we already error out in the | |
2639 | # case where the merge has files outside of the narrowspec, |
|
2639 | # case where the merge has files outside of the narrowspec, | |
2640 | # so this is safe. |
|
2640 | # so this is safe. | |
2641 | mn = mctx.write(trp, linkrev, |
|
2641 | mn = mctx.write(trp, linkrev, | |
2642 | p1.manifestnode(), p2.manifestnode(), |
|
2642 | p1.manifestnode(), p2.manifestnode(), | |
2643 | added, drop, match=self.narrowmatch()) |
|
2643 | added, drop, match=self.narrowmatch()) | |
2644 | else: |
|
2644 | else: | |
2645 |
self.ui.debug('reusing manifest f |
|
2645 | self.ui.debug('reusing manifest from p1 (listed files ' | |
2646 | 'actually unchanged)\n') |
|
2646 | 'actually unchanged)\n') | |
2647 | mn = p1.manifestnode() |
|
2647 | mn = p1.manifestnode() | |
2648 | else: |
|
2648 | else: | |
2649 | self.ui.debug('reusing manifest from p1 (no file change)\n') |
|
2649 | self.ui.debug('reusing manifest from p1 (no file change)\n') | |
2650 | mn = p1.manifestnode() |
|
2650 | mn = p1.manifestnode() | |
2651 | files = [] |
|
2651 | files = [] | |
2652 |
|
2652 | |||
2653 | # update changelog |
|
2653 | # update changelog | |
2654 | self.ui.note(_("committing changelog\n")) |
|
2654 | self.ui.note(_("committing changelog\n")) | |
2655 | self.changelog.delayupdate(tr) |
|
2655 | self.changelog.delayupdate(tr) | |
2656 | n = self.changelog.add(mn, files, ctx.description(), |
|
2656 | n = self.changelog.add(mn, files, ctx.description(), | |
2657 | trp, p1.node(), p2.node(), |
|
2657 | trp, p1.node(), p2.node(), | |
2658 | user, ctx.date(), ctx.extra().copy(), |
|
2658 | user, ctx.date(), ctx.extra().copy(), | |
2659 | p1copies, p2copies) |
|
2659 | p1copies, p2copies) | |
2660 | xp1, xp2 = p1.hex(), p2 and p2.hex() or '' |
|
2660 | xp1, xp2 = p1.hex(), p2 and p2.hex() or '' | |
2661 | self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, |
|
2661 | self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, | |
2662 | parent2=xp2) |
|
2662 | parent2=xp2) | |
2663 | # set the new commit is proper phase |
|
2663 | # set the new commit is proper phase | |
2664 | targetphase = subrepoutil.newcommitphase(self.ui, ctx) |
|
2664 | targetphase = subrepoutil.newcommitphase(self.ui, ctx) | |
2665 | if targetphase: |
|
2665 | if targetphase: | |
2666 | # retract boundary do not alter parent changeset. |
|
2666 | # retract boundary do not alter parent changeset. | |
2667 | # if a parent have higher the resulting phase will |
|
2667 | # if a parent have higher the resulting phase will | |
2668 | # be compliant anyway |
|
2668 | # be compliant anyway | |
2669 | # |
|
2669 | # | |
2670 | # if minimal phase was 0 we don't need to retract anything |
|
2670 | # if minimal phase was 0 we don't need to retract anything | |
2671 | phases.registernew(self, tr, targetphase, [n]) |
|
2671 | phases.registernew(self, tr, targetphase, [n]) | |
2672 | return n |
|
2672 | return n | |
2673 |
|
2673 | |||
2674 | @unfilteredmethod |
|
2674 | @unfilteredmethod | |
2675 | def destroying(self): |
|
2675 | def destroying(self): | |
2676 | '''Inform the repository that nodes are about to be destroyed. |
|
2676 | '''Inform the repository that nodes are about to be destroyed. | |
2677 | Intended for use by strip and rollback, so there's a common |
|
2677 | Intended for use by strip and rollback, so there's a common | |
2678 | place for anything that has to be done before destroying history. |
|
2678 | place for anything that has to be done before destroying history. | |
2679 |
|
2679 | |||
2680 | This is mostly useful for saving state that is in memory and waiting |
|
2680 | This is mostly useful for saving state that is in memory and waiting | |
2681 | to be flushed when the current lock is released. Because a call to |
|
2681 | to be flushed when the current lock is released. Because a call to | |
2682 | destroyed is imminent, the repo will be invalidated causing those |
|
2682 | destroyed is imminent, the repo will be invalidated causing those | |
2683 | changes to stay in memory (waiting for the next unlock), or vanish |
|
2683 | changes to stay in memory (waiting for the next unlock), or vanish | |
2684 | completely. |
|
2684 | completely. | |
2685 | ''' |
|
2685 | ''' | |
2686 | # When using the same lock to commit and strip, the phasecache is left |
|
2686 | # When using the same lock to commit and strip, the phasecache is left | |
2687 | # dirty after committing. Then when we strip, the repo is invalidated, |
|
2687 | # dirty after committing. Then when we strip, the repo is invalidated, | |
2688 | # causing those changes to disappear. |
|
2688 | # causing those changes to disappear. | |
2689 | if '_phasecache' in vars(self): |
|
2689 | if '_phasecache' in vars(self): | |
2690 | self._phasecache.write() |
|
2690 | self._phasecache.write() | |
2691 |
|
2691 | |||
2692 | @unfilteredmethod |
|
2692 | @unfilteredmethod | |
2693 | def destroyed(self): |
|
2693 | def destroyed(self): | |
2694 | '''Inform the repository that nodes have been destroyed. |
|
2694 | '''Inform the repository that nodes have been destroyed. | |
2695 | Intended for use by strip and rollback, so there's a common |
|
2695 | Intended for use by strip and rollback, so there's a common | |
2696 | place for anything that has to be done after destroying history. |
|
2696 | place for anything that has to be done after destroying history. | |
2697 | ''' |
|
2697 | ''' | |
2698 | # When one tries to: |
|
2698 | # When one tries to: | |
2699 | # 1) destroy nodes thus calling this method (e.g. strip) |
|
2699 | # 1) destroy nodes thus calling this method (e.g. strip) | |
2700 | # 2) use phasecache somewhere (e.g. commit) |
|
2700 | # 2) use phasecache somewhere (e.g. commit) | |
2701 | # |
|
2701 | # | |
2702 | # then 2) will fail because the phasecache contains nodes that were |
|
2702 | # then 2) will fail because the phasecache contains nodes that were | |
2703 | # removed. We can either remove phasecache from the filecache, |
|
2703 | # removed. We can either remove phasecache from the filecache, | |
2704 | # causing it to reload next time it is accessed, or simply filter |
|
2704 | # causing it to reload next time it is accessed, or simply filter | |
2705 | # the removed nodes now and write the updated cache. |
|
2705 | # the removed nodes now and write the updated cache. | |
2706 | self._phasecache.filterunknown(self) |
|
2706 | self._phasecache.filterunknown(self) | |
2707 | self._phasecache.write() |
|
2707 | self._phasecache.write() | |
2708 |
|
2708 | |||
2709 | # refresh all repository caches |
|
2709 | # refresh all repository caches | |
2710 | self.updatecaches() |
|
2710 | self.updatecaches() | |
2711 |
|
2711 | |||
2712 | # Ensure the persistent tag cache is updated. Doing it now |
|
2712 | # Ensure the persistent tag cache is updated. Doing it now | |
2713 | # means that the tag cache only has to worry about destroyed |
|
2713 | # means that the tag cache only has to worry about destroyed | |
2714 | # heads immediately after a strip/rollback. That in turn |
|
2714 | # heads immediately after a strip/rollback. That in turn | |
2715 | # guarantees that "cachetip == currenttip" (comparing both rev |
|
2715 | # guarantees that "cachetip == currenttip" (comparing both rev | |
2716 | # and node) always means no nodes have been added or destroyed. |
|
2716 | # and node) always means no nodes have been added or destroyed. | |
2717 |
|
2717 | |||
2718 | # XXX this is suboptimal when qrefresh'ing: we strip the current |
|
2718 | # XXX this is suboptimal when qrefresh'ing: we strip the current | |
2719 | # head, refresh the tag cache, then immediately add a new head. |
|
2719 | # head, refresh the tag cache, then immediately add a new head. | |
2720 | # But I think doing it this way is necessary for the "instant |
|
2720 | # But I think doing it this way is necessary for the "instant | |
2721 | # tag cache retrieval" case to work. |
|
2721 | # tag cache retrieval" case to work. | |
2722 | self.invalidate() |
|
2722 | self.invalidate() | |
2723 |
|
2723 | |||
2724 | def status(self, node1='.', node2=None, match=None, |
|
2724 | def status(self, node1='.', node2=None, match=None, | |
2725 | ignored=False, clean=False, unknown=False, |
|
2725 | ignored=False, clean=False, unknown=False, | |
2726 | listsubrepos=False): |
|
2726 | listsubrepos=False): | |
2727 | '''a convenience method that calls node1.status(node2)''' |
|
2727 | '''a convenience method that calls node1.status(node2)''' | |
2728 | return self[node1].status(node2, match, ignored, clean, unknown, |
|
2728 | return self[node1].status(node2, match, ignored, clean, unknown, | |
2729 | listsubrepos) |
|
2729 | listsubrepos) | |
2730 |
|
2730 | |||
2731 | def addpostdsstatus(self, ps): |
|
2731 | def addpostdsstatus(self, ps): | |
2732 | """Add a callback to run within the wlock, at the point at which status |
|
2732 | """Add a callback to run within the wlock, at the point at which status | |
2733 | fixups happen. |
|
2733 | fixups happen. | |
2734 |
|
2734 | |||
2735 | On status completion, callback(wctx, status) will be called with the |
|
2735 | On status completion, callback(wctx, status) will be called with the | |
2736 | wlock held, unless the dirstate has changed from underneath or the wlock |
|
2736 | wlock held, unless the dirstate has changed from underneath or the wlock | |
2737 | couldn't be grabbed. |
|
2737 | couldn't be grabbed. | |
2738 |
|
2738 | |||
2739 | Callbacks should not capture and use a cached copy of the dirstate -- |
|
2739 | Callbacks should not capture and use a cached copy of the dirstate -- | |
2740 | it might change in the meanwhile. Instead, they should access the |
|
2740 | it might change in the meanwhile. Instead, they should access the | |
2741 | dirstate via wctx.repo().dirstate. |
|
2741 | dirstate via wctx.repo().dirstate. | |
2742 |
|
2742 | |||
2743 | This list is emptied out after each status run -- extensions should |
|
2743 | This list is emptied out after each status run -- extensions should | |
2744 | make sure it adds to this list each time dirstate.status is called. |
|
2744 | make sure it adds to this list each time dirstate.status is called. | |
2745 | Extensions should also make sure they don't call this for statuses |
|
2745 | Extensions should also make sure they don't call this for statuses | |
2746 | that don't involve the dirstate. |
|
2746 | that don't involve the dirstate. | |
2747 | """ |
|
2747 | """ | |
2748 |
|
2748 | |||
2749 | # The list is located here for uniqueness reasons -- it is actually |
|
2749 | # The list is located here for uniqueness reasons -- it is actually | |
2750 | # managed by the workingctx, but that isn't unique per-repo. |
|
2750 | # managed by the workingctx, but that isn't unique per-repo. | |
2751 | self._postdsstatus.append(ps) |
|
2751 | self._postdsstatus.append(ps) | |
2752 |
|
2752 | |||
2753 | def postdsstatus(self): |
|
2753 | def postdsstatus(self): | |
2754 | """Used by workingctx to get the list of post-dirstate-status hooks.""" |
|
2754 | """Used by workingctx to get the list of post-dirstate-status hooks.""" | |
2755 | return self._postdsstatus |
|
2755 | return self._postdsstatus | |
2756 |
|
2756 | |||
2757 | def clearpostdsstatus(self): |
|
2757 | def clearpostdsstatus(self): | |
2758 | """Used by workingctx to clear post-dirstate-status hooks.""" |
|
2758 | """Used by workingctx to clear post-dirstate-status hooks.""" | |
2759 | del self._postdsstatus[:] |
|
2759 | del self._postdsstatus[:] | |
2760 |
|
2760 | |||
2761 | def heads(self, start=None): |
|
2761 | def heads(self, start=None): | |
2762 | if start is None: |
|
2762 | if start is None: | |
2763 | cl = self.changelog |
|
2763 | cl = self.changelog | |
2764 | headrevs = reversed(cl.headrevs()) |
|
2764 | headrevs = reversed(cl.headrevs()) | |
2765 | return [cl.node(rev) for rev in headrevs] |
|
2765 | return [cl.node(rev) for rev in headrevs] | |
2766 |
|
2766 | |||
2767 | heads = self.changelog.heads(start) |
|
2767 | heads = self.changelog.heads(start) | |
2768 | # sort the output in rev descending order |
|
2768 | # sort the output in rev descending order | |
2769 | return sorted(heads, key=self.changelog.rev, reverse=True) |
|
2769 | return sorted(heads, key=self.changelog.rev, reverse=True) | |
2770 |
|
2770 | |||
2771 | def branchheads(self, branch=None, start=None, closed=False): |
|
2771 | def branchheads(self, branch=None, start=None, closed=False): | |
2772 | '''return a (possibly filtered) list of heads for the given branch |
|
2772 | '''return a (possibly filtered) list of heads for the given branch | |
2773 |
|
2773 | |||
2774 | Heads are returned in topological order, from newest to oldest. |
|
2774 | Heads are returned in topological order, from newest to oldest. | |
2775 | If branch is None, use the dirstate branch. |
|
2775 | If branch is None, use the dirstate branch. | |
2776 | If start is not None, return only heads reachable from start. |
|
2776 | If start is not None, return only heads reachable from start. | |
2777 | If closed is True, return heads that are marked as closed as well. |
|
2777 | If closed is True, return heads that are marked as closed as well. | |
2778 | ''' |
|
2778 | ''' | |
2779 | if branch is None: |
|
2779 | if branch is None: | |
2780 | branch = self[None].branch() |
|
2780 | branch = self[None].branch() | |
2781 | branches = self.branchmap() |
|
2781 | branches = self.branchmap() | |
2782 | if not branches.hasbranch(branch): |
|
2782 | if not branches.hasbranch(branch): | |
2783 | return [] |
|
2783 | return [] | |
2784 | # the cache returns heads ordered lowest to highest |
|
2784 | # the cache returns heads ordered lowest to highest | |
2785 | bheads = list(reversed(branches.branchheads(branch, closed=closed))) |
|
2785 | bheads = list(reversed(branches.branchheads(branch, closed=closed))) | |
2786 | if start is not None: |
|
2786 | if start is not None: | |
2787 | # filter out the heads that cannot be reached from startrev |
|
2787 | # filter out the heads that cannot be reached from startrev | |
2788 | fbheads = set(self.changelog.nodesbetween([start], bheads)[2]) |
|
2788 | fbheads = set(self.changelog.nodesbetween([start], bheads)[2]) | |
2789 | bheads = [h for h in bheads if h in fbheads] |
|
2789 | bheads = [h for h in bheads if h in fbheads] | |
2790 | return bheads |
|
2790 | return bheads | |
2791 |
|
2791 | |||
2792 | def branches(self, nodes): |
|
2792 | def branches(self, nodes): | |
2793 | if not nodes: |
|
2793 | if not nodes: | |
2794 | nodes = [self.changelog.tip()] |
|
2794 | nodes = [self.changelog.tip()] | |
2795 | b = [] |
|
2795 | b = [] | |
2796 | for n in nodes: |
|
2796 | for n in nodes: | |
2797 | t = n |
|
2797 | t = n | |
2798 | while True: |
|
2798 | while True: | |
2799 | p = self.changelog.parents(n) |
|
2799 | p = self.changelog.parents(n) | |
2800 | if p[1] != nullid or p[0] == nullid: |
|
2800 | if p[1] != nullid or p[0] == nullid: | |
2801 | b.append((t, n, p[0], p[1])) |
|
2801 | b.append((t, n, p[0], p[1])) | |
2802 | break |
|
2802 | break | |
2803 | n = p[0] |
|
2803 | n = p[0] | |
2804 | return b |
|
2804 | return b | |
2805 |
|
2805 | |||
2806 | def between(self, pairs): |
|
2806 | def between(self, pairs): | |
2807 | r = [] |
|
2807 | r = [] | |
2808 |
|
2808 | |||
2809 | for top, bottom in pairs: |
|
2809 | for top, bottom in pairs: | |
2810 | n, l, i = top, [], 0 |
|
2810 | n, l, i = top, [], 0 | |
2811 | f = 1 |
|
2811 | f = 1 | |
2812 |
|
2812 | |||
2813 | while n != bottom and n != nullid: |
|
2813 | while n != bottom and n != nullid: | |
2814 | p = self.changelog.parents(n)[0] |
|
2814 | p = self.changelog.parents(n)[0] | |
2815 | if i == f: |
|
2815 | if i == f: | |
2816 | l.append(n) |
|
2816 | l.append(n) | |
2817 | f = f * 2 |
|
2817 | f = f * 2 | |
2818 | n = p |
|
2818 | n = p | |
2819 | i += 1 |
|
2819 | i += 1 | |
2820 |
|
2820 | |||
2821 | r.append(l) |
|
2821 | r.append(l) | |
2822 |
|
2822 | |||
2823 | return r |
|
2823 | return r | |
2824 |
|
2824 | |||
2825 | def checkpush(self, pushop): |
|
2825 | def checkpush(self, pushop): | |
2826 | """Extensions can override this function if additional checks have |
|
2826 | """Extensions can override this function if additional checks have | |
2827 | to be performed before pushing, or call it if they override push |
|
2827 | to be performed before pushing, or call it if they override push | |
2828 | command. |
|
2828 | command. | |
2829 | """ |
|
2829 | """ | |
2830 |
|
2830 | |||
2831 | @unfilteredpropertycache |
|
2831 | @unfilteredpropertycache | |
2832 | def prepushoutgoinghooks(self): |
|
2832 | def prepushoutgoinghooks(self): | |
2833 | """Return util.hooks consists of a pushop with repo, remote, outgoing |
|
2833 | """Return util.hooks consists of a pushop with repo, remote, outgoing | |
2834 | methods, which are called before pushing changesets. |
|
2834 | methods, which are called before pushing changesets. | |
2835 | """ |
|
2835 | """ | |
2836 | return util.hooks() |
|
2836 | return util.hooks() | |
2837 |
|
2837 | |||
2838 | def pushkey(self, namespace, key, old, new): |
|
2838 | def pushkey(self, namespace, key, old, new): | |
2839 | try: |
|
2839 | try: | |
2840 | tr = self.currenttransaction() |
|
2840 | tr = self.currenttransaction() | |
2841 | hookargs = {} |
|
2841 | hookargs = {} | |
2842 | if tr is not None: |
|
2842 | if tr is not None: | |
2843 | hookargs.update(tr.hookargs) |
|
2843 | hookargs.update(tr.hookargs) | |
2844 | hookargs = pycompat.strkwargs(hookargs) |
|
2844 | hookargs = pycompat.strkwargs(hookargs) | |
2845 | hookargs[r'namespace'] = namespace |
|
2845 | hookargs[r'namespace'] = namespace | |
2846 | hookargs[r'key'] = key |
|
2846 | hookargs[r'key'] = key | |
2847 | hookargs[r'old'] = old |
|
2847 | hookargs[r'old'] = old | |
2848 | hookargs[r'new'] = new |
|
2848 | hookargs[r'new'] = new | |
2849 | self.hook('prepushkey', throw=True, **hookargs) |
|
2849 | self.hook('prepushkey', throw=True, **hookargs) | |
2850 | except error.HookAbort as exc: |
|
2850 | except error.HookAbort as exc: | |
2851 | self.ui.write_err(_("pushkey-abort: %s\n") % exc) |
|
2851 | self.ui.write_err(_("pushkey-abort: %s\n") % exc) | |
2852 | if exc.hint: |
|
2852 | if exc.hint: | |
2853 | self.ui.write_err(_("(%s)\n") % exc.hint) |
|
2853 | self.ui.write_err(_("(%s)\n") % exc.hint) | |
2854 | return False |
|
2854 | return False | |
2855 | self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key)) |
|
2855 | self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key)) | |
2856 | ret = pushkey.push(self, namespace, key, old, new) |
|
2856 | ret = pushkey.push(self, namespace, key, old, new) | |
2857 | def runhook(): |
|
2857 | def runhook(): | |
2858 | self.hook('pushkey', namespace=namespace, key=key, old=old, new=new, |
|
2858 | self.hook('pushkey', namespace=namespace, key=key, old=old, new=new, | |
2859 | ret=ret) |
|
2859 | ret=ret) | |
2860 | self._afterlock(runhook) |
|
2860 | self._afterlock(runhook) | |
2861 | return ret |
|
2861 | return ret | |
2862 |
|
2862 | |||
2863 | def listkeys(self, namespace): |
|
2863 | def listkeys(self, namespace): | |
2864 | self.hook('prelistkeys', throw=True, namespace=namespace) |
|
2864 | self.hook('prelistkeys', throw=True, namespace=namespace) | |
2865 | self.ui.debug('listing keys for "%s"\n' % namespace) |
|
2865 | self.ui.debug('listing keys for "%s"\n' % namespace) | |
2866 | values = pushkey.list(self, namespace) |
|
2866 | values = pushkey.list(self, namespace) | |
2867 | self.hook('listkeys', namespace=namespace, values=values) |
|
2867 | self.hook('listkeys', namespace=namespace, values=values) | |
2868 | return values |
|
2868 | return values | |
2869 |
|
2869 | |||
2870 | def debugwireargs(self, one, two, three=None, four=None, five=None): |
|
2870 | def debugwireargs(self, one, two, three=None, four=None, five=None): | |
2871 | '''used to test argument passing over the wire''' |
|
2871 | '''used to test argument passing over the wire''' | |
2872 | return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three), |
|
2872 | return "%s %s %s %s %s" % (one, two, pycompat.bytestr(three), | |
2873 | pycompat.bytestr(four), |
|
2873 | pycompat.bytestr(four), | |
2874 | pycompat.bytestr(five)) |
|
2874 | pycompat.bytestr(five)) | |
2875 |
|
2875 | |||
2876 | def savecommitmessage(self, text): |
|
2876 | def savecommitmessage(self, text): | |
2877 | fp = self.vfs('last-message.txt', 'wb') |
|
2877 | fp = self.vfs('last-message.txt', 'wb') | |
2878 | try: |
|
2878 | try: | |
2879 | fp.write(text) |
|
2879 | fp.write(text) | |
2880 | finally: |
|
2880 | finally: | |
2881 | fp.close() |
|
2881 | fp.close() | |
2882 | return self.pathto(fp.name[len(self.root) + 1:]) |
|
2882 | return self.pathto(fp.name[len(self.root) + 1:]) | |
2883 |
|
2883 | |||
2884 | # used to avoid circular references so destructors work |
|
2884 | # used to avoid circular references so destructors work | |
2885 | def aftertrans(files): |
|
2885 | def aftertrans(files): | |
2886 | renamefiles = [tuple(t) for t in files] |
|
2886 | renamefiles = [tuple(t) for t in files] | |
2887 | def a(): |
|
2887 | def a(): | |
2888 | for vfs, src, dest in renamefiles: |
|
2888 | for vfs, src, dest in renamefiles: | |
2889 | # if src and dest refer to a same file, vfs.rename is a no-op, |
|
2889 | # if src and dest refer to a same file, vfs.rename is a no-op, | |
2890 | # leaving both src and dest on disk. delete dest to make sure |
|
2890 | # leaving both src and dest on disk. delete dest to make sure | |
2891 | # the rename couldn't be such a no-op. |
|
2891 | # the rename couldn't be such a no-op. | |
2892 | vfs.tryunlink(dest) |
|
2892 | vfs.tryunlink(dest) | |
2893 | try: |
|
2893 | try: | |
2894 | vfs.rename(src, dest) |
|
2894 | vfs.rename(src, dest) | |
2895 | except OSError: # journal file does not yet exist |
|
2895 | except OSError: # journal file does not yet exist | |
2896 | pass |
|
2896 | pass | |
2897 | return a |
|
2897 | return a | |
2898 |
|
2898 | |||
2899 | def undoname(fn): |
|
2899 | def undoname(fn): | |
2900 | base, name = os.path.split(fn) |
|
2900 | base, name = os.path.split(fn) | |
2901 | assert name.startswith('journal') |
|
2901 | assert name.startswith('journal') | |
2902 | return os.path.join(base, name.replace('journal', 'undo', 1)) |
|
2902 | return os.path.join(base, name.replace('journal', 'undo', 1)) | |
2903 |
|
2903 | |||
2904 | def instance(ui, path, create, intents=None, createopts=None): |
|
2904 | def instance(ui, path, create, intents=None, createopts=None): | |
2905 | localpath = util.urllocalpath(path) |
|
2905 | localpath = util.urllocalpath(path) | |
2906 | if create: |
|
2906 | if create: | |
2907 | createrepository(ui, localpath, createopts=createopts) |
|
2907 | createrepository(ui, localpath, createopts=createopts) | |
2908 |
|
2908 | |||
2909 | return makelocalrepository(ui, localpath, intents=intents) |
|
2909 | return makelocalrepository(ui, localpath, intents=intents) | |
2910 |
|
2910 | |||
2911 | def islocal(path): |
|
2911 | def islocal(path): | |
2912 | return True |
|
2912 | return True | |
2913 |
|
2913 | |||
2914 | def defaultcreateopts(ui, createopts=None): |
|
2914 | def defaultcreateopts(ui, createopts=None): | |
2915 | """Populate the default creation options for a repository. |
|
2915 | """Populate the default creation options for a repository. | |
2916 |
|
2916 | |||
2917 | A dictionary of explicitly requested creation options can be passed |
|
2917 | A dictionary of explicitly requested creation options can be passed | |
2918 | in. Missing keys will be populated. |
|
2918 | in. Missing keys will be populated. | |
2919 | """ |
|
2919 | """ | |
2920 | createopts = dict(createopts or {}) |
|
2920 | createopts = dict(createopts or {}) | |
2921 |
|
2921 | |||
2922 | if 'backend' not in createopts: |
|
2922 | if 'backend' not in createopts: | |
2923 | # experimental config: storage.new-repo-backend |
|
2923 | # experimental config: storage.new-repo-backend | |
2924 | createopts['backend'] = ui.config('storage', 'new-repo-backend') |
|
2924 | createopts['backend'] = ui.config('storage', 'new-repo-backend') | |
2925 |
|
2925 | |||
2926 | return createopts |
|
2926 | return createopts | |
2927 |
|
2927 | |||
2928 | def newreporequirements(ui, createopts): |
|
2928 | def newreporequirements(ui, createopts): | |
2929 | """Determine the set of requirements for a new local repository. |
|
2929 | """Determine the set of requirements for a new local repository. | |
2930 |
|
2930 | |||
2931 | Extensions can wrap this function to specify custom requirements for |
|
2931 | Extensions can wrap this function to specify custom requirements for | |
2932 | new repositories. |
|
2932 | new repositories. | |
2933 | """ |
|
2933 | """ | |
2934 | # If the repo is being created from a shared repository, we copy |
|
2934 | # If the repo is being created from a shared repository, we copy | |
2935 | # its requirements. |
|
2935 | # its requirements. | |
2936 | if 'sharedrepo' in createopts: |
|
2936 | if 'sharedrepo' in createopts: | |
2937 | requirements = set(createopts['sharedrepo'].requirements) |
|
2937 | requirements = set(createopts['sharedrepo'].requirements) | |
2938 | if createopts.get('sharedrelative'): |
|
2938 | if createopts.get('sharedrelative'): | |
2939 | requirements.add('relshared') |
|
2939 | requirements.add('relshared') | |
2940 | else: |
|
2940 | else: | |
2941 | requirements.add('shared') |
|
2941 | requirements.add('shared') | |
2942 |
|
2942 | |||
2943 | return requirements |
|
2943 | return requirements | |
2944 |
|
2944 | |||
2945 | if 'backend' not in createopts: |
|
2945 | if 'backend' not in createopts: | |
2946 | raise error.ProgrammingError('backend key not present in createopts; ' |
|
2946 | raise error.ProgrammingError('backend key not present in createopts; ' | |
2947 | 'was defaultcreateopts() called?') |
|
2947 | 'was defaultcreateopts() called?') | |
2948 |
|
2948 | |||
2949 | if createopts['backend'] != 'revlogv1': |
|
2949 | if createopts['backend'] != 'revlogv1': | |
2950 | raise error.Abort(_('unable to determine repository requirements for ' |
|
2950 | raise error.Abort(_('unable to determine repository requirements for ' | |
2951 | 'storage backend: %s') % createopts['backend']) |
|
2951 | 'storage backend: %s') % createopts['backend']) | |
2952 |
|
2952 | |||
2953 | requirements = {'revlogv1'} |
|
2953 | requirements = {'revlogv1'} | |
2954 | if ui.configbool('format', 'usestore'): |
|
2954 | if ui.configbool('format', 'usestore'): | |
2955 | requirements.add('store') |
|
2955 | requirements.add('store') | |
2956 | if ui.configbool('format', 'usefncache'): |
|
2956 | if ui.configbool('format', 'usefncache'): | |
2957 | requirements.add('fncache') |
|
2957 | requirements.add('fncache') | |
2958 | if ui.configbool('format', 'dotencode'): |
|
2958 | if ui.configbool('format', 'dotencode'): | |
2959 | requirements.add('dotencode') |
|
2959 | requirements.add('dotencode') | |
2960 |
|
2960 | |||
2961 | compengine = ui.config('format', 'revlog-compression') |
|
2961 | compengine = ui.config('format', 'revlog-compression') | |
2962 | if compengine not in util.compengines: |
|
2962 | if compengine not in util.compengines: | |
2963 | raise error.Abort(_('compression engine %s defined by ' |
|
2963 | raise error.Abort(_('compression engine %s defined by ' | |
2964 | 'format.revlog-compression not available') % |
|
2964 | 'format.revlog-compression not available') % | |
2965 | compengine, |
|
2965 | compengine, | |
2966 | hint=_('run "hg debuginstall" to list available ' |
|
2966 | hint=_('run "hg debuginstall" to list available ' | |
2967 | 'compression engines')) |
|
2967 | 'compression engines')) | |
2968 |
|
2968 | |||
2969 | # zlib is the historical default and doesn't need an explicit requirement. |
|
2969 | # zlib is the historical default and doesn't need an explicit requirement. | |
2970 | elif compengine == 'zstd': |
|
2970 | elif compengine == 'zstd': | |
2971 | requirements.add('revlog-compression-zstd') |
|
2971 | requirements.add('revlog-compression-zstd') | |
2972 | elif compengine != 'zlib': |
|
2972 | elif compengine != 'zlib': | |
2973 | requirements.add('exp-compression-%s' % compengine) |
|
2973 | requirements.add('exp-compression-%s' % compengine) | |
2974 |
|
2974 | |||
2975 | if scmutil.gdinitconfig(ui): |
|
2975 | if scmutil.gdinitconfig(ui): | |
2976 | requirements.add('generaldelta') |
|
2976 | requirements.add('generaldelta') | |
2977 | if ui.configbool('format', 'sparse-revlog'): |
|
2977 | if ui.configbool('format', 'sparse-revlog'): | |
2978 | requirements.add(SPARSEREVLOG_REQUIREMENT) |
|
2978 | requirements.add(SPARSEREVLOG_REQUIREMENT) | |
2979 | if ui.configbool('experimental', 'treemanifest'): |
|
2979 | if ui.configbool('experimental', 'treemanifest'): | |
2980 | requirements.add('treemanifest') |
|
2980 | requirements.add('treemanifest') | |
2981 |
|
2981 | |||
2982 | revlogv2 = ui.config('experimental', 'revlogv2') |
|
2982 | revlogv2 = ui.config('experimental', 'revlogv2') | |
2983 | if revlogv2 == 'enable-unstable-format-and-corrupt-my-data': |
|
2983 | if revlogv2 == 'enable-unstable-format-and-corrupt-my-data': | |
2984 | requirements.remove('revlogv1') |
|
2984 | requirements.remove('revlogv1') | |
2985 | # generaldelta is implied by revlogv2. |
|
2985 | # generaldelta is implied by revlogv2. | |
2986 | requirements.discard('generaldelta') |
|
2986 | requirements.discard('generaldelta') | |
2987 | requirements.add(REVLOGV2_REQUIREMENT) |
|
2987 | requirements.add(REVLOGV2_REQUIREMENT) | |
2988 | # experimental config: format.internal-phase |
|
2988 | # experimental config: format.internal-phase | |
2989 | if ui.configbool('format', 'internal-phase'): |
|
2989 | if ui.configbool('format', 'internal-phase'): | |
2990 | requirements.add('internal-phase') |
|
2990 | requirements.add('internal-phase') | |
2991 |
|
2991 | |||
2992 | if createopts.get('narrowfiles'): |
|
2992 | if createopts.get('narrowfiles'): | |
2993 | requirements.add(repository.NARROW_REQUIREMENT) |
|
2993 | requirements.add(repository.NARROW_REQUIREMENT) | |
2994 |
|
2994 | |||
2995 | if createopts.get('lfs'): |
|
2995 | if createopts.get('lfs'): | |
2996 | requirements.add('lfs') |
|
2996 | requirements.add('lfs') | |
2997 |
|
2997 | |||
2998 | return requirements |
|
2998 | return requirements | |
2999 |
|
2999 | |||
3000 | def filterknowncreateopts(ui, createopts): |
|
3000 | def filterknowncreateopts(ui, createopts): | |
3001 | """Filters a dict of repo creation options against options that are known. |
|
3001 | """Filters a dict of repo creation options against options that are known. | |
3002 |
|
3002 | |||
3003 | Receives a dict of repo creation options and returns a dict of those |
|
3003 | Receives a dict of repo creation options and returns a dict of those | |
3004 | options that we don't know how to handle. |
|
3004 | options that we don't know how to handle. | |
3005 |
|
3005 | |||
3006 | This function is called as part of repository creation. If the |
|
3006 | This function is called as part of repository creation. If the | |
3007 | returned dict contains any items, repository creation will not |
|
3007 | returned dict contains any items, repository creation will not | |
3008 | be allowed, as it means there was a request to create a repository |
|
3008 | be allowed, as it means there was a request to create a repository | |
3009 | with options not recognized by loaded code. |
|
3009 | with options not recognized by loaded code. | |
3010 |
|
3010 | |||
3011 | Extensions can wrap this function to filter out creation options |
|
3011 | Extensions can wrap this function to filter out creation options | |
3012 | they know how to handle. |
|
3012 | they know how to handle. | |
3013 | """ |
|
3013 | """ | |
3014 | known = { |
|
3014 | known = { | |
3015 | 'backend', |
|
3015 | 'backend', | |
3016 | 'lfs', |
|
3016 | 'lfs', | |
3017 | 'narrowfiles', |
|
3017 | 'narrowfiles', | |
3018 | 'sharedrepo', |
|
3018 | 'sharedrepo', | |
3019 | 'sharedrelative', |
|
3019 | 'sharedrelative', | |
3020 | 'shareditems', |
|
3020 | 'shareditems', | |
3021 | 'shallowfilestore', |
|
3021 | 'shallowfilestore', | |
3022 | } |
|
3022 | } | |
3023 |
|
3023 | |||
3024 | return {k: v for k, v in createopts.items() if k not in known} |
|
3024 | return {k: v for k, v in createopts.items() if k not in known} | |
3025 |
|
3025 | |||
3026 | def createrepository(ui, path, createopts=None): |
|
3026 | def createrepository(ui, path, createopts=None): | |
3027 | """Create a new repository in a vfs. |
|
3027 | """Create a new repository in a vfs. | |
3028 |
|
3028 | |||
3029 | ``path`` path to the new repo's working directory. |
|
3029 | ``path`` path to the new repo's working directory. | |
3030 | ``createopts`` options for the new repository. |
|
3030 | ``createopts`` options for the new repository. | |
3031 |
|
3031 | |||
3032 | The following keys for ``createopts`` are recognized: |
|
3032 | The following keys for ``createopts`` are recognized: | |
3033 |
|
3033 | |||
3034 | backend |
|
3034 | backend | |
3035 | The storage backend to use. |
|
3035 | The storage backend to use. | |
3036 | lfs |
|
3036 | lfs | |
3037 | Repository will be created with ``lfs`` requirement. The lfs extension |
|
3037 | Repository will be created with ``lfs`` requirement. The lfs extension | |
3038 | will automatically be loaded when the repository is accessed. |
|
3038 | will automatically be loaded when the repository is accessed. | |
3039 | narrowfiles |
|
3039 | narrowfiles | |
3040 | Set up repository to support narrow file storage. |
|
3040 | Set up repository to support narrow file storage. | |
3041 | sharedrepo |
|
3041 | sharedrepo | |
3042 | Repository object from which storage should be shared. |
|
3042 | Repository object from which storage should be shared. | |
3043 | sharedrelative |
|
3043 | sharedrelative | |
3044 | Boolean indicating if the path to the shared repo should be |
|
3044 | Boolean indicating if the path to the shared repo should be | |
3045 | stored as relative. By default, the pointer to the "parent" repo |
|
3045 | stored as relative. By default, the pointer to the "parent" repo | |
3046 | is stored as an absolute path. |
|
3046 | is stored as an absolute path. | |
3047 | shareditems |
|
3047 | shareditems | |
3048 | Set of items to share to the new repository (in addition to storage). |
|
3048 | Set of items to share to the new repository (in addition to storage). | |
3049 | shallowfilestore |
|
3049 | shallowfilestore | |
3050 | Indicates that storage for files should be shallow (not all ancestor |
|
3050 | Indicates that storage for files should be shallow (not all ancestor | |
3051 | revisions are known). |
|
3051 | revisions are known). | |
3052 | """ |
|
3052 | """ | |
3053 | createopts = defaultcreateopts(ui, createopts=createopts) |
|
3053 | createopts = defaultcreateopts(ui, createopts=createopts) | |
3054 |
|
3054 | |||
3055 | unknownopts = filterknowncreateopts(ui, createopts) |
|
3055 | unknownopts = filterknowncreateopts(ui, createopts) | |
3056 |
|
3056 | |||
3057 | if not isinstance(unknownopts, dict): |
|
3057 | if not isinstance(unknownopts, dict): | |
3058 | raise error.ProgrammingError('filterknowncreateopts() did not return ' |
|
3058 | raise error.ProgrammingError('filterknowncreateopts() did not return ' | |
3059 | 'a dict') |
|
3059 | 'a dict') | |
3060 |
|
3060 | |||
3061 | if unknownopts: |
|
3061 | if unknownopts: | |
3062 | raise error.Abort(_('unable to create repository because of unknown ' |
|
3062 | raise error.Abort(_('unable to create repository because of unknown ' | |
3063 | 'creation option: %s') % |
|
3063 | 'creation option: %s') % | |
3064 | ', '.join(sorted(unknownopts)), |
|
3064 | ', '.join(sorted(unknownopts)), | |
3065 | hint=_('is a required extension not loaded?')) |
|
3065 | hint=_('is a required extension not loaded?')) | |
3066 |
|
3066 | |||
3067 | requirements = newreporequirements(ui, createopts=createopts) |
|
3067 | requirements = newreporequirements(ui, createopts=createopts) | |
3068 |
|
3068 | |||
3069 | wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True) |
|
3069 | wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True) | |
3070 |
|
3070 | |||
3071 | hgvfs = vfsmod.vfs(wdirvfs.join(b'.hg')) |
|
3071 | hgvfs = vfsmod.vfs(wdirvfs.join(b'.hg')) | |
3072 | if hgvfs.exists(): |
|
3072 | if hgvfs.exists(): | |
3073 | raise error.RepoError(_('repository %s already exists') % path) |
|
3073 | raise error.RepoError(_('repository %s already exists') % path) | |
3074 |
|
3074 | |||
3075 | if 'sharedrepo' in createopts: |
|
3075 | if 'sharedrepo' in createopts: | |
3076 | sharedpath = createopts['sharedrepo'].sharedpath |
|
3076 | sharedpath = createopts['sharedrepo'].sharedpath | |
3077 |
|
3077 | |||
3078 | if createopts.get('sharedrelative'): |
|
3078 | if createopts.get('sharedrelative'): | |
3079 | try: |
|
3079 | try: | |
3080 | sharedpath = os.path.relpath(sharedpath, hgvfs.base) |
|
3080 | sharedpath = os.path.relpath(sharedpath, hgvfs.base) | |
3081 | except (IOError, ValueError) as e: |
|
3081 | except (IOError, ValueError) as e: | |
3082 | # ValueError is raised on Windows if the drive letters differ |
|
3082 | # ValueError is raised on Windows if the drive letters differ | |
3083 | # on each path. |
|
3083 | # on each path. | |
3084 | raise error.Abort(_('cannot calculate relative path'), |
|
3084 | raise error.Abort(_('cannot calculate relative path'), | |
3085 | hint=stringutil.forcebytestr(e)) |
|
3085 | hint=stringutil.forcebytestr(e)) | |
3086 |
|
3086 | |||
3087 | if not wdirvfs.exists(): |
|
3087 | if not wdirvfs.exists(): | |
3088 | wdirvfs.makedirs() |
|
3088 | wdirvfs.makedirs() | |
3089 |
|
3089 | |||
3090 | hgvfs.makedir(notindexed=True) |
|
3090 | hgvfs.makedir(notindexed=True) | |
3091 | if 'sharedrepo' not in createopts: |
|
3091 | if 'sharedrepo' not in createopts: | |
3092 | hgvfs.mkdir(b'cache') |
|
3092 | hgvfs.mkdir(b'cache') | |
3093 | hgvfs.mkdir(b'wcache') |
|
3093 | hgvfs.mkdir(b'wcache') | |
3094 |
|
3094 | |||
3095 | if b'store' in requirements and 'sharedrepo' not in createopts: |
|
3095 | if b'store' in requirements and 'sharedrepo' not in createopts: | |
3096 | hgvfs.mkdir(b'store') |
|
3096 | hgvfs.mkdir(b'store') | |
3097 |
|
3097 | |||
3098 | # We create an invalid changelog outside the store so very old |
|
3098 | # We create an invalid changelog outside the store so very old | |
3099 | # Mercurial versions (which didn't know about the requirements |
|
3099 | # Mercurial versions (which didn't know about the requirements | |
3100 | # file) encounter an error on reading the changelog. This |
|
3100 | # file) encounter an error on reading the changelog. This | |
3101 | # effectively locks out old clients and prevents them from |
|
3101 | # effectively locks out old clients and prevents them from | |
3102 | # mucking with a repo in an unknown format. |
|
3102 | # mucking with a repo in an unknown format. | |
3103 | # |
|
3103 | # | |
3104 | # The revlog header has version 2, which won't be recognized by |
|
3104 | # The revlog header has version 2, which won't be recognized by | |
3105 | # such old clients. |
|
3105 | # such old clients. | |
3106 | hgvfs.append(b'00changelog.i', |
|
3106 | hgvfs.append(b'00changelog.i', | |
3107 | b'\0\0\0\2 dummy changelog to prevent using the old repo ' |
|
3107 | b'\0\0\0\2 dummy changelog to prevent using the old repo ' | |
3108 | b'layout') |
|
3108 | b'layout') | |
3109 |
|
3109 | |||
3110 | scmutil.writerequires(hgvfs, requirements) |
|
3110 | scmutil.writerequires(hgvfs, requirements) | |
3111 |
|
3111 | |||
3112 | # Write out file telling readers where to find the shared store. |
|
3112 | # Write out file telling readers where to find the shared store. | |
3113 | if 'sharedrepo' in createopts: |
|
3113 | if 'sharedrepo' in createopts: | |
3114 | hgvfs.write(b'sharedpath', sharedpath) |
|
3114 | hgvfs.write(b'sharedpath', sharedpath) | |
3115 |
|
3115 | |||
3116 | if createopts.get('shareditems'): |
|
3116 | if createopts.get('shareditems'): | |
3117 | shared = b'\n'.join(sorted(createopts['shareditems'])) + b'\n' |
|
3117 | shared = b'\n'.join(sorted(createopts['shareditems'])) + b'\n' | |
3118 | hgvfs.write(b'shared', shared) |
|
3118 | hgvfs.write(b'shared', shared) | |
3119 |
|
3119 | |||
3120 | def poisonrepository(repo): |
|
3120 | def poisonrepository(repo): | |
3121 | """Poison a repository instance so it can no longer be used.""" |
|
3121 | """Poison a repository instance so it can no longer be used.""" | |
3122 | # Perform any cleanup on the instance. |
|
3122 | # Perform any cleanup on the instance. | |
3123 | repo.close() |
|
3123 | repo.close() | |
3124 |
|
3124 | |||
3125 | # Our strategy is to replace the type of the object with one that |
|
3125 | # Our strategy is to replace the type of the object with one that | |
3126 | # has all attribute lookups result in error. |
|
3126 | # has all attribute lookups result in error. | |
3127 | # |
|
3127 | # | |
3128 | # But we have to allow the close() method because some constructors |
|
3128 | # But we have to allow the close() method because some constructors | |
3129 | # of repos call close() on repo references. |
|
3129 | # of repos call close() on repo references. | |
3130 | class poisonedrepository(object): |
|
3130 | class poisonedrepository(object): | |
3131 | def __getattribute__(self, item): |
|
3131 | def __getattribute__(self, item): | |
3132 | if item == r'close': |
|
3132 | if item == r'close': | |
3133 | return object.__getattribute__(self, item) |
|
3133 | return object.__getattribute__(self, item) | |
3134 |
|
3134 | |||
3135 | raise error.ProgrammingError('repo instances should not be used ' |
|
3135 | raise error.ProgrammingError('repo instances should not be used ' | |
3136 | 'after unshare') |
|
3136 | 'after unshare') | |
3137 |
|
3137 | |||
3138 | def close(self): |
|
3138 | def close(self): | |
3139 | pass |
|
3139 | pass | |
3140 |
|
3140 | |||
3141 | # We may have a repoview, which intercepts __setattr__. So be sure |
|
3141 | # We may have a repoview, which intercepts __setattr__. So be sure | |
3142 | # we operate at the lowest level possible. |
|
3142 | # we operate at the lowest level possible. | |
3143 | object.__setattr__(repo, r'__class__', poisonedrepository) |
|
3143 | object.__setattr__(repo, r'__class__', poisonedrepository) |
@@ -1,2410 +1,2410 | |||||
1 | $ cat >> $HGRCPATH <<EOF |
|
1 | $ cat >> $HGRCPATH <<EOF | |
2 | > [extdiff] |
|
2 | > [extdiff] | |
3 | > # for portability: |
|
3 | > # for portability: | |
4 | > pdiff = sh "$RUNTESTDIR/pdiff" |
|
4 | > pdiff = sh "$RUNTESTDIR/pdiff" | |
5 | > EOF |
|
5 | > EOF | |
6 |
|
6 | |||
7 | Create a repo with some stuff in it: |
|
7 | Create a repo with some stuff in it: | |
8 |
|
8 | |||
9 | $ hg init a |
|
9 | $ hg init a | |
10 | $ cd a |
|
10 | $ cd a | |
11 | $ echo a > a |
|
11 | $ echo a > a | |
12 | $ echo a > d |
|
12 | $ echo a > d | |
13 | $ echo a > e |
|
13 | $ echo a > e | |
14 | $ hg ci -qAm0 |
|
14 | $ hg ci -qAm0 | |
15 | $ echo b > a |
|
15 | $ echo b > a | |
16 | $ hg ci -m1 -u bar |
|
16 | $ hg ci -m1 -u bar | |
17 | $ hg mv a b |
|
17 | $ hg mv a b | |
18 | $ hg ci -m2 |
|
18 | $ hg ci -m2 | |
19 | $ hg cp b c |
|
19 | $ hg cp b c | |
20 | $ hg ci -m3 -u baz |
|
20 | $ hg ci -m3 -u baz | |
21 | $ echo b > d |
|
21 | $ echo b > d | |
22 | $ echo f > e |
|
22 | $ echo f > e | |
23 | $ hg ci -m4 |
|
23 | $ hg ci -m4 | |
24 | $ hg up -q 3 |
|
24 | $ hg up -q 3 | |
25 | $ echo b > e |
|
25 | $ echo b > e | |
26 | $ hg branch -q stable |
|
26 | $ hg branch -q stable | |
27 | $ hg ci -m5 |
|
27 | $ hg ci -m5 | |
28 | $ hg merge -q default --tool internal:local # for conflicts in e, choose 5 and ignore 4 |
|
28 | $ hg merge -q default --tool internal:local # for conflicts in e, choose 5 and ignore 4 | |
29 | $ hg branch -q default |
|
29 | $ hg branch -q default | |
30 | $ hg ci -m6 |
|
30 | $ hg ci -m6 | |
31 | $ hg phase --public 3 |
|
31 | $ hg phase --public 3 | |
32 | $ hg phase --force --secret 6 |
|
32 | $ hg phase --force --secret 6 | |
33 |
|
33 | |||
34 | $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n' |
|
34 | $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n' | |
35 | @ test@6.secret: 6 |
|
35 | @ test@6.secret: 6 | |
36 | |\ |
|
36 | |\ | |
37 | | o test@5.draft: 5 |
|
37 | | o test@5.draft: 5 | |
38 | | | |
|
38 | | | | |
39 | o | test@4.draft: 4 |
|
39 | o | test@4.draft: 4 | |
40 | |/ |
|
40 | |/ | |
41 | o baz@3.public: 3 |
|
41 | o baz@3.public: 3 | |
42 | | |
|
42 | | | |
43 | o test@2.public: 2 |
|
43 | o test@2.public: 2 | |
44 | | |
|
44 | | | |
45 | o bar@1.public: 1 |
|
45 | o bar@1.public: 1 | |
46 | | |
|
46 | | | |
47 | o test@0.public: 0 |
|
47 | o test@0.public: 0 | |
48 |
|
48 | |||
49 | Test --base for grafting the merge of 4 from the perspective of 5, thus only getting the change to d |
|
49 | Test --base for grafting the merge of 4 from the perspective of 5, thus only getting the change to d | |
50 |
|
50 | |||
51 | $ hg up -cqr 3 |
|
51 | $ hg up -cqr 3 | |
52 | $ hg graft -r 6 --base 5 |
|
52 | $ hg graft -r 6 --base 5 | |
53 | grafting 6:25a2b029d3ae "6" (tip) |
|
53 | grafting 6:25a2b029d3ae "6" (tip) | |
54 | merging e |
|
54 | merging e | |
55 | $ hg st --change . |
|
55 | $ hg st --change . | |
56 | M d |
|
56 | M d | |
57 |
|
57 | |||
58 | $ hg -q strip . --config extensions.strip= |
|
58 | $ hg -q strip . --config extensions.strip= | |
59 |
|
59 | |||
60 | Test --base for collapsing changesets 2 and 3, thus getting both b and c |
|
60 | Test --base for collapsing changesets 2 and 3, thus getting both b and c | |
61 |
|
61 | |||
62 | $ hg up -cqr 0 |
|
62 | $ hg up -cqr 0 | |
63 | $ hg graft -r 3 --base 1 |
|
63 | $ hg graft -r 3 --base 1 | |
64 | grafting 3:4c60f11aa304 "3" |
|
64 | grafting 3:4c60f11aa304 "3" | |
65 | merging a and b to b |
|
65 | merging a and b to b | |
66 | merging a and c to c |
|
66 | merging a and c to c | |
67 | $ hg st --change . |
|
67 | $ hg st --change . | |
68 | A b |
|
68 | A b | |
69 | A c |
|
69 | A c | |
70 | R a |
|
70 | R a | |
71 |
|
71 | |||
72 | $ hg -q strip . --config extensions.strip= |
|
72 | $ hg -q strip . --config extensions.strip= | |
73 |
|
73 | |||
74 | Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent) |
|
74 | Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent) | |
75 |
|
75 | |||
76 | $ hg graft -r 2 --base 3 |
|
76 | $ hg graft -r 2 --base 3 | |
77 | grafting 2:5c095ad7e90f "2" |
|
77 | grafting 2:5c095ad7e90f "2" | |
78 | note: possible conflict - c was deleted and renamed to: |
|
78 | note: possible conflict - c was deleted and renamed to: | |
79 | a |
|
79 | a | |
80 | note: graft of 2:5c095ad7e90f created no changes to commit |
|
80 | note: graft of 2:5c095ad7e90f created no changes to commit | |
81 |
|
81 | |||
82 | Can't continue without starting: |
|
82 | Can't continue without starting: | |
83 |
|
83 | |||
84 | $ hg -q up -cr tip |
|
84 | $ hg -q up -cr tip | |
85 | $ hg rm -q e |
|
85 | $ hg rm -q e | |
86 | $ hg graft --continue |
|
86 | $ hg graft --continue | |
87 | abort: no graft in progress |
|
87 | abort: no graft in progress | |
88 | [255] |
|
88 | [255] | |
89 | $ hg revert -r . -q e |
|
89 | $ hg revert -r . -q e | |
90 |
|
90 | |||
91 | Need to specify a rev: |
|
91 | Need to specify a rev: | |
92 |
|
92 | |||
93 | $ hg graft |
|
93 | $ hg graft | |
94 | abort: no revisions specified |
|
94 | abort: no revisions specified | |
95 | [255] |
|
95 | [255] | |
96 |
|
96 | |||
97 | Can't graft ancestor: |
|
97 | Can't graft ancestor: | |
98 |
|
98 | |||
99 | $ hg graft 1 2 |
|
99 | $ hg graft 1 2 | |
100 | skipping ancestor revision 1:5d205f8b35b6 |
|
100 | skipping ancestor revision 1:5d205f8b35b6 | |
101 | skipping ancestor revision 2:5c095ad7e90f |
|
101 | skipping ancestor revision 2:5c095ad7e90f | |
102 | [255] |
|
102 | [255] | |
103 |
|
103 | |||
104 | Specify revisions with -r: |
|
104 | Specify revisions with -r: | |
105 |
|
105 | |||
106 | $ hg graft -r 1 -r 2 |
|
106 | $ hg graft -r 1 -r 2 | |
107 | skipping ancestor revision 1:5d205f8b35b6 |
|
107 | skipping ancestor revision 1:5d205f8b35b6 | |
108 | skipping ancestor revision 2:5c095ad7e90f |
|
108 | skipping ancestor revision 2:5c095ad7e90f | |
109 | [255] |
|
109 | [255] | |
110 |
|
110 | |||
111 | $ hg graft -r 1 2 |
|
111 | $ hg graft -r 1 2 | |
112 | warning: inconsistent use of --rev might give unexpected revision ordering! |
|
112 | warning: inconsistent use of --rev might give unexpected revision ordering! | |
113 | skipping ancestor revision 2:5c095ad7e90f |
|
113 | skipping ancestor revision 2:5c095ad7e90f | |
114 | skipping ancestor revision 1:5d205f8b35b6 |
|
114 | skipping ancestor revision 1:5d205f8b35b6 | |
115 | [255] |
|
115 | [255] | |
116 |
|
116 | |||
117 | Conflicting date/user options: |
|
117 | Conflicting date/user options: | |
118 |
|
118 | |||
119 | $ hg up -q 0 |
|
119 | $ hg up -q 0 | |
120 | $ hg graft -U --user foo 2 |
|
120 | $ hg graft -U --user foo 2 | |
121 | abort: --user and --currentuser are mutually exclusive |
|
121 | abort: --user and --currentuser are mutually exclusive | |
122 | [255] |
|
122 | [255] | |
123 | $ hg graft -D --date '0 0' 2 |
|
123 | $ hg graft -D --date '0 0' 2 | |
124 | abort: --date and --currentdate are mutually exclusive |
|
124 | abort: --date and --currentdate are mutually exclusive | |
125 | [255] |
|
125 | [255] | |
126 |
|
126 | |||
127 | Can't graft with dirty wd: |
|
127 | Can't graft with dirty wd: | |
128 |
|
128 | |||
129 | $ hg up -q 0 |
|
129 | $ hg up -q 0 | |
130 | $ echo foo > a |
|
130 | $ echo foo > a | |
131 | $ hg graft 1 |
|
131 | $ hg graft 1 | |
132 | abort: uncommitted changes |
|
132 | abort: uncommitted changes | |
133 | [255] |
|
133 | [255] | |
134 | $ hg revert a |
|
134 | $ hg revert a | |
135 |
|
135 | |||
136 | Graft a rename: |
|
136 | Graft a rename: | |
137 | (this also tests that editor is invoked if '--edit' is specified) |
|
137 | (this also tests that editor is invoked if '--edit' is specified) | |
138 |
|
138 | |||
139 | $ hg status --rev "2^1" --rev 2 |
|
139 | $ hg status --rev "2^1" --rev 2 | |
140 | A b |
|
140 | A b | |
141 | R a |
|
141 | R a | |
142 | $ HGEDITOR=cat hg graft 2 -u foo --edit |
|
142 | $ HGEDITOR=cat hg graft 2 -u foo --edit | |
143 | grafting 2:5c095ad7e90f "2" |
|
143 | grafting 2:5c095ad7e90f "2" | |
144 | merging a and b to b |
|
144 | merging a and b to b | |
145 | 2 |
|
145 | 2 | |
146 |
|
146 | |||
147 |
|
147 | |||
148 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
148 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
149 | HG: Leave message empty to abort commit. |
|
149 | HG: Leave message empty to abort commit. | |
150 | HG: -- |
|
150 | HG: -- | |
151 | HG: user: foo |
|
151 | HG: user: foo | |
152 | HG: branch 'default' |
|
152 | HG: branch 'default' | |
153 | HG: added b |
|
153 | HG: added b | |
154 | HG: removed a |
|
154 | HG: removed a | |
155 | $ hg export tip --git |
|
155 | $ hg export tip --git | |
156 | # HG changeset patch |
|
156 | # HG changeset patch | |
157 | # User foo |
|
157 | # User foo | |
158 | # Date 0 0 |
|
158 | # Date 0 0 | |
159 | # Thu Jan 01 00:00:00 1970 +0000 |
|
159 | # Thu Jan 01 00:00:00 1970 +0000 | |
160 | # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
160 | # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82 | |
161 | # Parent 68795b066622ca79a25816a662041d8f78f3cd9e |
|
161 | # Parent 68795b066622ca79a25816a662041d8f78f3cd9e | |
162 | 2 |
|
162 | 2 | |
163 |
|
163 | |||
164 | diff --git a/a b/b |
|
164 | diff --git a/a b/b | |
165 | rename from a |
|
165 | rename from a | |
166 | rename to b |
|
166 | rename to b | |
167 |
|
167 | |||
168 | Look for extra:source |
|
168 | Look for extra:source | |
169 |
|
169 | |||
170 | $ hg log --debug -r tip |
|
170 | $ hg log --debug -r tip | |
171 | changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
171 | changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82 | |
172 | tag: tip |
|
172 | tag: tip | |
173 | phase: draft |
|
173 | phase: draft | |
174 | parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e |
|
174 | parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e | |
175 | parent: -1:0000000000000000000000000000000000000000 |
|
175 | parent: -1:0000000000000000000000000000000000000000 | |
176 | manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb |
|
176 | manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb | |
177 | user: foo |
|
177 | user: foo | |
178 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
178 | date: Thu Jan 01 00:00:00 1970 +0000 | |
179 | files+: b |
|
179 | files+: b | |
180 | files-: a |
|
180 | files-: a | |
181 | extra: branch=default |
|
181 | extra: branch=default | |
182 | extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
182 | extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4 | |
183 | description: |
|
183 | description: | |
184 | 2 |
|
184 | 2 | |
185 |
|
185 | |||
186 |
|
186 | |||
187 |
|
187 | |||
188 | Graft out of order, skipping a merge and a duplicate |
|
188 | Graft out of order, skipping a merge and a duplicate | |
189 | (this also tests that editor is not invoked if '--edit' is not specified) |
|
189 | (this also tests that editor is not invoked if '--edit' is not specified) | |
190 |
|
190 | |||
191 | $ hg graft 1 5 4 3 'merge()' 2 -n |
|
191 | $ hg graft 1 5 4 3 'merge()' 2 -n | |
192 | skipping ungraftable merge revision 6 |
|
192 | skipping ungraftable merge revision 6 | |
193 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) |
|
193 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) | |
194 | grafting 1:5d205f8b35b6 "1" |
|
194 | grafting 1:5d205f8b35b6 "1" | |
195 | grafting 5:97f8bfe72746 "5" |
|
195 | grafting 5:97f8bfe72746 "5" | |
196 | grafting 4:9c233e8e184d "4" |
|
196 | grafting 4:9c233e8e184d "4" | |
197 | grafting 3:4c60f11aa304 "3" |
|
197 | grafting 3:4c60f11aa304 "3" | |
198 |
|
198 | |||
199 | $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug |
|
199 | $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug | |
200 | skipping ungraftable merge revision 6 |
|
200 | skipping ungraftable merge revision 6 | |
201 | scanning for duplicate grafts |
|
201 | scanning for duplicate grafts | |
202 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) |
|
202 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) | |
203 | grafting 1:5d205f8b35b6 "1" |
|
203 | grafting 1:5d205f8b35b6 "1" | |
204 | unmatched files in local: |
|
204 | unmatched files in local: | |
205 | b |
|
205 | b | |
206 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
206 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): | |
207 | src: 'a' -> dst: 'b' * |
|
207 | src: 'a' -> dst: 'b' * | |
208 | checking for directory renames |
|
208 | checking for directory renames | |
209 | resolving manifests |
|
209 | resolving manifests | |
210 | branchmerge: True, force: True, partial: False |
|
210 | branchmerge: True, force: True, partial: False | |
211 | ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6 |
|
211 | ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6 | |
212 | preserving b for resolve of b |
|
212 | preserving b for resolve of b | |
213 | starting 4 threads for background file closing (?) |
|
213 | starting 4 threads for background file closing (?) | |
214 | b: local copied/moved from a -> m (premerge) |
|
214 | b: local copied/moved from a -> m (premerge) | |
215 | picked tool ':merge' for b (binary False symlink False changedelete False) |
|
215 | picked tool ':merge' for b (binary False symlink False changedelete False) | |
216 | merging b and a to b |
|
216 | merging b and a to b | |
217 | my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622 |
|
217 | my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622 | |
218 | premerge successful |
|
218 | premerge successful | |
219 | committing files: |
|
219 | committing files: | |
220 | b |
|
220 | b | |
221 | committing manifest |
|
221 | committing manifest | |
222 | committing changelog |
|
222 | committing changelog | |
223 | updating the branch cache |
|
223 | updating the branch cache | |
224 | grafting 5:97f8bfe72746 "5" |
|
224 | grafting 5:97f8bfe72746 "5" | |
225 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
225 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): | |
226 | src: 'c' -> dst: 'b' |
|
226 | src: 'c' -> dst: 'b' | |
227 | checking for directory renames |
|
227 | checking for directory renames | |
228 | resolving manifests |
|
228 | resolving manifests | |
229 | branchmerge: True, force: True, partial: False |
|
229 | branchmerge: True, force: True, partial: False | |
230 | ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746 |
|
230 | ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746 | |
231 | e: remote is newer -> g |
|
231 | e: remote is newer -> g | |
232 | getting e |
|
232 | getting e | |
233 | committing files: |
|
233 | committing files: | |
234 | e |
|
234 | e | |
235 | committing manifest |
|
235 | committing manifest | |
236 | committing changelog |
|
236 | committing changelog | |
237 | updating the branch cache |
|
237 | updating the branch cache | |
238 | $ HGEDITOR=cat hg graft 4 3 --log --debug |
|
238 | $ HGEDITOR=cat hg graft 4 3 --log --debug | |
239 | scanning for duplicate grafts |
|
239 | scanning for duplicate grafts | |
240 | grafting 4:9c233e8e184d "4" |
|
240 | grafting 4:9c233e8e184d "4" | |
241 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
241 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): | |
242 | src: 'c' -> dst: 'b' |
|
242 | src: 'c' -> dst: 'b' | |
243 | checking for directory renames |
|
243 | checking for directory renames | |
244 | resolving manifests |
|
244 | resolving manifests | |
245 | branchmerge: True, force: True, partial: False |
|
245 | branchmerge: True, force: True, partial: False | |
246 | ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d |
|
246 | ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d | |
247 | preserving e for resolve of e |
|
247 | preserving e for resolve of e | |
248 | d: remote is newer -> g |
|
248 | d: remote is newer -> g | |
249 | getting d |
|
249 | getting d | |
250 | e: versions differ -> m (premerge) |
|
250 | e: versions differ -> m (premerge) | |
251 | picked tool ':merge' for e (binary False symlink False changedelete False) |
|
251 | picked tool ':merge' for e (binary False symlink False changedelete False) | |
252 | merging e |
|
252 | merging e | |
253 | my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304 |
|
253 | my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304 | |
254 | e: versions differ -> m (merge) |
|
254 | e: versions differ -> m (merge) | |
255 | picked tool ':merge' for e (binary False symlink False changedelete False) |
|
255 | picked tool ':merge' for e (binary False symlink False changedelete False) | |
256 | my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304 |
|
256 | my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304 | |
257 | warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
|
257 | warning: conflicts while merging e! (edit, then use 'hg resolve --mark') | |
258 | abort: unresolved conflicts, can't continue |
|
258 | abort: unresolved conflicts, can't continue | |
259 | (use 'hg resolve' and 'hg graft --continue') |
|
259 | (use 'hg resolve' and 'hg graft --continue') | |
260 | [255] |
|
260 | [255] | |
261 |
|
261 | |||
262 | Summary should mention graft: |
|
262 | Summary should mention graft: | |
263 |
|
263 | |||
264 | $ hg summary |grep graft |
|
264 | $ hg summary |grep graft | |
265 | commit: 2 modified, 2 unknown, 1 unresolved (graft in progress) |
|
265 | commit: 2 modified, 2 unknown, 1 unresolved (graft in progress) | |
266 |
|
266 | |||
267 | Using status to get more context |
|
267 | Using status to get more context | |
268 |
|
268 | |||
269 | $ hg status --verbose |
|
269 | $ hg status --verbose | |
270 | M d |
|
270 | M d | |
271 | M e |
|
271 | M e | |
272 | ? a.orig |
|
272 | ? a.orig | |
273 | ? e.orig |
|
273 | ? e.orig | |
274 | # The repository is in an unfinished *graft* state. |
|
274 | # The repository is in an unfinished *graft* state. | |
275 |
|
275 | |||
276 | # Unresolved merge conflicts: |
|
276 | # Unresolved merge conflicts: | |
277 | # |
|
277 | # | |
278 | # e |
|
278 | # e | |
279 | # |
|
279 | # | |
280 | # To mark files as resolved: hg resolve --mark FILE |
|
280 | # To mark files as resolved: hg resolve --mark FILE | |
281 |
|
281 | |||
282 | # To continue: hg graft --continue |
|
282 | # To continue: hg graft --continue | |
283 | # To abort: hg graft --abort |
|
283 | # To abort: hg graft --abort | |
284 |
|
284 | |||
285 |
|
285 | |||
286 | Commit while interrupted should fail: |
|
286 | Commit while interrupted should fail: | |
287 |
|
287 | |||
288 | $ hg ci -m 'commit interrupted graft' |
|
288 | $ hg ci -m 'commit interrupted graft' | |
289 | abort: graft in progress |
|
289 | abort: graft in progress | |
290 | (use 'hg graft --continue' or 'hg graft --stop' to stop) |
|
290 | (use 'hg graft --continue' or 'hg graft --stop' to stop) | |
291 | [255] |
|
291 | [255] | |
292 |
|
292 | |||
293 | Abort the graft and try committing: |
|
293 | Abort the graft and try committing: | |
294 |
|
294 | |||
295 | $ hg up -C . |
|
295 | $ hg up -C . | |
296 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
296 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
297 | $ echo c >> e |
|
297 | $ echo c >> e | |
298 | $ hg ci -mtest |
|
298 | $ hg ci -mtest | |
299 |
|
299 | |||
300 | $ hg strip . --config extensions.strip= |
|
300 | $ hg strip . --config extensions.strip= | |
301 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
301 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
302 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob) |
|
302 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob) | |
303 |
|
303 | |||
304 | Graft again: |
|
304 | Graft again: | |
305 |
|
305 | |||
306 | $ hg graft 1 5 4 3 'merge()' 2 |
|
306 | $ hg graft 1 5 4 3 'merge()' 2 | |
307 | skipping ungraftable merge revision 6 |
|
307 | skipping ungraftable merge revision 6 | |
308 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) |
|
308 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) | |
309 | skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e) |
|
309 | skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e) | |
310 | skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec) |
|
310 | skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec) | |
311 | grafting 4:9c233e8e184d "4" |
|
311 | grafting 4:9c233e8e184d "4" | |
312 | merging e |
|
312 | merging e | |
313 | warning: conflicts while merging e! (edit, then use 'hg resolve --mark') |
|
313 | warning: conflicts while merging e! (edit, then use 'hg resolve --mark') | |
314 | abort: unresolved conflicts, can't continue |
|
314 | abort: unresolved conflicts, can't continue | |
315 | (use 'hg resolve' and 'hg graft --continue') |
|
315 | (use 'hg resolve' and 'hg graft --continue') | |
316 | [255] |
|
316 | [255] | |
317 |
|
317 | |||
318 | Continue without resolve should fail: |
|
318 | Continue without resolve should fail: | |
319 |
|
319 | |||
320 | $ hg graft -c |
|
320 | $ hg graft -c | |
321 | grafting 4:9c233e8e184d "4" |
|
321 | grafting 4:9c233e8e184d "4" | |
322 | abort: unresolved merge conflicts (see 'hg help resolve') |
|
322 | abort: unresolved merge conflicts (see 'hg help resolve') | |
323 | [255] |
|
323 | [255] | |
324 |
|
324 | |||
325 | Fix up: |
|
325 | Fix up: | |
326 |
|
326 | |||
327 | $ echo b > e |
|
327 | $ echo b > e | |
328 | $ hg resolve -m e |
|
328 | $ hg resolve -m e | |
329 | (no more unresolved files) |
|
329 | (no more unresolved files) | |
330 | continue: hg graft --continue |
|
330 | continue: hg graft --continue | |
331 |
|
331 | |||
332 | Continue with a revision should fail: |
|
332 | Continue with a revision should fail: | |
333 |
|
333 | |||
334 | $ hg graft -c 6 |
|
334 | $ hg graft -c 6 | |
335 | abort: can't specify --continue and revisions |
|
335 | abort: can't specify --continue and revisions | |
336 | [255] |
|
336 | [255] | |
337 |
|
337 | |||
338 | $ hg graft -c -r 6 |
|
338 | $ hg graft -c -r 6 | |
339 | abort: can't specify --continue and revisions |
|
339 | abort: can't specify --continue and revisions | |
340 | [255] |
|
340 | [255] | |
341 |
|
341 | |||
342 | Continue for real, clobber usernames |
|
342 | Continue for real, clobber usernames | |
343 |
|
343 | |||
344 | $ hg graft -c -U |
|
344 | $ hg graft -c -U | |
345 | grafting 4:9c233e8e184d "4" |
|
345 | grafting 4:9c233e8e184d "4" | |
346 | grafting 3:4c60f11aa304 "3" |
|
346 | grafting 3:4c60f11aa304 "3" | |
347 |
|
347 | |||
348 | Compare with original: |
|
348 | Compare with original: | |
349 |
|
349 | |||
350 | $ hg diff -r 6 |
|
350 | $ hg diff -r 6 | |
351 | $ hg status --rev 0:. -C |
|
351 | $ hg status --rev 0:. -C | |
352 | M d |
|
352 | M d | |
353 | M e |
|
353 | M e | |
354 | A b |
|
354 | A b | |
355 | a |
|
355 | a | |
356 | A c |
|
356 | A c | |
357 | a |
|
357 | a | |
358 | R a |
|
358 | R a | |
359 |
|
359 | |||
360 | View graph: |
|
360 | View graph: | |
361 |
|
361 | |||
362 | $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n' |
|
362 | $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n' | |
363 | @ test@11.draft: 3 |
|
363 | @ test@11.draft: 3 | |
364 | | |
|
364 | | | |
365 | o test@10.draft: 4 |
|
365 | o test@10.draft: 4 | |
366 | | |
|
366 | | | |
367 | o test@9.draft: 5 |
|
367 | o test@9.draft: 5 | |
368 | | |
|
368 | | | |
369 | o bar@8.draft: 1 |
|
369 | o bar@8.draft: 1 | |
370 | | |
|
370 | | | |
371 | o foo@7.draft: 2 |
|
371 | o foo@7.draft: 2 | |
372 | | |
|
372 | | | |
373 | | o test@6.secret: 6 |
|
373 | | o test@6.secret: 6 | |
374 | | |\ |
|
374 | | |\ | |
375 | | | o test@5.draft: 5 |
|
375 | | | o test@5.draft: 5 | |
376 | | | | |
|
376 | | | | | |
377 | | o | test@4.draft: 4 |
|
377 | | o | test@4.draft: 4 | |
378 | | |/ |
|
378 | | |/ | |
379 | | o baz@3.public: 3 |
|
379 | | o baz@3.public: 3 | |
380 | | | |
|
380 | | | | |
381 | | o test@2.public: 2 |
|
381 | | o test@2.public: 2 | |
382 | | | |
|
382 | | | | |
383 | | o bar@1.public: 1 |
|
383 | | o bar@1.public: 1 | |
384 | |/ |
|
384 | |/ | |
385 | o test@0.public: 0 |
|
385 | o test@0.public: 0 | |
386 |
|
386 | |||
387 | Graft again onto another branch should preserve the original source |
|
387 | Graft again onto another branch should preserve the original source | |
388 | $ hg up -q 0 |
|
388 | $ hg up -q 0 | |
389 | $ echo 'g'>g |
|
389 | $ echo 'g'>g | |
390 | $ hg add g |
|
390 | $ hg add g | |
391 | $ hg ci -m 7 |
|
391 | $ hg ci -m 7 | |
392 | created new head |
|
392 | created new head | |
393 | $ hg graft 7 |
|
393 | $ hg graft 7 | |
394 | grafting 7:ef0ef43d49e7 "2" |
|
394 | grafting 7:ef0ef43d49e7 "2" | |
395 |
|
395 | |||
396 | $ hg log -r 7 --template '{rev}:{node}\n' |
|
396 | $ hg log -r 7 --template '{rev}:{node}\n' | |
397 | 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
397 | 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82 | |
398 | $ hg log -r 2 --template '{rev}:{node}\n' |
|
398 | $ hg log -r 2 --template '{rev}:{node}\n' | |
399 | 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
399 | 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4 | |
400 |
|
400 | |||
401 | $ hg log --debug -r tip |
|
401 | $ hg log --debug -r tip | |
402 | changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9 |
|
402 | changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9 | |
403 | tag: tip |
|
403 | tag: tip | |
404 | phase: draft |
|
404 | phase: draft | |
405 | parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f |
|
405 | parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f | |
406 | parent: -1:0000000000000000000000000000000000000000 |
|
406 | parent: -1:0000000000000000000000000000000000000000 | |
407 | manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637 |
|
407 | manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637 | |
408 | user: foo |
|
408 | user: foo | |
409 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
409 | date: Thu Jan 01 00:00:00 1970 +0000 | |
410 | files+: b |
|
410 | files+: b | |
411 | files-: a |
|
411 | files-: a | |
412 | extra: branch=default |
|
412 | extra: branch=default | |
413 | extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
413 | extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82 | |
414 | extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
414 | extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4 | |
415 | description: |
|
415 | description: | |
416 | 2 |
|
416 | 2 | |
417 |
|
417 | |||
418 |
|
418 | |||
419 | Disallow grafting an already grafted cset onto its original branch |
|
419 | Disallow grafting an already grafted cset onto its original branch | |
420 | $ hg up -q 6 |
|
420 | $ hg up -q 6 | |
421 | $ hg graft 7 |
|
421 | $ hg graft 7 | |
422 | skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f) |
|
422 | skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f) | |
423 | [255] |
|
423 | [255] | |
424 |
|
424 | |||
425 | $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 |
|
425 | $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 | |
426 | --- */hg-5c095ad7e90f.patch * (glob) |
|
426 | --- */hg-5c095ad7e90f.patch * (glob) | |
427 | +++ */hg-7a4785234d87.patch * (glob) |
|
427 | +++ */hg-7a4785234d87.patch * (glob) | |
428 | @@ -1,18 +1,18 @@ |
|
428 | @@ -1,18 +1,18 @@ | |
429 | # HG changeset patch |
|
429 | # HG changeset patch | |
430 | -# User test |
|
430 | -# User test | |
431 | +# User foo |
|
431 | +# User foo | |
432 | # Date 0 0 |
|
432 | # Date 0 0 | |
433 | # Thu Jan 01 00:00:00 1970 +0000 |
|
433 | # Thu Jan 01 00:00:00 1970 +0000 | |
434 | -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
434 | -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4 | |
435 | -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04 |
|
435 | -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04 | |
436 | +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9 |
|
436 | +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9 | |
437 | +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f |
|
437 | +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f | |
438 | 2 |
|
438 | 2 | |
439 |
|
439 | |||
440 | -diff -r 5d205f8b35b6 -r 5c095ad7e90f a |
|
440 | -diff -r 5d205f8b35b6 -r 5c095ad7e90f a | |
441 | +diff -r b592ea63bb0c -r 7a4785234d87 a |
|
441 | +diff -r b592ea63bb0c -r 7a4785234d87 a | |
442 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
442 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
443 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
443 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
444 | @@ -1,1 +0,0 @@ |
|
444 | @@ -1,1 +0,0 @@ | |
445 | --b |
|
445 | --b | |
446 | -diff -r 5d205f8b35b6 -r 5c095ad7e90f b |
|
446 | -diff -r 5d205f8b35b6 -r 5c095ad7e90f b | |
447 | +-a |
|
447 | +-a | |
448 | +diff -r b592ea63bb0c -r 7a4785234d87 b |
|
448 | +diff -r b592ea63bb0c -r 7a4785234d87 b | |
449 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
449 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
450 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
450 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 | |
451 | @@ -0,0 +1,1 @@ |
|
451 | @@ -0,0 +1,1 @@ | |
452 | -+b |
|
452 | -+b | |
453 | ++a |
|
453 | ++a | |
454 | [1] |
|
454 | [1] | |
455 |
|
455 | |||
456 | $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X . |
|
456 | $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X . | |
457 | --- */hg-5c095ad7e90f.patch * (glob) |
|
457 | --- */hg-5c095ad7e90f.patch * (glob) | |
458 | +++ */hg-7a4785234d87.patch * (glob) |
|
458 | +++ */hg-7a4785234d87.patch * (glob) | |
459 | @@ -1,8 +1,8 @@ |
|
459 | @@ -1,8 +1,8 @@ | |
460 | # HG changeset patch |
|
460 | # HG changeset patch | |
461 | -# User test |
|
461 | -# User test | |
462 | +# User foo |
|
462 | +# User foo | |
463 | # Date 0 0 |
|
463 | # Date 0 0 | |
464 | # Thu Jan 01 00:00:00 1970 +0000 |
|
464 | # Thu Jan 01 00:00:00 1970 +0000 | |
465 | -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
465 | -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4 | |
466 | -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04 |
|
466 | -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04 | |
467 | +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9 |
|
467 | +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9 | |
468 | +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f |
|
468 | +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f | |
469 | 2 |
|
469 | 2 | |
470 |
|
470 | |||
471 | [1] |
|
471 | [1] | |
472 |
|
472 | |||
473 | Disallow grafting already grafted csets with the same origin onto each other |
|
473 | Disallow grafting already grafted csets with the same origin onto each other | |
474 | $ hg up -q 13 |
|
474 | $ hg up -q 13 | |
475 | $ hg graft 2 |
|
475 | $ hg graft 2 | |
476 | skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87) |
|
476 | skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87) | |
477 | [255] |
|
477 | [255] | |
478 | $ hg graft 7 |
|
478 | $ hg graft 7 | |
479 | skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f) |
|
479 | skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f) | |
480 | [255] |
|
480 | [255] | |
481 |
|
481 | |||
482 | $ hg up -q 7 |
|
482 | $ hg up -q 7 | |
483 | $ hg graft 2 |
|
483 | $ hg graft 2 | |
484 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) |
|
484 | skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7) | |
485 | [255] |
|
485 | [255] | |
486 | $ hg graft tip |
|
486 | $ hg graft tip | |
487 | skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f) |
|
487 | skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f) | |
488 | [255] |
|
488 | [255] | |
489 |
|
489 | |||
490 | Graft with --log |
|
490 | Graft with --log | |
491 |
|
491 | |||
492 | $ hg up -Cq 1 |
|
492 | $ hg up -Cq 1 | |
493 | $ hg graft 3 --log -u foo |
|
493 | $ hg graft 3 --log -u foo | |
494 | grafting 3:4c60f11aa304 "3" |
|
494 | grafting 3:4c60f11aa304 "3" | |
495 | warning: can't find ancestor for 'c' copied from 'b'! |
|
495 | warning: can't find ancestor for 'c' copied from 'b'! | |
496 | $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip |
|
496 | $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip | |
497 | 14:0c921c65ef1e 1:5d205f8b35b6 3 |
|
497 | 14:0c921c65ef1e 1:5d205f8b35b6 3 | |
498 | (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8) |
|
498 | (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8) | |
499 |
|
499 | |||
500 | Resolve conflicted graft |
|
500 | Resolve conflicted graft | |
501 | $ hg up -q 0 |
|
501 | $ hg up -q 0 | |
502 | $ echo b > a |
|
502 | $ echo b > a | |
503 | $ hg ci -m 8 |
|
503 | $ hg ci -m 8 | |
504 | created new head |
|
504 | created new head | |
505 | $ echo c > a |
|
505 | $ echo c > a | |
506 | $ hg ci -m 9 |
|
506 | $ hg ci -m 9 | |
507 | $ hg graft 1 --tool internal:fail |
|
507 | $ hg graft 1 --tool internal:fail | |
508 | grafting 1:5d205f8b35b6 "1" |
|
508 | grafting 1:5d205f8b35b6 "1" | |
509 | abort: unresolved conflicts, can't continue |
|
509 | abort: unresolved conflicts, can't continue | |
510 | (use 'hg resolve' and 'hg graft --continue') |
|
510 | (use 'hg resolve' and 'hg graft --continue') | |
511 | [255] |
|
511 | [255] | |
512 | $ hg resolve --all |
|
512 | $ hg resolve --all | |
513 | merging a |
|
513 | merging a | |
514 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
514 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
515 | [1] |
|
515 | [1] | |
516 | $ cat a |
|
516 | $ cat a | |
517 | <<<<<<< local: aaa4406d4f0a - test: 9 |
|
517 | <<<<<<< local: aaa4406d4f0a - test: 9 | |
518 | c |
|
518 | c | |
519 | ======= |
|
519 | ======= | |
520 | b |
|
520 | b | |
521 | >>>>>>> graft: 5d205f8b35b6 - bar: 1 |
|
521 | >>>>>>> graft: 5d205f8b35b6 - bar: 1 | |
522 | $ echo b > a |
|
522 | $ echo b > a | |
523 | $ hg resolve -m a |
|
523 | $ hg resolve -m a | |
524 | (no more unresolved files) |
|
524 | (no more unresolved files) | |
525 | continue: hg graft --continue |
|
525 | continue: hg graft --continue | |
526 | $ hg graft -c |
|
526 | $ hg graft -c | |
527 | grafting 1:5d205f8b35b6 "1" |
|
527 | grafting 1:5d205f8b35b6 "1" | |
528 | $ hg export tip --git |
|
528 | $ hg export tip --git | |
529 | # HG changeset patch |
|
529 | # HG changeset patch | |
530 | # User bar |
|
530 | # User bar | |
531 | # Date 0 0 |
|
531 | # Date 0 0 | |
532 | # Thu Jan 01 00:00:00 1970 +0000 |
|
532 | # Thu Jan 01 00:00:00 1970 +0000 | |
533 | # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be |
|
533 | # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be | |
534 | # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6 |
|
534 | # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6 | |
535 | 1 |
|
535 | 1 | |
536 |
|
536 | |||
537 | diff --git a/a b/a |
|
537 | diff --git a/a b/a | |
538 | --- a/a |
|
538 | --- a/a | |
539 | +++ b/a |
|
539 | +++ b/a | |
540 | @@ -1,1 +1,1 @@ |
|
540 | @@ -1,1 +1,1 @@ | |
541 | -c |
|
541 | -c | |
542 | +b |
|
542 | +b | |
543 |
|
543 | |||
544 | Resolve conflicted graft with rename |
|
544 | Resolve conflicted graft with rename | |
545 | $ echo c > a |
|
545 | $ echo c > a | |
546 | $ hg ci -m 10 |
|
546 | $ hg ci -m 10 | |
547 | $ hg graft 2 --tool internal:fail |
|
547 | $ hg graft 2 --tool internal:fail | |
548 | grafting 2:5c095ad7e90f "2" |
|
548 | grafting 2:5c095ad7e90f "2" | |
549 | abort: unresolved conflicts, can't continue |
|
549 | abort: unresolved conflicts, can't continue | |
550 | (use 'hg resolve' and 'hg graft --continue') |
|
550 | (use 'hg resolve' and 'hg graft --continue') | |
551 | [255] |
|
551 | [255] | |
552 | $ hg resolve --all |
|
552 | $ hg resolve --all | |
553 | merging a and b to b |
|
553 | merging a and b to b | |
554 | (no more unresolved files) |
|
554 | (no more unresolved files) | |
555 | continue: hg graft --continue |
|
555 | continue: hg graft --continue | |
556 | $ hg graft -c |
|
556 | $ hg graft -c | |
557 | grafting 2:5c095ad7e90f "2" |
|
557 | grafting 2:5c095ad7e90f "2" | |
558 | $ hg export tip --git |
|
558 | $ hg export tip --git | |
559 | # HG changeset patch |
|
559 | # HG changeset patch | |
560 | # User test |
|
560 | # User test | |
561 | # Date 0 0 |
|
561 | # Date 0 0 | |
562 | # Thu Jan 01 00:00:00 1970 +0000 |
|
562 | # Thu Jan 01 00:00:00 1970 +0000 | |
563 | # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc |
|
563 | # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc | |
564 | # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612 |
|
564 | # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612 | |
565 | 2 |
|
565 | 2 | |
566 |
|
566 | |||
567 | diff --git a/a b/b |
|
567 | diff --git a/a b/b | |
568 | rename from a |
|
568 | rename from a | |
569 | rename to b |
|
569 | rename to b | |
570 |
|
570 | |||
571 | Test simple origin(), with and without args |
|
571 | Test simple origin(), with and without args | |
572 | $ hg log -r 'origin()' |
|
572 | $ hg log -r 'origin()' | |
573 | changeset: 1:5d205f8b35b6 |
|
573 | changeset: 1:5d205f8b35b6 | |
574 | user: bar |
|
574 | user: bar | |
575 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
575 | date: Thu Jan 01 00:00:00 1970 +0000 | |
576 | summary: 1 |
|
576 | summary: 1 | |
577 |
|
577 | |||
578 | changeset: 2:5c095ad7e90f |
|
578 | changeset: 2:5c095ad7e90f | |
579 | user: test |
|
579 | user: test | |
580 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
580 | date: Thu Jan 01 00:00:00 1970 +0000 | |
581 | summary: 2 |
|
581 | summary: 2 | |
582 |
|
582 | |||
583 | changeset: 3:4c60f11aa304 |
|
583 | changeset: 3:4c60f11aa304 | |
584 | user: baz |
|
584 | user: baz | |
585 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
585 | date: Thu Jan 01 00:00:00 1970 +0000 | |
586 | summary: 3 |
|
586 | summary: 3 | |
587 |
|
587 | |||
588 | changeset: 4:9c233e8e184d |
|
588 | changeset: 4:9c233e8e184d | |
589 | user: test |
|
589 | user: test | |
590 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
590 | date: Thu Jan 01 00:00:00 1970 +0000 | |
591 | summary: 4 |
|
591 | summary: 4 | |
592 |
|
592 | |||
593 | changeset: 5:97f8bfe72746 |
|
593 | changeset: 5:97f8bfe72746 | |
594 | branch: stable |
|
594 | branch: stable | |
595 | parent: 3:4c60f11aa304 |
|
595 | parent: 3:4c60f11aa304 | |
596 | user: test |
|
596 | user: test | |
597 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
597 | date: Thu Jan 01 00:00:00 1970 +0000 | |
598 | summary: 5 |
|
598 | summary: 5 | |
599 |
|
599 | |||
600 | $ hg log -r 'origin(7)' |
|
600 | $ hg log -r 'origin(7)' | |
601 | changeset: 2:5c095ad7e90f |
|
601 | changeset: 2:5c095ad7e90f | |
602 | user: test |
|
602 | user: test | |
603 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
603 | date: Thu Jan 01 00:00:00 1970 +0000 | |
604 | summary: 2 |
|
604 | summary: 2 | |
605 |
|
605 | |||
606 | Now transplant a graft to test following through copies |
|
606 | Now transplant a graft to test following through copies | |
607 | $ hg up -q 0 |
|
607 | $ hg up -q 0 | |
608 | $ hg branch -q dev |
|
608 | $ hg branch -q dev | |
609 | $ hg ci -qm "dev branch" |
|
609 | $ hg ci -qm "dev branch" | |
610 | $ hg --config extensions.transplant= transplant -q 7 |
|
610 | $ hg --config extensions.transplant= transplant -q 7 | |
611 | $ hg log -r 'origin(.)' |
|
611 | $ hg log -r 'origin(.)' | |
612 | changeset: 2:5c095ad7e90f |
|
612 | changeset: 2:5c095ad7e90f | |
613 | user: test |
|
613 | user: test | |
614 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
614 | date: Thu Jan 01 00:00:00 1970 +0000 | |
615 | summary: 2 |
|
615 | summary: 2 | |
616 |
|
616 | |||
617 | Test that the graft and transplant markers in extra are converted, allowing |
|
617 | Test that the graft and transplant markers in extra are converted, allowing | |
618 | origin() to still work. Note that these recheck the immediately preceeding two |
|
618 | origin() to still work. Note that these recheck the immediately preceeding two | |
619 | tests. |
|
619 | tests. | |
620 | $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted |
|
620 | $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted | |
621 |
|
621 | |||
622 | The graft case |
|
622 | The graft case | |
623 | $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n" |
|
623 | $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n" | |
624 | 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b |
|
624 | 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b | |
625 | branch=default |
|
625 | branch=default | |
626 | convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
626 | convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82 | |
627 | source=e0213322b2c1a5d5d236c74e79666441bee67a7d |
|
627 | source=e0213322b2c1a5d5d236c74e79666441bee67a7d | |
628 | $ hg -R ../converted log -r 'origin(7)' |
|
628 | $ hg -R ../converted log -r 'origin(7)' | |
629 | changeset: 2:e0213322b2c1 |
|
629 | changeset: 2:e0213322b2c1 | |
630 | user: test |
|
630 | user: test | |
631 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
631 | date: Thu Jan 01 00:00:00 1970 +0000 | |
632 | summary: 2 |
|
632 | summary: 2 | |
633 |
|
633 | |||
634 | Test that template correctly expands more than one 'extra' (issue4362), and that |
|
634 | Test that template correctly expands more than one 'extra' (issue4362), and that | |
635 | 'intermediate-source' is converted. |
|
635 | 'intermediate-source' is converted. | |
636 | $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}" |
|
636 | $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}" | |
637 | Extra: branch=default |
|
637 | Extra: branch=default | |
638 | Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9 |
|
638 | Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9 | |
639 | Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b |
|
639 | Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b | |
640 | Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d |
|
640 | Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d | |
641 |
|
641 | |||
642 | The transplant case |
|
642 | The transplant case | |
643 | $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n" |
|
643 | $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n" | |
644 | 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade |
|
644 | 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade | |
645 | branch=dev |
|
645 | branch=dev | |
646 | convert_revision=7e61b508e709a11d28194a5359bc3532d910af21 |
|
646 | convert_revision=7e61b508e709a11d28194a5359bc3532d910af21 | |
647 | transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b |
|
647 | transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b | |
648 | $ hg -R ../converted log -r 'origin(tip)' |
|
648 | $ hg -R ../converted log -r 'origin(tip)' | |
649 | changeset: 2:e0213322b2c1 |
|
649 | changeset: 2:e0213322b2c1 | |
650 | user: test |
|
650 | user: test | |
651 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
651 | date: Thu Jan 01 00:00:00 1970 +0000 | |
652 | summary: 2 |
|
652 | summary: 2 | |
653 |
|
653 | |||
654 |
|
654 | |||
655 | Test simple destination |
|
655 | Test simple destination | |
656 | $ hg log -r 'destination()' |
|
656 | $ hg log -r 'destination()' | |
657 | changeset: 7:ef0ef43d49e7 |
|
657 | changeset: 7:ef0ef43d49e7 | |
658 | parent: 0:68795b066622 |
|
658 | parent: 0:68795b066622 | |
659 | user: foo |
|
659 | user: foo | |
660 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
660 | date: Thu Jan 01 00:00:00 1970 +0000 | |
661 | summary: 2 |
|
661 | summary: 2 | |
662 |
|
662 | |||
663 | changeset: 8:6b9e5368ca4e |
|
663 | changeset: 8:6b9e5368ca4e | |
664 | user: bar |
|
664 | user: bar | |
665 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
665 | date: Thu Jan 01 00:00:00 1970 +0000 | |
666 | summary: 1 |
|
666 | summary: 1 | |
667 |
|
667 | |||
668 | changeset: 9:1905859650ec |
|
668 | changeset: 9:1905859650ec | |
669 | user: test |
|
669 | user: test | |
670 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
670 | date: Thu Jan 01 00:00:00 1970 +0000 | |
671 | summary: 5 |
|
671 | summary: 5 | |
672 |
|
672 | |||
673 | changeset: 10:52dc0b4c6907 |
|
673 | changeset: 10:52dc0b4c6907 | |
674 | user: test |
|
674 | user: test | |
675 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
675 | date: Thu Jan 01 00:00:00 1970 +0000 | |
676 | summary: 4 |
|
676 | summary: 4 | |
677 |
|
677 | |||
678 | changeset: 11:882b35362a6b |
|
678 | changeset: 11:882b35362a6b | |
679 | user: test |
|
679 | user: test | |
680 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
680 | date: Thu Jan 01 00:00:00 1970 +0000 | |
681 | summary: 3 |
|
681 | summary: 3 | |
682 |
|
682 | |||
683 | changeset: 13:7a4785234d87 |
|
683 | changeset: 13:7a4785234d87 | |
684 | user: foo |
|
684 | user: foo | |
685 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
685 | date: Thu Jan 01 00:00:00 1970 +0000 | |
686 | summary: 2 |
|
686 | summary: 2 | |
687 |
|
687 | |||
688 | changeset: 14:0c921c65ef1e |
|
688 | changeset: 14:0c921c65ef1e | |
689 | parent: 1:5d205f8b35b6 |
|
689 | parent: 1:5d205f8b35b6 | |
690 | user: foo |
|
690 | user: foo | |
691 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
691 | date: Thu Jan 01 00:00:00 1970 +0000 | |
692 | summary: 3 |
|
692 | summary: 3 | |
693 |
|
693 | |||
694 | changeset: 17:f67661df0c48 |
|
694 | changeset: 17:f67661df0c48 | |
695 | user: bar |
|
695 | user: bar | |
696 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
696 | date: Thu Jan 01 00:00:00 1970 +0000 | |
697 | summary: 1 |
|
697 | summary: 1 | |
698 |
|
698 | |||
699 | changeset: 19:9627f653b421 |
|
699 | changeset: 19:9627f653b421 | |
700 | user: test |
|
700 | user: test | |
701 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
701 | date: Thu Jan 01 00:00:00 1970 +0000 | |
702 | summary: 2 |
|
702 | summary: 2 | |
703 |
|
703 | |||
704 | changeset: 21:7e61b508e709 |
|
704 | changeset: 21:7e61b508e709 | |
705 | branch: dev |
|
705 | branch: dev | |
706 | tag: tip |
|
706 | tag: tip | |
707 | user: foo |
|
707 | user: foo | |
708 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
708 | date: Thu Jan 01 00:00:00 1970 +0000 | |
709 | summary: 2 |
|
709 | summary: 2 | |
710 |
|
710 | |||
711 | $ hg log -r 'destination(2)' |
|
711 | $ hg log -r 'destination(2)' | |
712 | changeset: 7:ef0ef43d49e7 |
|
712 | changeset: 7:ef0ef43d49e7 | |
713 | parent: 0:68795b066622 |
|
713 | parent: 0:68795b066622 | |
714 | user: foo |
|
714 | user: foo | |
715 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
715 | date: Thu Jan 01 00:00:00 1970 +0000 | |
716 | summary: 2 |
|
716 | summary: 2 | |
717 |
|
717 | |||
718 | changeset: 13:7a4785234d87 |
|
718 | changeset: 13:7a4785234d87 | |
719 | user: foo |
|
719 | user: foo | |
720 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
720 | date: Thu Jan 01 00:00:00 1970 +0000 | |
721 | summary: 2 |
|
721 | summary: 2 | |
722 |
|
722 | |||
723 | changeset: 19:9627f653b421 |
|
723 | changeset: 19:9627f653b421 | |
724 | user: test |
|
724 | user: test | |
725 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
725 | date: Thu Jan 01 00:00:00 1970 +0000 | |
726 | summary: 2 |
|
726 | summary: 2 | |
727 |
|
727 | |||
728 | changeset: 21:7e61b508e709 |
|
728 | changeset: 21:7e61b508e709 | |
729 | branch: dev |
|
729 | branch: dev | |
730 | tag: tip |
|
730 | tag: tip | |
731 | user: foo |
|
731 | user: foo | |
732 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
732 | date: Thu Jan 01 00:00:00 1970 +0000 | |
733 | summary: 2 |
|
733 | summary: 2 | |
734 |
|
734 | |||
735 | Transplants of grafts can find a destination... |
|
735 | Transplants of grafts can find a destination... | |
736 | $ hg log -r 'destination(7)' |
|
736 | $ hg log -r 'destination(7)' | |
737 | changeset: 21:7e61b508e709 |
|
737 | changeset: 21:7e61b508e709 | |
738 | branch: dev |
|
738 | branch: dev | |
739 | tag: tip |
|
739 | tag: tip | |
740 | user: foo |
|
740 | user: foo | |
741 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
741 | date: Thu Jan 01 00:00:00 1970 +0000 | |
742 | summary: 2 |
|
742 | summary: 2 | |
743 |
|
743 | |||
744 | ... grafts of grafts unfortunately can't |
|
744 | ... grafts of grafts unfortunately can't | |
745 | $ hg graft -q 13 --debug |
|
745 | $ hg graft -q 13 --debug | |
746 | scanning for duplicate grafts |
|
746 | scanning for duplicate grafts | |
747 | grafting 13:7a4785234d87 "2" |
|
747 | grafting 13:7a4785234d87 "2" | |
748 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
748 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): | |
749 | src: 'a' -> dst: 'b' * |
|
749 | src: 'a' -> dst: 'b' * | |
750 | checking for directory renames |
|
750 | checking for directory renames | |
751 | resolving manifests |
|
751 | resolving manifests | |
752 | branchmerge: True, force: True, partial: False |
|
752 | branchmerge: True, force: True, partial: False | |
753 | ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87 |
|
753 | ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87 | |
754 | starting 4 threads for background file closing (?) |
|
754 | starting 4 threads for background file closing (?) | |
755 | committing files: |
|
755 | committing files: | |
756 | b |
|
756 | b | |
757 | warning: can't find ancestor for 'b' copied from 'a'! |
|
757 | warning: can't find ancestor for 'b' copied from 'a'! | |
758 |
reusing manifest f |
|
758 | reusing manifest from p1 (listed files actually unchanged) | |
759 | committing changelog |
|
759 | committing changelog | |
760 | updating the branch cache |
|
760 | updating the branch cache | |
761 | $ hg log -r 'destination(13)' |
|
761 | $ hg log -r 'destination(13)' | |
762 | All copies of a cset |
|
762 | All copies of a cset | |
763 | $ hg log -r 'origin(13) or destination(origin(13))' |
|
763 | $ hg log -r 'origin(13) or destination(origin(13))' | |
764 | changeset: 2:5c095ad7e90f |
|
764 | changeset: 2:5c095ad7e90f | |
765 | user: test |
|
765 | user: test | |
766 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
766 | date: Thu Jan 01 00:00:00 1970 +0000 | |
767 | summary: 2 |
|
767 | summary: 2 | |
768 |
|
768 | |||
769 | changeset: 7:ef0ef43d49e7 |
|
769 | changeset: 7:ef0ef43d49e7 | |
770 | parent: 0:68795b066622 |
|
770 | parent: 0:68795b066622 | |
771 | user: foo |
|
771 | user: foo | |
772 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
772 | date: Thu Jan 01 00:00:00 1970 +0000 | |
773 | summary: 2 |
|
773 | summary: 2 | |
774 |
|
774 | |||
775 | changeset: 13:7a4785234d87 |
|
775 | changeset: 13:7a4785234d87 | |
776 | user: foo |
|
776 | user: foo | |
777 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
777 | date: Thu Jan 01 00:00:00 1970 +0000 | |
778 | summary: 2 |
|
778 | summary: 2 | |
779 |
|
779 | |||
780 | changeset: 19:9627f653b421 |
|
780 | changeset: 19:9627f653b421 | |
781 | user: test |
|
781 | user: test | |
782 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
782 | date: Thu Jan 01 00:00:00 1970 +0000 | |
783 | summary: 2 |
|
783 | summary: 2 | |
784 |
|
784 | |||
785 | changeset: 21:7e61b508e709 |
|
785 | changeset: 21:7e61b508e709 | |
786 | branch: dev |
|
786 | branch: dev | |
787 | user: foo |
|
787 | user: foo | |
788 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
788 | date: Thu Jan 01 00:00:00 1970 +0000 | |
789 | summary: 2 |
|
789 | summary: 2 | |
790 |
|
790 | |||
791 | changeset: 22:3a4e92d81b97 |
|
791 | changeset: 22:3a4e92d81b97 | |
792 | branch: dev |
|
792 | branch: dev | |
793 | tag: tip |
|
793 | tag: tip | |
794 | user: foo |
|
794 | user: foo | |
795 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
795 | date: Thu Jan 01 00:00:00 1970 +0000 | |
796 | summary: 2 |
|
796 | summary: 2 | |
797 |
|
797 | |||
798 |
|
798 | |||
799 | graft works on complex revset |
|
799 | graft works on complex revset | |
800 |
|
800 | |||
801 | $ hg graft 'origin(13) or destination(origin(13))' |
|
801 | $ hg graft 'origin(13) or destination(origin(13))' | |
802 | skipping ancestor revision 21:7e61b508e709 |
|
802 | skipping ancestor revision 21:7e61b508e709 | |
803 | skipping ancestor revision 22:3a4e92d81b97 |
|
803 | skipping ancestor revision 22:3a4e92d81b97 | |
804 | skipping revision 2:5c095ad7e90f (already grafted to 22:3a4e92d81b97) |
|
804 | skipping revision 2:5c095ad7e90f (already grafted to 22:3a4e92d81b97) | |
805 | grafting 7:ef0ef43d49e7 "2" |
|
805 | grafting 7:ef0ef43d49e7 "2" | |
806 | warning: can't find ancestor for 'b' copied from 'a'! |
|
806 | warning: can't find ancestor for 'b' copied from 'a'! | |
807 | grafting 13:7a4785234d87 "2" |
|
807 | grafting 13:7a4785234d87 "2" | |
808 | warning: can't find ancestor for 'b' copied from 'a'! |
|
808 | warning: can't find ancestor for 'b' copied from 'a'! | |
809 | grafting 19:9627f653b421 "2" |
|
809 | grafting 19:9627f653b421 "2" | |
810 | merging b |
|
810 | merging b | |
811 | warning: can't find ancestor for 'b' copied from 'a'! |
|
811 | warning: can't find ancestor for 'b' copied from 'a'! | |
812 |
|
812 | |||
813 | graft with --force (still doesn't graft merges) |
|
813 | graft with --force (still doesn't graft merges) | |
814 |
|
814 | |||
815 | $ hg graft 19 0 6 |
|
815 | $ hg graft 19 0 6 | |
816 | skipping ungraftable merge revision 6 |
|
816 | skipping ungraftable merge revision 6 | |
817 | skipping ancestor revision 0:68795b066622 |
|
817 | skipping ancestor revision 0:68795b066622 | |
818 | skipping already grafted revision 19:9627f653b421 (22:3a4e92d81b97 also has origin 2:5c095ad7e90f) |
|
818 | skipping already grafted revision 19:9627f653b421 (22:3a4e92d81b97 also has origin 2:5c095ad7e90f) | |
819 | [255] |
|
819 | [255] | |
820 | $ hg graft 19 0 6 --force |
|
820 | $ hg graft 19 0 6 --force | |
821 | skipping ungraftable merge revision 6 |
|
821 | skipping ungraftable merge revision 6 | |
822 | grafting 19:9627f653b421 "2" |
|
822 | grafting 19:9627f653b421 "2" | |
823 | merging b |
|
823 | merging b | |
824 | warning: can't find ancestor for 'b' copied from 'a'! |
|
824 | warning: can't find ancestor for 'b' copied from 'a'! | |
825 | grafting 0:68795b066622 "0" |
|
825 | grafting 0:68795b066622 "0" | |
826 |
|
826 | |||
827 | graft --force after backout |
|
827 | graft --force after backout | |
828 |
|
828 | |||
829 | $ echo abc > a |
|
829 | $ echo abc > a | |
830 | $ hg ci -m 28 |
|
830 | $ hg ci -m 28 | |
831 | $ hg backout 28 |
|
831 | $ hg backout 28 | |
832 | reverting a |
|
832 | reverting a | |
833 | changeset 29:9d95e865b00c backs out changeset 28:cc20d29aec8d |
|
833 | changeset 29:9d95e865b00c backs out changeset 28:cc20d29aec8d | |
834 | $ hg graft 28 |
|
834 | $ hg graft 28 | |
835 | skipping ancestor revision 28:cc20d29aec8d |
|
835 | skipping ancestor revision 28:cc20d29aec8d | |
836 | [255] |
|
836 | [255] | |
837 | $ hg graft 28 --force |
|
837 | $ hg graft 28 --force | |
838 | grafting 28:cc20d29aec8d "28" |
|
838 | grafting 28:cc20d29aec8d "28" | |
839 | merging a |
|
839 | merging a | |
840 | $ cat a |
|
840 | $ cat a | |
841 | abc |
|
841 | abc | |
842 |
|
842 | |||
843 | graft --continue after --force |
|
843 | graft --continue after --force | |
844 |
|
844 | |||
845 | $ echo def > a |
|
845 | $ echo def > a | |
846 | $ hg ci -m 31 |
|
846 | $ hg ci -m 31 | |
847 | $ hg graft 28 --force --tool internal:fail |
|
847 | $ hg graft 28 --force --tool internal:fail | |
848 | grafting 28:cc20d29aec8d "28" |
|
848 | grafting 28:cc20d29aec8d "28" | |
849 | abort: unresolved conflicts, can't continue |
|
849 | abort: unresolved conflicts, can't continue | |
850 | (use 'hg resolve' and 'hg graft --continue') |
|
850 | (use 'hg resolve' and 'hg graft --continue') | |
851 | [255] |
|
851 | [255] | |
852 | $ hg resolve --all |
|
852 | $ hg resolve --all | |
853 | merging a |
|
853 | merging a | |
854 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
854 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
855 | [1] |
|
855 | [1] | |
856 | $ echo abc > a |
|
856 | $ echo abc > a | |
857 | $ hg resolve -m a |
|
857 | $ hg resolve -m a | |
858 | (no more unresolved files) |
|
858 | (no more unresolved files) | |
859 | continue: hg graft --continue |
|
859 | continue: hg graft --continue | |
860 | $ hg graft -c |
|
860 | $ hg graft -c | |
861 | grafting 28:cc20d29aec8d "28" |
|
861 | grafting 28:cc20d29aec8d "28" | |
862 | $ cat a |
|
862 | $ cat a | |
863 | abc |
|
863 | abc | |
864 |
|
864 | |||
865 | Continue testing same origin policy, using revision numbers from test above |
|
865 | Continue testing same origin policy, using revision numbers from test above | |
866 | but do some destructive editing of the repo: |
|
866 | but do some destructive editing of the repo: | |
867 |
|
867 | |||
868 | $ hg up -qC 7 |
|
868 | $ hg up -qC 7 | |
869 | $ hg tag -l -r 13 tmp |
|
869 | $ hg tag -l -r 13 tmp | |
870 | $ hg --config extensions.strip= strip 2 |
|
870 | $ hg --config extensions.strip= strip 2 | |
871 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg |
|
871 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg | |
872 | $ hg graft tmp |
|
872 | $ hg graft tmp | |
873 | skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f) |
|
873 | skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f) | |
874 | [255] |
|
874 | [255] | |
875 |
|
875 | |||
876 | Empty graft |
|
876 | Empty graft | |
877 |
|
877 | |||
878 | $ hg up -qr 26 |
|
878 | $ hg up -qr 26 | |
879 | $ hg tag -f something |
|
879 | $ hg tag -f something | |
880 | $ hg graft -qr 27 |
|
880 | $ hg graft -qr 27 | |
881 | $ hg graft -f 27 |
|
881 | $ hg graft -f 27 | |
882 | grafting 27:17d42b8f5d50 "28" |
|
882 | grafting 27:17d42b8f5d50 "28" | |
883 | note: graft of 27:17d42b8f5d50 created no changes to commit |
|
883 | note: graft of 27:17d42b8f5d50 created no changes to commit | |
884 |
|
884 | |||
885 | $ cd .. |
|
885 | $ cd .. | |
886 |
|
886 | |||
887 | Graft to duplicate a commit |
|
887 | Graft to duplicate a commit | |
888 |
|
888 | |||
889 | $ hg init graftsibling |
|
889 | $ hg init graftsibling | |
890 | $ cd graftsibling |
|
890 | $ cd graftsibling | |
891 | $ touch a |
|
891 | $ touch a | |
892 | $ hg commit -qAm a |
|
892 | $ hg commit -qAm a | |
893 | $ touch b |
|
893 | $ touch b | |
894 | $ hg commit -qAm b |
|
894 | $ hg commit -qAm b | |
895 | $ hg log -G -T '{rev}\n' |
|
895 | $ hg log -G -T '{rev}\n' | |
896 | @ 1 |
|
896 | @ 1 | |
897 | | |
|
897 | | | |
898 | o 0 |
|
898 | o 0 | |
899 |
|
899 | |||
900 | $ hg up -q 0 |
|
900 | $ hg up -q 0 | |
901 | $ hg graft -r 1 |
|
901 | $ hg graft -r 1 | |
902 | grafting 1:0e067c57feba "b" (tip) |
|
902 | grafting 1:0e067c57feba "b" (tip) | |
903 | $ hg log -G -T '{rev}\n' |
|
903 | $ hg log -G -T '{rev}\n' | |
904 | @ 2 |
|
904 | @ 2 | |
905 | | |
|
905 | | | |
906 | | o 1 |
|
906 | | o 1 | |
907 | |/ |
|
907 | |/ | |
908 | o 0 |
|
908 | o 0 | |
909 |
|
909 | |||
910 | Graft to duplicate a commit twice |
|
910 | Graft to duplicate a commit twice | |
911 |
|
911 | |||
912 | $ hg up -q 0 |
|
912 | $ hg up -q 0 | |
913 | $ hg graft -r 2 |
|
913 | $ hg graft -r 2 | |
914 | grafting 2:044ec77f6389 "b" (tip) |
|
914 | grafting 2:044ec77f6389 "b" (tip) | |
915 | $ hg log -G -T '{rev}\n' |
|
915 | $ hg log -G -T '{rev}\n' | |
916 | @ 3 |
|
916 | @ 3 | |
917 | | |
|
917 | | | |
918 | | o 2 |
|
918 | | o 2 | |
919 | |/ |
|
919 | |/ | |
920 | | o 1 |
|
920 | | o 1 | |
921 | |/ |
|
921 | |/ | |
922 | o 0 |
|
922 | o 0 | |
923 |
|
923 | |||
924 | Graft from behind a move or rename |
|
924 | Graft from behind a move or rename | |
925 | ================================== |
|
925 | ================================== | |
926 |
|
926 | |||
927 | NOTE: This is affected by issue5343, and will need updating when it's fixed |
|
927 | NOTE: This is affected by issue5343, and will need updating when it's fixed | |
928 |
|
928 | |||
929 | Consider this topology for a regular graft: |
|
929 | Consider this topology for a regular graft: | |
930 |
|
930 | |||
931 | o c1 |
|
931 | o c1 | |
932 | | |
|
932 | | | |
933 | | o c2 |
|
933 | | o c2 | |
934 | | | |
|
934 | | | | |
935 | | o ca # stands for "common ancestor" |
|
935 | | o ca # stands for "common ancestor" | |
936 | |/ |
|
936 | |/ | |
937 | o cta # stands for "common topological ancestor" |
|
937 | o cta # stands for "common topological ancestor" | |
938 |
|
938 | |||
939 | Note that in issue5343, ca==cta. |
|
939 | Note that in issue5343, ca==cta. | |
940 |
|
940 | |||
941 | The following table shows the possible cases. Here, "x->y" and, equivalently, |
|
941 | The following table shows the possible cases. Here, "x->y" and, equivalently, | |
942 | "y<-x", where x is an ancestor of y, means that some copy happened from x to y. |
|
942 | "y<-x", where x is an ancestor of y, means that some copy happened from x to y. | |
943 |
|
943 | |||
944 | name | c1<-cta | cta<->ca | ca->c2 |
|
944 | name | c1<-cta | cta<->ca | ca->c2 | |
945 | A.0 | | | |
|
945 | A.0 | | | | |
946 | A.1 | X | | |
|
946 | A.1 | X | | | |
947 | A.2 | | X | |
|
947 | A.2 | | X | | |
948 | A.3 | | | X |
|
948 | A.3 | | | X | |
949 | A.4 | X | X | |
|
949 | A.4 | X | X | | |
950 | A.5 | X | | X |
|
950 | A.5 | X | | X | |
951 | A.6 | | X | X |
|
951 | A.6 | | X | X | |
952 | A.7 | X | X | X |
|
952 | A.7 | X | X | X | |
953 |
|
953 | |||
954 | A.0 is trivial, and doesn't need copy tracking. |
|
954 | A.0 is trivial, and doesn't need copy tracking. | |
955 | For A.1, a forward rename is recorded in the c1 pass, to be followed later. |
|
955 | For A.1, a forward rename is recorded in the c1 pass, to be followed later. | |
956 | In A.2, the rename is recorded in the c2 pass and followed backwards. |
|
956 | In A.2, the rename is recorded in the c2 pass and followed backwards. | |
957 | A.3 is recorded in the c2 pass as a forward rename to be duplicated on target. |
|
957 | A.3 is recorded in the c2 pass as a forward rename to be duplicated on target. | |
958 | In A.4, both passes of checkcopies record incomplete renames, which are |
|
958 | In A.4, both passes of checkcopies record incomplete renames, which are | |
959 | then joined in mergecopies to record a rename to be followed. |
|
959 | then joined in mergecopies to record a rename to be followed. | |
960 | In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass |
|
960 | In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass | |
961 | records an incomplete divergence. The incomplete rename is then joined to the |
|
961 | records an incomplete divergence. The incomplete rename is then joined to the | |
962 | appropriate side of the incomplete divergence, and the result is recorded as a |
|
962 | appropriate side of the incomplete divergence, and the result is recorded as a | |
963 | divergence. The code doesn't distinguish at all between these two cases, since |
|
963 | divergence. The code doesn't distinguish at all between these two cases, since | |
964 | the end result of them is the same: an incomplete divergence joined with an |
|
964 | the end result of them is the same: an incomplete divergence joined with an | |
965 | incomplete rename into a divergence. |
|
965 | incomplete rename into a divergence. | |
966 | Finally, A.6 records a divergence entirely in the c2 pass. |
|
966 | Finally, A.6 records a divergence entirely in the c2 pass. | |
967 |
|
967 | |||
968 | A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all. |
|
968 | A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all. | |
969 | A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge. |
|
969 | A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge. | |
970 | A.5 has issue5343 as a special case. |
|
970 | A.5 has issue5343 as a special case. | |
971 | A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious |
|
971 | A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious | |
972 | incomplete divergence, which is in fact complete. This is handled later in |
|
972 | incomplete divergence, which is in fact complete. This is handled later in | |
973 | mergecopies. |
|
973 | mergecopies. | |
974 | A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b, |
|
974 | A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b, | |
975 | a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting, |
|
975 | a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting, | |
976 | the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base |
|
976 | the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base | |
977 | case, a<-b<-c->a is treated the same as a<-b<-b->a). |
|
977 | case, a<-b<-c->a is treated the same as a<-b<-b->a). | |
978 |
|
978 | |||
979 | f5a therefore tests the "ping-pong" rename case, where a file is renamed to the |
|
979 | f5a therefore tests the "ping-pong" rename case, where a file is renamed to the | |
980 | same name on both branches, then the rename is backed out on one branch, and |
|
980 | same name on both branches, then the rename is backed out on one branch, and | |
981 | the backout is grafted to the other branch. This creates a challenging rename |
|
981 | the backout is grafted to the other branch. This creates a challenging rename | |
982 | sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft |
|
982 | sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft | |
983 | source, respectively. Since rename detection will run on the c1 side for such a |
|
983 | source, respectively. Since rename detection will run on the c1 side for such a | |
984 | sequence (as for technical reasons, we split the c1 and c2 sides not at the |
|
984 | sequence (as for technical reasons, we split the c1 and c2 sides not at the | |
985 | graft CA, but rather at the topological CA), it will pick up a false rename, |
|
985 | graft CA, but rather at the topological CA), it will pick up a false rename, | |
986 | and cause a spurious merge conflict. This false rename is always exactly the |
|
986 | and cause a spurious merge conflict. This false rename is always exactly the | |
987 | reverse of the true rename that would be detected on the c2 side, so we can |
|
987 | reverse of the true rename that would be detected on the c2 side, so we can | |
988 | correct for it by detecting this condition and reversing as necessary. |
|
988 | correct for it by detecting this condition and reversing as necessary. | |
989 |
|
989 | |||
990 | First, set up the repository with commits to be grafted |
|
990 | First, set up the repository with commits to be grafted | |
991 |
|
991 | |||
992 | $ hg init ../graftmove |
|
992 | $ hg init ../graftmove | |
993 | $ cd ../graftmove |
|
993 | $ cd ../graftmove | |
994 | $ echo c1a > f1a |
|
994 | $ echo c1a > f1a | |
995 | $ echo c2a > f2a |
|
995 | $ echo c2a > f2a | |
996 | $ echo c3a > f3a |
|
996 | $ echo c3a > f3a | |
997 | $ echo c4a > f4a |
|
997 | $ echo c4a > f4a | |
998 | $ echo c5a > f5a |
|
998 | $ echo c5a > f5a | |
999 | $ hg ci -qAm A0 |
|
999 | $ hg ci -qAm A0 | |
1000 | $ hg mv f1a f1b |
|
1000 | $ hg mv f1a f1b | |
1001 | $ hg mv f3a f3b |
|
1001 | $ hg mv f3a f3b | |
1002 | $ hg mv f5a f5b |
|
1002 | $ hg mv f5a f5b | |
1003 | $ hg ci -qAm B0 |
|
1003 | $ hg ci -qAm B0 | |
1004 | $ echo c1c > f1b |
|
1004 | $ echo c1c > f1b | |
1005 | $ hg mv f2a f2c |
|
1005 | $ hg mv f2a f2c | |
1006 | $ hg mv f5b f5a |
|
1006 | $ hg mv f5b f5a | |
1007 | $ echo c5c > f5a |
|
1007 | $ echo c5c > f5a | |
1008 | $ hg ci -qAm C0 |
|
1008 | $ hg ci -qAm C0 | |
1009 | $ hg mv f3b f3d |
|
1009 | $ hg mv f3b f3d | |
1010 | $ echo c4d > f4a |
|
1010 | $ echo c4d > f4a | |
1011 | $ hg ci -qAm D0 |
|
1011 | $ hg ci -qAm D0 | |
1012 | $ hg log -G |
|
1012 | $ hg log -G | |
1013 | @ changeset: 3:b69f5839d2d9 |
|
1013 | @ changeset: 3:b69f5839d2d9 | |
1014 | | tag: tip |
|
1014 | | tag: tip | |
1015 | | user: test |
|
1015 | | user: test | |
1016 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1016 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1017 | | summary: D0 |
|
1017 | | summary: D0 | |
1018 | | |
|
1018 | | | |
1019 | o changeset: 2:f58c7e2b28fa |
|
1019 | o changeset: 2:f58c7e2b28fa | |
1020 | | user: test |
|
1020 | | user: test | |
1021 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1021 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1022 | | summary: C0 |
|
1022 | | summary: C0 | |
1023 | | |
|
1023 | | | |
1024 | o changeset: 1:3d7bba921b5d |
|
1024 | o changeset: 1:3d7bba921b5d | |
1025 | | user: test |
|
1025 | | user: test | |
1026 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1026 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1027 | | summary: B0 |
|
1027 | | summary: B0 | |
1028 | | |
|
1028 | | | |
1029 | o changeset: 0:11f7a1b56675 |
|
1029 | o changeset: 0:11f7a1b56675 | |
1030 | user: test |
|
1030 | user: test | |
1031 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1031 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1032 | summary: A0 |
|
1032 | summary: A0 | |
1033 |
|
1033 | |||
1034 |
|
1034 | |||
1035 | Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the |
|
1035 | Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the | |
1036 | two renames actually converge to the same name (thus no actual divergence). |
|
1036 | two renames actually converge to the same name (thus no actual divergence). | |
1037 |
|
1037 | |||
1038 | $ hg up -q 'desc("A0")' |
|
1038 | $ hg up -q 'desc("A0")' | |
1039 | $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit |
|
1039 | $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit | |
1040 | grafting 2:f58c7e2b28fa "C0" |
|
1040 | grafting 2:f58c7e2b28fa "C0" | |
1041 | merging f1a and f1b to f1a |
|
1041 | merging f1a and f1b to f1a | |
1042 | merging f5a |
|
1042 | merging f5a | |
1043 | warning: can't find ancestor for 'f5a' copied from 'f5b'! |
|
1043 | warning: can't find ancestor for 'f5a' copied from 'f5b'! | |
1044 | $ hg status --change . |
|
1044 | $ hg status --change . | |
1045 | M f1a |
|
1045 | M f1a | |
1046 | M f5a |
|
1046 | M f5a | |
1047 | A f2c |
|
1047 | A f2c | |
1048 | R f2a |
|
1048 | R f2a | |
1049 | $ hg cat f1a |
|
1049 | $ hg cat f1a | |
1050 | c1c |
|
1050 | c1c | |
1051 | $ hg cat f1b |
|
1051 | $ hg cat f1b | |
1052 | f1b: no such file in rev c9763722f9bd |
|
1052 | f1b: no such file in rev c9763722f9bd | |
1053 | [1] |
|
1053 | [1] | |
1054 |
|
1054 | |||
1055 | Test the cases A.0 (f4x) and A.6 (f3x) |
|
1055 | Test the cases A.0 (f4x) and A.6 (f3x) | |
1056 |
|
1056 | |||
1057 | $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit |
|
1057 | $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit | |
1058 | grafting 3:b69f5839d2d9 "D0" |
|
1058 | grafting 3:b69f5839d2d9 "D0" | |
1059 | note: possible conflict - f3b was renamed multiple times to: |
|
1059 | note: possible conflict - f3b was renamed multiple times to: | |
1060 | f3a |
|
1060 | f3a | |
1061 | f3d |
|
1061 | f3d | |
1062 | warning: can't find ancestor for 'f3d' copied from 'f3b'! |
|
1062 | warning: can't find ancestor for 'f3d' copied from 'f3b'! | |
1063 |
|
1063 | |||
1064 | Set up the repository for some further tests |
|
1064 | Set up the repository for some further tests | |
1065 |
|
1065 | |||
1066 | $ hg up -q "min(desc("A0"))" |
|
1066 | $ hg up -q "min(desc("A0"))" | |
1067 | $ hg mv f1a f1e |
|
1067 | $ hg mv f1a f1e | |
1068 | $ echo c2e > f2a |
|
1068 | $ echo c2e > f2a | |
1069 | $ hg mv f3a f3e |
|
1069 | $ hg mv f3a f3e | |
1070 | $ hg mv f4a f4e |
|
1070 | $ hg mv f4a f4e | |
1071 | $ hg mv f5a f5b |
|
1071 | $ hg mv f5a f5b | |
1072 | $ hg ci -qAm "E0" |
|
1072 | $ hg ci -qAm "E0" | |
1073 | $ hg up -q "min(desc("A0"))" |
|
1073 | $ hg up -q "min(desc("A0"))" | |
1074 | $ hg cp f1a f1f |
|
1074 | $ hg cp f1a f1f | |
1075 | $ hg ci -qAm "F0" |
|
1075 | $ hg ci -qAm "F0" | |
1076 | $ hg up -q "min(desc("A0"))" |
|
1076 | $ hg up -q "min(desc("A0"))" | |
1077 | $ hg cp f1a f1g |
|
1077 | $ hg cp f1a f1g | |
1078 | $ echo c1g > f1g |
|
1078 | $ echo c1g > f1g | |
1079 | $ hg ci -qAm "G0" |
|
1079 | $ hg ci -qAm "G0" | |
1080 | $ hg log -G |
|
1080 | $ hg log -G | |
1081 | @ changeset: 8:ba67f08fb15a |
|
1081 | @ changeset: 8:ba67f08fb15a | |
1082 | | tag: tip |
|
1082 | | tag: tip | |
1083 | | parent: 0:11f7a1b56675 |
|
1083 | | parent: 0:11f7a1b56675 | |
1084 | | user: test |
|
1084 | | user: test | |
1085 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1085 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1086 | | summary: G0 |
|
1086 | | summary: G0 | |
1087 | | |
|
1087 | | | |
1088 | | o changeset: 7:d376ab0d7fda |
|
1088 | | o changeset: 7:d376ab0d7fda | |
1089 | |/ parent: 0:11f7a1b56675 |
|
1089 | |/ parent: 0:11f7a1b56675 | |
1090 | | user: test |
|
1090 | | user: test | |
1091 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1091 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1092 | | summary: F0 |
|
1092 | | summary: F0 | |
1093 | | |
|
1093 | | | |
1094 | | o changeset: 6:6bd1736cab86 |
|
1094 | | o changeset: 6:6bd1736cab86 | |
1095 | |/ parent: 0:11f7a1b56675 |
|
1095 | |/ parent: 0:11f7a1b56675 | |
1096 | | user: test |
|
1096 | | user: test | |
1097 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1097 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1098 | | summary: E0 |
|
1098 | | summary: E0 | |
1099 | | |
|
1099 | | | |
1100 | | o changeset: 5:560daee679da |
|
1100 | | o changeset: 5:560daee679da | |
1101 | | | user: test |
|
1101 | | | user: test | |
1102 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1102 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1103 | | | summary: D1 |
|
1103 | | | summary: D1 | |
1104 | | | |
|
1104 | | | | |
1105 | | o changeset: 4:c9763722f9bd |
|
1105 | | o changeset: 4:c9763722f9bd | |
1106 | |/ parent: 0:11f7a1b56675 |
|
1106 | |/ parent: 0:11f7a1b56675 | |
1107 | | user: test |
|
1107 | | user: test | |
1108 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1108 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1109 | | summary: C1 |
|
1109 | | summary: C1 | |
1110 | | |
|
1110 | | | |
1111 | | o changeset: 3:b69f5839d2d9 |
|
1111 | | o changeset: 3:b69f5839d2d9 | |
1112 | | | user: test |
|
1112 | | | user: test | |
1113 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1113 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1114 | | | summary: D0 |
|
1114 | | | summary: D0 | |
1115 | | | |
|
1115 | | | | |
1116 | | o changeset: 2:f58c7e2b28fa |
|
1116 | | o changeset: 2:f58c7e2b28fa | |
1117 | | | user: test |
|
1117 | | | user: test | |
1118 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1118 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1119 | | | summary: C0 |
|
1119 | | | summary: C0 | |
1120 | | | |
|
1120 | | | | |
1121 | | o changeset: 1:3d7bba921b5d |
|
1121 | | o changeset: 1:3d7bba921b5d | |
1122 | |/ user: test |
|
1122 | |/ user: test | |
1123 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1123 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1124 | | summary: B0 |
|
1124 | | summary: B0 | |
1125 | | |
|
1125 | | | |
1126 | o changeset: 0:11f7a1b56675 |
|
1126 | o changeset: 0:11f7a1b56675 | |
1127 | user: test |
|
1127 | user: test | |
1128 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1128 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1129 | summary: A0 |
|
1129 | summary: A0 | |
1130 |
|
1130 | |||
1131 |
|
1131 | |||
1132 | Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x), |
|
1132 | Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x), | |
1133 | and A.3 with a local content change to be preserved (f2x). |
|
1133 | and A.3 with a local content change to be preserved (f2x). | |
1134 |
|
1134 | |||
1135 | $ hg up -q "desc("E0")" |
|
1135 | $ hg up -q "desc("E0")" | |
1136 | $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit |
|
1136 | $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit | |
1137 | grafting 2:f58c7e2b28fa "C0" |
|
1137 | grafting 2:f58c7e2b28fa "C0" | |
1138 | merging f1e and f1b to f1e |
|
1138 | merging f1e and f1b to f1e | |
1139 | merging f2a and f2c to f2c |
|
1139 | merging f2a and f2c to f2c | |
1140 |
|
1140 | |||
1141 | Test the cases A.1 (f4x) and A.7 (f3x). |
|
1141 | Test the cases A.1 (f4x) and A.7 (f3x). | |
1142 |
|
1142 | |||
1143 | $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit |
|
1143 | $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit | |
1144 | grafting 3:b69f5839d2d9 "D0" |
|
1144 | grafting 3:b69f5839d2d9 "D0" | |
1145 | note: possible conflict - f3b was renamed multiple times to: |
|
1145 | note: possible conflict - f3b was renamed multiple times to: | |
1146 | f3d |
|
1146 | f3d | |
1147 | f3e |
|
1147 | f3e | |
1148 | merging f4e and f4a to f4e |
|
1148 | merging f4e and f4a to f4e | |
1149 | warning: can't find ancestor for 'f3d' copied from 'f3b'! |
|
1149 | warning: can't find ancestor for 'f3d' copied from 'f3b'! | |
1150 |
|
1150 | |||
1151 | $ hg cat f2c |
|
1151 | $ hg cat f2c | |
1152 | c2e |
|
1152 | c2e | |
1153 |
|
1153 | |||
1154 | Test the case A.5 (move case, f1x). |
|
1154 | Test the case A.5 (move case, f1x). | |
1155 |
|
1155 | |||
1156 | $ hg up -q "desc("C0")" |
|
1156 | $ hg up -q "desc("C0")" | |
1157 | BROKEN: Shouldn't get the warning about missing ancestor |
|
1157 | BROKEN: Shouldn't get the warning about missing ancestor | |
1158 | $ HGEDITOR="echo E1 >" hg graft -r 'desc("E0")' --edit |
|
1158 | $ HGEDITOR="echo E1 >" hg graft -r 'desc("E0")' --edit | |
1159 | grafting 6:6bd1736cab86 "E0" |
|
1159 | grafting 6:6bd1736cab86 "E0" | |
1160 | note: possible conflict - f1a was renamed multiple times to: |
|
1160 | note: possible conflict - f1a was renamed multiple times to: | |
1161 | f1b |
|
1161 | f1b | |
1162 | f1e |
|
1162 | f1e | |
1163 | note: possible conflict - f3a was renamed multiple times to: |
|
1163 | note: possible conflict - f3a was renamed multiple times to: | |
1164 | f3b |
|
1164 | f3b | |
1165 | f3e |
|
1165 | f3e | |
1166 | merging f2c and f2a to f2c |
|
1166 | merging f2c and f2a to f2c | |
1167 | merging f5a and f5b to f5b |
|
1167 | merging f5a and f5b to f5b | |
1168 | warning: can't find ancestor for 'f1e' copied from 'f1a'! |
|
1168 | warning: can't find ancestor for 'f1e' copied from 'f1a'! | |
1169 | warning: can't find ancestor for 'f3e' copied from 'f3a'! |
|
1169 | warning: can't find ancestor for 'f3e' copied from 'f3a'! | |
1170 | $ cat f1e |
|
1170 | $ cat f1e | |
1171 | c1a |
|
1171 | c1a | |
1172 |
|
1172 | |||
1173 | Test the case A.5 (copy case, f1x). |
|
1173 | Test the case A.5 (copy case, f1x). | |
1174 |
|
1174 | |||
1175 | $ hg up -q "desc("C0")" |
|
1175 | $ hg up -q "desc("C0")" | |
1176 | BROKEN: Shouldn't get the warning about missing ancestor |
|
1176 | BROKEN: Shouldn't get the warning about missing ancestor | |
1177 | $ HGEDITOR="echo F1 >" hg graft -r 'desc("F0")' --edit |
|
1177 | $ HGEDITOR="echo F1 >" hg graft -r 'desc("F0")' --edit | |
1178 | grafting 7:d376ab0d7fda "F0" |
|
1178 | grafting 7:d376ab0d7fda "F0" | |
1179 | warning: can't find ancestor for 'f1f' copied from 'f1a'! |
|
1179 | warning: can't find ancestor for 'f1f' copied from 'f1a'! | |
1180 | BROKEN: f1f should be marked a copy from f1b |
|
1180 | BROKEN: f1f should be marked a copy from f1b | |
1181 | $ hg st --copies --change . |
|
1181 | $ hg st --copies --change . | |
1182 | A f1f |
|
1182 | A f1f | |
1183 | BROKEN: f1f should have the new content from f1b (i.e. "c1c") |
|
1183 | BROKEN: f1f should have the new content from f1b (i.e. "c1c") | |
1184 | $ cat f1f |
|
1184 | $ cat f1f | |
1185 | c1a |
|
1185 | c1a | |
1186 |
|
1186 | |||
1187 | Test the case A.5 (copy+modify case, f1x). |
|
1187 | Test the case A.5 (copy+modify case, f1x). | |
1188 |
|
1188 | |||
1189 | $ hg up -q "desc("C0")" |
|
1189 | $ hg up -q "desc("C0")" | |
1190 | BROKEN: We should get a merge conflict from the 3-way merge between f1b in C0 |
|
1190 | BROKEN: We should get a merge conflict from the 3-way merge between f1b in C0 | |
1191 | (content "c1c") and f1g in G0 (content "c1g") with f1a in A0 as base (content |
|
1191 | (content "c1c") and f1g in G0 (content "c1g") with f1a in A0 as base (content | |
1192 | "c1a") |
|
1192 | "c1a") | |
1193 | $ HGEDITOR="echo G1 >" hg graft -r 'desc("G0")' --edit |
|
1193 | $ HGEDITOR="echo G1 >" hg graft -r 'desc("G0")' --edit | |
1194 | grafting 8:ba67f08fb15a "G0" |
|
1194 | grafting 8:ba67f08fb15a "G0" | |
1195 | warning: can't find ancestor for 'f1g' copied from 'f1a'! |
|
1195 | warning: can't find ancestor for 'f1g' copied from 'f1a'! | |
1196 |
|
1196 | |||
1197 | Check the results of the grafts tested |
|
1197 | Check the results of the grafts tested | |
1198 |
|
1198 | |||
1199 | $ hg log -CGv --patch --git |
|
1199 | $ hg log -CGv --patch --git | |
1200 | @ changeset: 13:ef3adf6c20a4 |
|
1200 | @ changeset: 13:ef3adf6c20a4 | |
1201 | | tag: tip |
|
1201 | | tag: tip | |
1202 | | parent: 2:f58c7e2b28fa |
|
1202 | | parent: 2:f58c7e2b28fa | |
1203 | | user: test |
|
1203 | | user: test | |
1204 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1204 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1205 | | files: f1g |
|
1205 | | files: f1g | |
1206 | | description: |
|
1206 | | description: | |
1207 | | G1 |
|
1207 | | G1 | |
1208 | | |
|
1208 | | | |
1209 | | |
|
1209 | | | |
1210 | | diff --git a/f1g b/f1g |
|
1210 | | diff --git a/f1g b/f1g | |
1211 | | new file mode 100644 |
|
1211 | | new file mode 100644 | |
1212 | | --- /dev/null |
|
1212 | | --- /dev/null | |
1213 | | +++ b/f1g |
|
1213 | | +++ b/f1g | |
1214 | | @@ -0,0 +1,1 @@ |
|
1214 | | @@ -0,0 +1,1 @@ | |
1215 | | +c1g |
|
1215 | | +c1g | |
1216 | | |
|
1216 | | | |
1217 | | o changeset: 12:b5542d755b54 |
|
1217 | | o changeset: 12:b5542d755b54 | |
1218 | |/ parent: 2:f58c7e2b28fa |
|
1218 | |/ parent: 2:f58c7e2b28fa | |
1219 | | user: test |
|
1219 | | user: test | |
1220 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1220 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1221 | | files: f1f |
|
1221 | | files: f1f | |
1222 | | description: |
|
1222 | | description: | |
1223 | | F1 |
|
1223 | | F1 | |
1224 | | |
|
1224 | | | |
1225 | | |
|
1225 | | | |
1226 | | diff --git a/f1f b/f1f |
|
1226 | | diff --git a/f1f b/f1f | |
1227 | | new file mode 100644 |
|
1227 | | new file mode 100644 | |
1228 | | --- /dev/null |
|
1228 | | --- /dev/null | |
1229 | | +++ b/f1f |
|
1229 | | +++ b/f1f | |
1230 | | @@ -0,0 +1,1 @@ |
|
1230 | | @@ -0,0 +1,1 @@ | |
1231 | | +c1a |
|
1231 | | +c1a | |
1232 | | |
|
1232 | | | |
1233 | | o changeset: 11:f8a162271246 |
|
1233 | | o changeset: 11:f8a162271246 | |
1234 | |/ parent: 2:f58c7e2b28fa |
|
1234 | |/ parent: 2:f58c7e2b28fa | |
1235 | | user: test |
|
1235 | | user: test | |
1236 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1236 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1237 | | files: f1e f2c f3e f4a f4e f5a f5b |
|
1237 | | files: f1e f2c f3e f4a f4e f5a f5b | |
1238 | | copies: f4e (f4a) f5b (f5a) |
|
1238 | | copies: f4e (f4a) f5b (f5a) | |
1239 | | description: |
|
1239 | | description: | |
1240 | | E1 |
|
1240 | | E1 | |
1241 | | |
|
1241 | | | |
1242 | | |
|
1242 | | | |
1243 | | diff --git a/f1e b/f1e |
|
1243 | | diff --git a/f1e b/f1e | |
1244 | | new file mode 100644 |
|
1244 | | new file mode 100644 | |
1245 | | --- /dev/null |
|
1245 | | --- /dev/null | |
1246 | | +++ b/f1e |
|
1246 | | +++ b/f1e | |
1247 | | @@ -0,0 +1,1 @@ |
|
1247 | | @@ -0,0 +1,1 @@ | |
1248 | | +c1a |
|
1248 | | +c1a | |
1249 | | diff --git a/f2c b/f2c |
|
1249 | | diff --git a/f2c b/f2c | |
1250 | | --- a/f2c |
|
1250 | | --- a/f2c | |
1251 | | +++ b/f2c |
|
1251 | | +++ b/f2c | |
1252 | | @@ -1,1 +1,1 @@ |
|
1252 | | @@ -1,1 +1,1 @@ | |
1253 | | -c2a |
|
1253 | | -c2a | |
1254 | | +c2e |
|
1254 | | +c2e | |
1255 | | diff --git a/f3e b/f3e |
|
1255 | | diff --git a/f3e b/f3e | |
1256 | | new file mode 100644 |
|
1256 | | new file mode 100644 | |
1257 | | --- /dev/null |
|
1257 | | --- /dev/null | |
1258 | | +++ b/f3e |
|
1258 | | +++ b/f3e | |
1259 | | @@ -0,0 +1,1 @@ |
|
1259 | | @@ -0,0 +1,1 @@ | |
1260 | | +c3a |
|
1260 | | +c3a | |
1261 | | diff --git a/f4a b/f4e |
|
1261 | | diff --git a/f4a b/f4e | |
1262 | | rename from f4a |
|
1262 | | rename from f4a | |
1263 | | rename to f4e |
|
1263 | | rename to f4e | |
1264 | | diff --git a/f5a b/f5b |
|
1264 | | diff --git a/f5a b/f5b | |
1265 | | rename from f5a |
|
1265 | | rename from f5a | |
1266 | | rename to f5b |
|
1266 | | rename to f5b | |
1267 | | |
|
1267 | | | |
1268 | | o changeset: 10:93ee502e8b0a |
|
1268 | | o changeset: 10:93ee502e8b0a | |
1269 | | | user: test |
|
1269 | | | user: test | |
1270 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1270 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1271 | | | files: f3d f4e |
|
1271 | | | files: f3d f4e | |
1272 | | | description: |
|
1272 | | | description: | |
1273 | | | D2 |
|
1273 | | | D2 | |
1274 | | | |
|
1274 | | | | |
1275 | | | |
|
1275 | | | | |
1276 | | | diff --git a/f3d b/f3d |
|
1276 | | | diff --git a/f3d b/f3d | |
1277 | | | new file mode 100644 |
|
1277 | | | new file mode 100644 | |
1278 | | | --- /dev/null |
|
1278 | | | --- /dev/null | |
1279 | | | +++ b/f3d |
|
1279 | | | +++ b/f3d | |
1280 | | | @@ -0,0 +1,1 @@ |
|
1280 | | | @@ -0,0 +1,1 @@ | |
1281 | | | +c3a |
|
1281 | | | +c3a | |
1282 | | | diff --git a/f4e b/f4e |
|
1282 | | | diff --git a/f4e b/f4e | |
1283 | | | --- a/f4e |
|
1283 | | | --- a/f4e | |
1284 | | | +++ b/f4e |
|
1284 | | | +++ b/f4e | |
1285 | | | @@ -1,1 +1,1 @@ |
|
1285 | | | @@ -1,1 +1,1 @@ | |
1286 | | | -c4a |
|
1286 | | | -c4a | |
1287 | | | +c4d |
|
1287 | | | +c4d | |
1288 | | | |
|
1288 | | | | |
1289 | | o changeset: 9:539cf145f496 |
|
1289 | | o changeset: 9:539cf145f496 | |
1290 | | | parent: 6:6bd1736cab86 |
|
1290 | | | parent: 6:6bd1736cab86 | |
1291 | | | user: test |
|
1291 | | | user: test | |
1292 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1292 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1293 | | | files: f1e f2a f2c f5a f5b |
|
1293 | | | files: f1e f2a f2c f5a f5b | |
1294 | | | copies: f2c (f2a) f5a (f5b) |
|
1294 | | | copies: f2c (f2a) f5a (f5b) | |
1295 | | | description: |
|
1295 | | | description: | |
1296 | | | C2 |
|
1296 | | | C2 | |
1297 | | | |
|
1297 | | | | |
1298 | | | |
|
1298 | | | | |
1299 | | | diff --git a/f1e b/f1e |
|
1299 | | | diff --git a/f1e b/f1e | |
1300 | | | --- a/f1e |
|
1300 | | | --- a/f1e | |
1301 | | | +++ b/f1e |
|
1301 | | | +++ b/f1e | |
1302 | | | @@ -1,1 +1,1 @@ |
|
1302 | | | @@ -1,1 +1,1 @@ | |
1303 | | | -c1a |
|
1303 | | | -c1a | |
1304 | | | +c1c |
|
1304 | | | +c1c | |
1305 | | | diff --git a/f2a b/f2c |
|
1305 | | | diff --git a/f2a b/f2c | |
1306 | | | rename from f2a |
|
1306 | | | rename from f2a | |
1307 | | | rename to f2c |
|
1307 | | | rename to f2c | |
1308 | | | diff --git a/f5b b/f5a |
|
1308 | | | diff --git a/f5b b/f5a | |
1309 | | | rename from f5b |
|
1309 | | | rename from f5b | |
1310 | | | rename to f5a |
|
1310 | | | rename to f5a | |
1311 | | | --- a/f5b |
|
1311 | | | --- a/f5b | |
1312 | | | +++ b/f5a |
|
1312 | | | +++ b/f5a | |
1313 | | | @@ -1,1 +1,1 @@ |
|
1313 | | | @@ -1,1 +1,1 @@ | |
1314 | | | -c5a |
|
1314 | | | -c5a | |
1315 | | | +c5c |
|
1315 | | | +c5c | |
1316 | | | |
|
1316 | | | | |
1317 | | | o changeset: 8:ba67f08fb15a |
|
1317 | | | o changeset: 8:ba67f08fb15a | |
1318 | | | | parent: 0:11f7a1b56675 |
|
1318 | | | | parent: 0:11f7a1b56675 | |
1319 | | | | user: test |
|
1319 | | | | user: test | |
1320 | | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1320 | | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1321 | | | | files: f1g |
|
1321 | | | | files: f1g | |
1322 | | | | copies: f1g (f1a) |
|
1322 | | | | copies: f1g (f1a) | |
1323 | | | | description: |
|
1323 | | | | description: | |
1324 | | | | G0 |
|
1324 | | | | G0 | |
1325 | | | | |
|
1325 | | | | | |
1326 | | | | |
|
1326 | | | | | |
1327 | | | | diff --git a/f1a b/f1g |
|
1327 | | | | diff --git a/f1a b/f1g | |
1328 | | | | copy from f1a |
|
1328 | | | | copy from f1a | |
1329 | | | | copy to f1g |
|
1329 | | | | copy to f1g | |
1330 | | | | --- a/f1a |
|
1330 | | | | --- a/f1a | |
1331 | | | | +++ b/f1g |
|
1331 | | | | +++ b/f1g | |
1332 | | | | @@ -1,1 +1,1 @@ |
|
1332 | | | | @@ -1,1 +1,1 @@ | |
1333 | | | | -c1a |
|
1333 | | | | -c1a | |
1334 | | | | +c1g |
|
1334 | | | | +c1g | |
1335 | | | | |
|
1335 | | | | | |
1336 | | | | o changeset: 7:d376ab0d7fda |
|
1336 | | | | o changeset: 7:d376ab0d7fda | |
1337 | | | |/ parent: 0:11f7a1b56675 |
|
1337 | | | |/ parent: 0:11f7a1b56675 | |
1338 | | | | user: test |
|
1338 | | | | user: test | |
1339 | | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1339 | | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1340 | | | | files: f1f |
|
1340 | | | | files: f1f | |
1341 | | | | copies: f1f (f1a) |
|
1341 | | | | copies: f1f (f1a) | |
1342 | | | | description: |
|
1342 | | | | description: | |
1343 | | | | F0 |
|
1343 | | | | F0 | |
1344 | | | | |
|
1344 | | | | | |
1345 | | | | |
|
1345 | | | | | |
1346 | | | | diff --git a/f1a b/f1f |
|
1346 | | | | diff --git a/f1a b/f1f | |
1347 | | | | copy from f1a |
|
1347 | | | | copy from f1a | |
1348 | | | | copy to f1f |
|
1348 | | | | copy to f1f | |
1349 | | | | |
|
1349 | | | | | |
1350 | | o | changeset: 6:6bd1736cab86 |
|
1350 | | o | changeset: 6:6bd1736cab86 | |
1351 | | |/ parent: 0:11f7a1b56675 |
|
1351 | | |/ parent: 0:11f7a1b56675 | |
1352 | | | user: test |
|
1352 | | | user: test | |
1353 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1353 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1354 | | | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b |
|
1354 | | | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b | |
1355 | | | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a) |
|
1355 | | | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a) | |
1356 | | | description: |
|
1356 | | | description: | |
1357 | | | E0 |
|
1357 | | | E0 | |
1358 | | | |
|
1358 | | | | |
1359 | | | |
|
1359 | | | | |
1360 | | | diff --git a/f1a b/f1e |
|
1360 | | | diff --git a/f1a b/f1e | |
1361 | | | rename from f1a |
|
1361 | | | rename from f1a | |
1362 | | | rename to f1e |
|
1362 | | | rename to f1e | |
1363 | | | diff --git a/f2a b/f2a |
|
1363 | | | diff --git a/f2a b/f2a | |
1364 | | | --- a/f2a |
|
1364 | | | --- a/f2a | |
1365 | | | +++ b/f2a |
|
1365 | | | +++ b/f2a | |
1366 | | | @@ -1,1 +1,1 @@ |
|
1366 | | | @@ -1,1 +1,1 @@ | |
1367 | | | -c2a |
|
1367 | | | -c2a | |
1368 | | | +c2e |
|
1368 | | | +c2e | |
1369 | | | diff --git a/f3a b/f3e |
|
1369 | | | diff --git a/f3a b/f3e | |
1370 | | | rename from f3a |
|
1370 | | | rename from f3a | |
1371 | | | rename to f3e |
|
1371 | | | rename to f3e | |
1372 | | | diff --git a/f4a b/f4e |
|
1372 | | | diff --git a/f4a b/f4e | |
1373 | | | rename from f4a |
|
1373 | | | rename from f4a | |
1374 | | | rename to f4e |
|
1374 | | | rename to f4e | |
1375 | | | diff --git a/f5a b/f5b |
|
1375 | | | diff --git a/f5a b/f5b | |
1376 | | | rename from f5a |
|
1376 | | | rename from f5a | |
1377 | | | rename to f5b |
|
1377 | | | rename to f5b | |
1378 | | | |
|
1378 | | | | |
1379 | | | o changeset: 5:560daee679da |
|
1379 | | | o changeset: 5:560daee679da | |
1380 | | | | user: test |
|
1380 | | | | user: test | |
1381 | | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1381 | | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1382 | | | | files: f3d f4a |
|
1382 | | | | files: f3d f4a | |
1383 | | | | description: |
|
1383 | | | | description: | |
1384 | | | | D1 |
|
1384 | | | | D1 | |
1385 | | | | |
|
1385 | | | | | |
1386 | | | | |
|
1386 | | | | | |
1387 | | | | diff --git a/f3d b/f3d |
|
1387 | | | | diff --git a/f3d b/f3d | |
1388 | | | | new file mode 100644 |
|
1388 | | | | new file mode 100644 | |
1389 | | | | --- /dev/null |
|
1389 | | | | --- /dev/null | |
1390 | | | | +++ b/f3d |
|
1390 | | | | +++ b/f3d | |
1391 | | | | @@ -0,0 +1,1 @@ |
|
1391 | | | | @@ -0,0 +1,1 @@ | |
1392 | | | | +c3a |
|
1392 | | | | +c3a | |
1393 | | | | diff --git a/f4a b/f4a |
|
1393 | | | | diff --git a/f4a b/f4a | |
1394 | | | | --- a/f4a |
|
1394 | | | | --- a/f4a | |
1395 | | | | +++ b/f4a |
|
1395 | | | | +++ b/f4a | |
1396 | | | | @@ -1,1 +1,1 @@ |
|
1396 | | | | @@ -1,1 +1,1 @@ | |
1397 | | | | -c4a |
|
1397 | | | | -c4a | |
1398 | | | | +c4d |
|
1398 | | | | +c4d | |
1399 | | | | |
|
1399 | | | | | |
1400 | | | o changeset: 4:c9763722f9bd |
|
1400 | | | o changeset: 4:c9763722f9bd | |
1401 | | |/ parent: 0:11f7a1b56675 |
|
1401 | | |/ parent: 0:11f7a1b56675 | |
1402 | | | user: test |
|
1402 | | | user: test | |
1403 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1403 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1404 | | | files: f1a f2a f2c f5a |
|
1404 | | | files: f1a f2a f2c f5a | |
1405 | | | copies: f2c (f2a) |
|
1405 | | | copies: f2c (f2a) | |
1406 | | | description: |
|
1406 | | | description: | |
1407 | | | C1 |
|
1407 | | | C1 | |
1408 | | | |
|
1408 | | | | |
1409 | | | |
|
1409 | | | | |
1410 | | | diff --git a/f1a b/f1a |
|
1410 | | | diff --git a/f1a b/f1a | |
1411 | | | --- a/f1a |
|
1411 | | | --- a/f1a | |
1412 | | | +++ b/f1a |
|
1412 | | | +++ b/f1a | |
1413 | | | @@ -1,1 +1,1 @@ |
|
1413 | | | @@ -1,1 +1,1 @@ | |
1414 | | | -c1a |
|
1414 | | | -c1a | |
1415 | | | +c1c |
|
1415 | | | +c1c | |
1416 | | | diff --git a/f2a b/f2c |
|
1416 | | | diff --git a/f2a b/f2c | |
1417 | | | rename from f2a |
|
1417 | | | rename from f2a | |
1418 | | | rename to f2c |
|
1418 | | | rename to f2c | |
1419 | | | diff --git a/f5a b/f5a |
|
1419 | | | diff --git a/f5a b/f5a | |
1420 | | | --- a/f5a |
|
1420 | | | --- a/f5a | |
1421 | | | +++ b/f5a |
|
1421 | | | +++ b/f5a | |
1422 | | | @@ -1,1 +1,1 @@ |
|
1422 | | | @@ -1,1 +1,1 @@ | |
1423 | | | -c5a |
|
1423 | | | -c5a | |
1424 | | | +c5c |
|
1424 | | | +c5c | |
1425 | | | |
|
1425 | | | | |
1426 | +---o changeset: 3:b69f5839d2d9 |
|
1426 | +---o changeset: 3:b69f5839d2d9 | |
1427 | | | user: test |
|
1427 | | | user: test | |
1428 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1428 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1429 | | | files: f3b f3d f4a |
|
1429 | | | files: f3b f3d f4a | |
1430 | | | copies: f3d (f3b) |
|
1430 | | | copies: f3d (f3b) | |
1431 | | | description: |
|
1431 | | | description: | |
1432 | | | D0 |
|
1432 | | | D0 | |
1433 | | | |
|
1433 | | | | |
1434 | | | |
|
1434 | | | | |
1435 | | | diff --git a/f3b b/f3d |
|
1435 | | | diff --git a/f3b b/f3d | |
1436 | | | rename from f3b |
|
1436 | | | rename from f3b | |
1437 | | | rename to f3d |
|
1437 | | | rename to f3d | |
1438 | | | diff --git a/f4a b/f4a |
|
1438 | | | diff --git a/f4a b/f4a | |
1439 | | | --- a/f4a |
|
1439 | | | --- a/f4a | |
1440 | | | +++ b/f4a |
|
1440 | | | +++ b/f4a | |
1441 | | | @@ -1,1 +1,1 @@ |
|
1441 | | | @@ -1,1 +1,1 @@ | |
1442 | | | -c4a |
|
1442 | | | -c4a | |
1443 | | | +c4d |
|
1443 | | | +c4d | |
1444 | | | |
|
1444 | | | | |
1445 | o | changeset: 2:f58c7e2b28fa |
|
1445 | o | changeset: 2:f58c7e2b28fa | |
1446 | | | user: test |
|
1446 | | | user: test | |
1447 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1447 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1448 | | | files: f1b f2a f2c f5a f5b |
|
1448 | | | files: f1b f2a f2c f5a f5b | |
1449 | | | copies: f2c (f2a) f5a (f5b) |
|
1449 | | | copies: f2c (f2a) f5a (f5b) | |
1450 | | | description: |
|
1450 | | | description: | |
1451 | | | C0 |
|
1451 | | | C0 | |
1452 | | | |
|
1452 | | | | |
1453 | | | |
|
1453 | | | | |
1454 | | | diff --git a/f1b b/f1b |
|
1454 | | | diff --git a/f1b b/f1b | |
1455 | | | --- a/f1b |
|
1455 | | | --- a/f1b | |
1456 | | | +++ b/f1b |
|
1456 | | | +++ b/f1b | |
1457 | | | @@ -1,1 +1,1 @@ |
|
1457 | | | @@ -1,1 +1,1 @@ | |
1458 | | | -c1a |
|
1458 | | | -c1a | |
1459 | | | +c1c |
|
1459 | | | +c1c | |
1460 | | | diff --git a/f2a b/f2c |
|
1460 | | | diff --git a/f2a b/f2c | |
1461 | | | rename from f2a |
|
1461 | | | rename from f2a | |
1462 | | | rename to f2c |
|
1462 | | | rename to f2c | |
1463 | | | diff --git a/f5b b/f5a |
|
1463 | | | diff --git a/f5b b/f5a | |
1464 | | | rename from f5b |
|
1464 | | | rename from f5b | |
1465 | | | rename to f5a |
|
1465 | | | rename to f5a | |
1466 | | | --- a/f5b |
|
1466 | | | --- a/f5b | |
1467 | | | +++ b/f5a |
|
1467 | | | +++ b/f5a | |
1468 | | | @@ -1,1 +1,1 @@ |
|
1468 | | | @@ -1,1 +1,1 @@ | |
1469 | | | -c5a |
|
1469 | | | -c5a | |
1470 | | | +c5c |
|
1470 | | | +c5c | |
1471 | | | |
|
1471 | | | | |
1472 | o | changeset: 1:3d7bba921b5d |
|
1472 | o | changeset: 1:3d7bba921b5d | |
1473 | |/ user: test |
|
1473 | |/ user: test | |
1474 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1474 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1475 | | files: f1a f1b f3a f3b f5a f5b |
|
1475 | | files: f1a f1b f3a f3b f5a f5b | |
1476 | | copies: f1b (f1a) f3b (f3a) f5b (f5a) |
|
1476 | | copies: f1b (f1a) f3b (f3a) f5b (f5a) | |
1477 | | description: |
|
1477 | | description: | |
1478 | | B0 |
|
1478 | | B0 | |
1479 | | |
|
1479 | | | |
1480 | | |
|
1480 | | | |
1481 | | diff --git a/f1a b/f1b |
|
1481 | | diff --git a/f1a b/f1b | |
1482 | | rename from f1a |
|
1482 | | rename from f1a | |
1483 | | rename to f1b |
|
1483 | | rename to f1b | |
1484 | | diff --git a/f3a b/f3b |
|
1484 | | diff --git a/f3a b/f3b | |
1485 | | rename from f3a |
|
1485 | | rename from f3a | |
1486 | | rename to f3b |
|
1486 | | rename to f3b | |
1487 | | diff --git a/f5a b/f5b |
|
1487 | | diff --git a/f5a b/f5b | |
1488 | | rename from f5a |
|
1488 | | rename from f5a | |
1489 | | rename to f5b |
|
1489 | | rename to f5b | |
1490 | | |
|
1490 | | | |
1491 | o changeset: 0:11f7a1b56675 |
|
1491 | o changeset: 0:11f7a1b56675 | |
1492 | user: test |
|
1492 | user: test | |
1493 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1493 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1494 | files: f1a f2a f3a f4a f5a |
|
1494 | files: f1a f2a f3a f4a f5a | |
1495 | description: |
|
1495 | description: | |
1496 | A0 |
|
1496 | A0 | |
1497 |
|
1497 | |||
1498 |
|
1498 | |||
1499 | diff --git a/f1a b/f1a |
|
1499 | diff --git a/f1a b/f1a | |
1500 | new file mode 100644 |
|
1500 | new file mode 100644 | |
1501 | --- /dev/null |
|
1501 | --- /dev/null | |
1502 | +++ b/f1a |
|
1502 | +++ b/f1a | |
1503 | @@ -0,0 +1,1 @@ |
|
1503 | @@ -0,0 +1,1 @@ | |
1504 | +c1a |
|
1504 | +c1a | |
1505 | diff --git a/f2a b/f2a |
|
1505 | diff --git a/f2a b/f2a | |
1506 | new file mode 100644 |
|
1506 | new file mode 100644 | |
1507 | --- /dev/null |
|
1507 | --- /dev/null | |
1508 | +++ b/f2a |
|
1508 | +++ b/f2a | |
1509 | @@ -0,0 +1,1 @@ |
|
1509 | @@ -0,0 +1,1 @@ | |
1510 | +c2a |
|
1510 | +c2a | |
1511 | diff --git a/f3a b/f3a |
|
1511 | diff --git a/f3a b/f3a | |
1512 | new file mode 100644 |
|
1512 | new file mode 100644 | |
1513 | --- /dev/null |
|
1513 | --- /dev/null | |
1514 | +++ b/f3a |
|
1514 | +++ b/f3a | |
1515 | @@ -0,0 +1,1 @@ |
|
1515 | @@ -0,0 +1,1 @@ | |
1516 | +c3a |
|
1516 | +c3a | |
1517 | diff --git a/f4a b/f4a |
|
1517 | diff --git a/f4a b/f4a | |
1518 | new file mode 100644 |
|
1518 | new file mode 100644 | |
1519 | --- /dev/null |
|
1519 | --- /dev/null | |
1520 | +++ b/f4a |
|
1520 | +++ b/f4a | |
1521 | @@ -0,0 +1,1 @@ |
|
1521 | @@ -0,0 +1,1 @@ | |
1522 | +c4a |
|
1522 | +c4a | |
1523 | diff --git a/f5a b/f5a |
|
1523 | diff --git a/f5a b/f5a | |
1524 | new file mode 100644 |
|
1524 | new file mode 100644 | |
1525 | --- /dev/null |
|
1525 | --- /dev/null | |
1526 | +++ b/f5a |
|
1526 | +++ b/f5a | |
1527 | @@ -0,0 +1,1 @@ |
|
1527 | @@ -0,0 +1,1 @@ | |
1528 | +c5a |
|
1528 | +c5a | |
1529 |
|
1529 | |||
1530 | Check superfluous filemerge of files renamed in the past but untouched by graft |
|
1530 | Check superfluous filemerge of files renamed in the past but untouched by graft | |
1531 |
|
1531 | |||
1532 | $ echo a > a |
|
1532 | $ echo a > a | |
1533 | $ hg ci -qAma |
|
1533 | $ hg ci -qAma | |
1534 | $ hg mv a b |
|
1534 | $ hg mv a b | |
1535 | $ echo b > b |
|
1535 | $ echo b > b | |
1536 | $ hg ci -qAmb |
|
1536 | $ hg ci -qAmb | |
1537 | $ echo c > c |
|
1537 | $ echo c > c | |
1538 | $ hg ci -qAmc |
|
1538 | $ hg ci -qAmc | |
1539 | $ hg up -q .~2 |
|
1539 | $ hg up -q .~2 | |
1540 | $ hg graft tip -qt:fail |
|
1540 | $ hg graft tip -qt:fail | |
1541 |
|
1541 | |||
1542 | $ cd .. |
|
1542 | $ cd .. | |
1543 |
|
1543 | |||
1544 | Graft a change into a new file previously grafted into a renamed directory |
|
1544 | Graft a change into a new file previously grafted into a renamed directory | |
1545 |
|
1545 | |||
1546 | $ hg init dirmovenewfile |
|
1546 | $ hg init dirmovenewfile | |
1547 | $ cd dirmovenewfile |
|
1547 | $ cd dirmovenewfile | |
1548 | $ mkdir a |
|
1548 | $ mkdir a | |
1549 | $ echo a > a/a |
|
1549 | $ echo a > a/a | |
1550 | $ hg ci -qAma |
|
1550 | $ hg ci -qAma | |
1551 | $ echo x > a/x |
|
1551 | $ echo x > a/x | |
1552 | $ hg ci -qAmx |
|
1552 | $ hg ci -qAmx | |
1553 | $ hg up -q 0 |
|
1553 | $ hg up -q 0 | |
1554 | $ hg mv -q a b |
|
1554 | $ hg mv -q a b | |
1555 | $ hg ci -qAmb |
|
1555 | $ hg ci -qAmb | |
1556 | $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded |
|
1556 | $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded | |
1557 | $ hg up -q 1 |
|
1557 | $ hg up -q 1 | |
1558 | $ echo y > a/x |
|
1558 | $ echo y > a/x | |
1559 | $ hg ci -qAmy |
|
1559 | $ hg ci -qAmy | |
1560 | $ hg up -q 3 |
|
1560 | $ hg up -q 3 | |
1561 | $ hg graft -q 4 |
|
1561 | $ hg graft -q 4 | |
1562 | $ hg status --change . |
|
1562 | $ hg status --change . | |
1563 | M b/x |
|
1563 | M b/x | |
1564 |
|
1564 | |||
1565 | Prepare for test of skipped changesets and how merges can influence it: |
|
1565 | Prepare for test of skipped changesets and how merges can influence it: | |
1566 |
|
1566 | |||
1567 | $ hg merge -q -r 1 --tool :local |
|
1567 | $ hg merge -q -r 1 --tool :local | |
1568 | $ hg ci -m m |
|
1568 | $ hg ci -m m | |
1569 | $ echo xx >> b/x |
|
1569 | $ echo xx >> b/x | |
1570 | $ hg ci -m xx |
|
1570 | $ hg ci -m xx | |
1571 |
|
1571 | |||
1572 | $ hg log -G -T '{rev} {desc|firstline}' |
|
1572 | $ hg log -G -T '{rev} {desc|firstline}' | |
1573 | @ 7 xx |
|
1573 | @ 7 xx | |
1574 | | |
|
1574 | | | |
1575 | o 6 m |
|
1575 | o 6 m | |
1576 | |\ |
|
1576 | |\ | |
1577 | | o 5 y |
|
1577 | | o 5 y | |
1578 | | | |
|
1578 | | | | |
1579 | +---o 4 y |
|
1579 | +---o 4 y | |
1580 | | | |
|
1580 | | | | |
1581 | | o 3 x |
|
1581 | | o 3 x | |
1582 | | | |
|
1582 | | | | |
1583 | | o 2 b |
|
1583 | | o 2 b | |
1584 | | | |
|
1584 | | | | |
1585 | o | 1 x |
|
1585 | o | 1 x | |
1586 | |/ |
|
1586 | |/ | |
1587 | o 0 a |
|
1587 | o 0 a | |
1588 |
|
1588 | |||
1589 | Grafting of plain changes correctly detects that 3 and 5 should be skipped: |
|
1589 | Grafting of plain changes correctly detects that 3 and 5 should be skipped: | |
1590 |
|
1590 | |||
1591 | $ hg up -qCr 4 |
|
1591 | $ hg up -qCr 4 | |
1592 | $ hg graft --tool :local -r 2::5 |
|
1592 | $ hg graft --tool :local -r 2::5 | |
1593 | skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a) |
|
1593 | skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a) | |
1594 | skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1) |
|
1594 | skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1) | |
1595 | grafting 2:42127f193bcd "b" |
|
1595 | grafting 2:42127f193bcd "b" | |
1596 |
|
1596 | |||
1597 | Extending the graft range to include a (skipped) merge of 3 will not prevent us from |
|
1597 | Extending the graft range to include a (skipped) merge of 3 will not prevent us from | |
1598 | also detecting that both 3 and 5 should be skipped: |
|
1598 | also detecting that both 3 and 5 should be skipped: | |
1599 |
|
1599 | |||
1600 | $ hg up -qCr 4 |
|
1600 | $ hg up -qCr 4 | |
1601 | $ hg graft --tool :local -r 2::7 |
|
1601 | $ hg graft --tool :local -r 2::7 | |
1602 | skipping ungraftable merge revision 6 |
|
1602 | skipping ungraftable merge revision 6 | |
1603 | skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a) |
|
1603 | skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a) | |
1604 | skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1) |
|
1604 | skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1) | |
1605 | grafting 2:42127f193bcd "b" |
|
1605 | grafting 2:42127f193bcd "b" | |
1606 | grafting 7:d3c3f2b38ecc "xx" |
|
1606 | grafting 7:d3c3f2b38ecc "xx" | |
1607 | note: graft of 7:d3c3f2b38ecc created no changes to commit |
|
1607 | note: graft of 7:d3c3f2b38ecc created no changes to commit | |
1608 |
|
1608 | |||
1609 | $ cd .. |
|
1609 | $ cd .. | |
1610 |
|
1610 | |||
1611 | Grafted revision should be warned and skipped only once. (issue6024) |
|
1611 | Grafted revision should be warned and skipped only once. (issue6024) | |
1612 |
|
1612 | |||
1613 | $ mkdir issue6024 |
|
1613 | $ mkdir issue6024 | |
1614 | $ cd issue6024 |
|
1614 | $ cd issue6024 | |
1615 |
|
1615 | |||
1616 | $ hg init base |
|
1616 | $ hg init base | |
1617 | $ cd base |
|
1617 | $ cd base | |
1618 | $ touch x |
|
1618 | $ touch x | |
1619 | $ hg commit -qAminit |
|
1619 | $ hg commit -qAminit | |
1620 | $ echo a > x |
|
1620 | $ echo a > x | |
1621 | $ hg commit -mchange |
|
1621 | $ hg commit -mchange | |
1622 | $ hg update -q 0 |
|
1622 | $ hg update -q 0 | |
1623 | $ hg graft -r 1 |
|
1623 | $ hg graft -r 1 | |
1624 | grafting 1:a0b923c546aa "change" (tip) |
|
1624 | grafting 1:a0b923c546aa "change" (tip) | |
1625 | $ cd .. |
|
1625 | $ cd .. | |
1626 |
|
1626 | |||
1627 | $ hg clone -qr 2 base clone |
|
1627 | $ hg clone -qr 2 base clone | |
1628 | $ cd clone |
|
1628 | $ cd clone | |
1629 | $ hg pull -q |
|
1629 | $ hg pull -q | |
1630 | $ hg merge -q 2 |
|
1630 | $ hg merge -q 2 | |
1631 | $ hg commit -mmerge |
|
1631 | $ hg commit -mmerge | |
1632 | $ hg update -q 0 |
|
1632 | $ hg update -q 0 | |
1633 | $ hg graft -r 1 |
|
1633 | $ hg graft -r 1 | |
1634 | grafting 1:04fc6d444368 "change" |
|
1634 | grafting 1:04fc6d444368 "change" | |
1635 | $ hg update -q 3 |
|
1635 | $ hg update -q 3 | |
1636 | $ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n' |
|
1636 | $ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n' | |
1637 | o 4:4e16 <- a0b9 |
|
1637 | o 4:4e16 <- a0b9 | |
1638 | | |
|
1638 | | | |
1639 | | @ 3:f0ac <- |
|
1639 | | @ 3:f0ac <- | |
1640 | | |\ |
|
1640 | | |\ | |
1641 | +---o 2:a0b9 <- |
|
1641 | +---o 2:a0b9 <- | |
1642 | | | |
|
1642 | | | | |
1643 | | o 1:04fc <- a0b9 |
|
1643 | | o 1:04fc <- a0b9 | |
1644 | |/ |
|
1644 | |/ | |
1645 | o 0:7848 <- |
|
1645 | o 0:7848 <- | |
1646 |
|
1646 | |||
1647 |
|
1647 | |||
1648 | the source of rev 4 is an ancestor of the working parent, and was also |
|
1648 | the source of rev 4 is an ancestor of the working parent, and was also | |
1649 | grafted as rev 1. it should be stripped from the target revisions only once. |
|
1649 | grafted as rev 1. it should be stripped from the target revisions only once. | |
1650 |
|
1650 | |||
1651 | $ hg graft -r 4 |
|
1651 | $ hg graft -r 4 | |
1652 | skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa) |
|
1652 | skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa) | |
1653 | [255] |
|
1653 | [255] | |
1654 |
|
1654 | |||
1655 | $ cd ../.. |
|
1655 | $ cd ../.. | |
1656 |
|
1656 | |||
1657 | Testing the reading of old format graftstate file with newer mercurial |
|
1657 | Testing the reading of old format graftstate file with newer mercurial | |
1658 |
|
1658 | |||
1659 | $ hg init oldgraft |
|
1659 | $ hg init oldgraft | |
1660 | $ cd oldgraft |
|
1660 | $ cd oldgraft | |
1661 | $ for ch in a b c; do echo foo > $ch; hg add $ch; hg ci -Aqm "added "$ch; done; |
|
1661 | $ for ch in a b c; do echo foo > $ch; hg add $ch; hg ci -Aqm "added "$ch; done; | |
1662 | $ hg log -GT "{rev}:{node|short} {desc}\n" |
|
1662 | $ hg log -GT "{rev}:{node|short} {desc}\n" | |
1663 | @ 2:8be98ac1a569 added c |
|
1663 | @ 2:8be98ac1a569 added c | |
1664 | | |
|
1664 | | | |
1665 | o 1:80e6d2c47cfe added b |
|
1665 | o 1:80e6d2c47cfe added b | |
1666 | | |
|
1666 | | | |
1667 | o 0:f7ad41964313 added a |
|
1667 | o 0:f7ad41964313 added a | |
1668 |
|
1668 | |||
1669 | $ hg up 0 |
|
1669 | $ hg up 0 | |
1670 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1670 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
1671 | $ echo bar > b |
|
1671 | $ echo bar > b | |
1672 | $ hg add b |
|
1672 | $ hg add b | |
1673 | $ hg ci -m "bar to b" |
|
1673 | $ hg ci -m "bar to b" | |
1674 | created new head |
|
1674 | created new head | |
1675 | $ hg graft -r 1 -r 2 |
|
1675 | $ hg graft -r 1 -r 2 | |
1676 | grafting 1:80e6d2c47cfe "added b" |
|
1676 | grafting 1:80e6d2c47cfe "added b" | |
1677 | merging b |
|
1677 | merging b | |
1678 | warning: conflicts while merging b! (edit, then use 'hg resolve --mark') |
|
1678 | warning: conflicts while merging b! (edit, then use 'hg resolve --mark') | |
1679 | abort: unresolved conflicts, can't continue |
|
1679 | abort: unresolved conflicts, can't continue | |
1680 | (use 'hg resolve' and 'hg graft --continue') |
|
1680 | (use 'hg resolve' and 'hg graft --continue') | |
1681 | [255] |
|
1681 | [255] | |
1682 |
|
1682 | |||
1683 | Writing the nodes in old format to graftstate |
|
1683 | Writing the nodes in old format to graftstate | |
1684 |
|
1684 | |||
1685 | $ hg log -r 1 -r 2 -T '{node}\n' > .hg/graftstate |
|
1685 | $ hg log -r 1 -r 2 -T '{node}\n' > .hg/graftstate | |
1686 | $ echo foo > b |
|
1686 | $ echo foo > b | |
1687 | $ hg resolve -m |
|
1687 | $ hg resolve -m | |
1688 | (no more unresolved files) |
|
1688 | (no more unresolved files) | |
1689 | continue: hg graft --continue |
|
1689 | continue: hg graft --continue | |
1690 | $ hg graft --continue |
|
1690 | $ hg graft --continue | |
1691 | grafting 1:80e6d2c47cfe "added b" |
|
1691 | grafting 1:80e6d2c47cfe "added b" | |
1692 | grafting 2:8be98ac1a569 "added c" |
|
1692 | grafting 2:8be98ac1a569 "added c" | |
1693 |
|
1693 | |||
1694 | Testing that --user is preserved during conflicts and value is reused while |
|
1694 | Testing that --user is preserved during conflicts and value is reused while | |
1695 | running `hg graft --continue` |
|
1695 | running `hg graft --continue` | |
1696 |
|
1696 | |||
1697 | $ hg log -G |
|
1697 | $ hg log -G | |
1698 | @ changeset: 5:711e9fa999f1 |
|
1698 | @ changeset: 5:711e9fa999f1 | |
1699 | | tag: tip |
|
1699 | | tag: tip | |
1700 | | user: test |
|
1700 | | user: test | |
1701 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1701 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1702 | | summary: added c |
|
1702 | | summary: added c | |
1703 | | |
|
1703 | | | |
1704 | o changeset: 4:e5ad7353b408 |
|
1704 | o changeset: 4:e5ad7353b408 | |
1705 | | user: test |
|
1705 | | user: test | |
1706 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1706 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1707 | | summary: added b |
|
1707 | | summary: added b | |
1708 | | |
|
1708 | | | |
1709 | o changeset: 3:9e887f7a939c |
|
1709 | o changeset: 3:9e887f7a939c | |
1710 | | parent: 0:f7ad41964313 |
|
1710 | | parent: 0:f7ad41964313 | |
1711 | | user: test |
|
1711 | | user: test | |
1712 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1712 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1713 | | summary: bar to b |
|
1713 | | summary: bar to b | |
1714 | | |
|
1714 | | | |
1715 | | o changeset: 2:8be98ac1a569 |
|
1715 | | o changeset: 2:8be98ac1a569 | |
1716 | | | user: test |
|
1716 | | | user: test | |
1717 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1717 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1718 | | | summary: added c |
|
1718 | | | summary: added c | |
1719 | | | |
|
1719 | | | | |
1720 | | o changeset: 1:80e6d2c47cfe |
|
1720 | | o changeset: 1:80e6d2c47cfe | |
1721 | |/ user: test |
|
1721 | |/ user: test | |
1722 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1722 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1723 | | summary: added b |
|
1723 | | summary: added b | |
1724 | | |
|
1724 | | | |
1725 | o changeset: 0:f7ad41964313 |
|
1725 | o changeset: 0:f7ad41964313 | |
1726 | user: test |
|
1726 | user: test | |
1727 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1727 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1728 | summary: added a |
|
1728 | summary: added a | |
1729 |
|
1729 | |||
1730 |
|
1730 | |||
1731 | $ hg up '.^^' |
|
1731 | $ hg up '.^^' | |
1732 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1732 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1733 |
|
1733 | |||
1734 | $ hg graft -r 1 -r 2 --user batman |
|
1734 | $ hg graft -r 1 -r 2 --user batman | |
1735 | grafting 1:80e6d2c47cfe "added b" |
|
1735 | grafting 1:80e6d2c47cfe "added b" | |
1736 | merging b |
|
1736 | merging b | |
1737 | warning: conflicts while merging b! (edit, then use 'hg resolve --mark') |
|
1737 | warning: conflicts while merging b! (edit, then use 'hg resolve --mark') | |
1738 | abort: unresolved conflicts, can't continue |
|
1738 | abort: unresolved conflicts, can't continue | |
1739 | (use 'hg resolve' and 'hg graft --continue') |
|
1739 | (use 'hg resolve' and 'hg graft --continue') | |
1740 | [255] |
|
1740 | [255] | |
1741 |
|
1741 | |||
1742 | $ echo wat > b |
|
1742 | $ echo wat > b | |
1743 | $ hg resolve -m |
|
1743 | $ hg resolve -m | |
1744 | (no more unresolved files) |
|
1744 | (no more unresolved files) | |
1745 | continue: hg graft --continue |
|
1745 | continue: hg graft --continue | |
1746 |
|
1746 | |||
1747 | $ hg graft --continue |
|
1747 | $ hg graft --continue | |
1748 | grafting 1:80e6d2c47cfe "added b" |
|
1748 | grafting 1:80e6d2c47cfe "added b" | |
1749 | grafting 2:8be98ac1a569 "added c" |
|
1749 | grafting 2:8be98ac1a569 "added c" | |
1750 |
|
1750 | |||
1751 | $ hg log -Gr 3:: |
|
1751 | $ hg log -Gr 3:: | |
1752 | @ changeset: 7:11a36ffaacf2 |
|
1752 | @ changeset: 7:11a36ffaacf2 | |
1753 | | tag: tip |
|
1753 | | tag: tip | |
1754 | | user: batman |
|
1754 | | user: batman | |
1755 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1755 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1756 | | summary: added c |
|
1756 | | summary: added c | |
1757 | | |
|
1757 | | | |
1758 | o changeset: 6:76803afc6511 |
|
1758 | o changeset: 6:76803afc6511 | |
1759 | | parent: 3:9e887f7a939c |
|
1759 | | parent: 3:9e887f7a939c | |
1760 | | user: batman |
|
1760 | | user: batman | |
1761 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1761 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1762 | | summary: added b |
|
1762 | | summary: added b | |
1763 | | |
|
1763 | | | |
1764 | | o changeset: 5:711e9fa999f1 |
|
1764 | | o changeset: 5:711e9fa999f1 | |
1765 | | | user: test |
|
1765 | | | user: test | |
1766 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1766 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1767 | | | summary: added c |
|
1767 | | | summary: added c | |
1768 | | | |
|
1768 | | | | |
1769 | | o changeset: 4:e5ad7353b408 |
|
1769 | | o changeset: 4:e5ad7353b408 | |
1770 | |/ user: test |
|
1770 | |/ user: test | |
1771 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1771 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1772 | | summary: added b |
|
1772 | | summary: added b | |
1773 | | |
|
1773 | | | |
1774 | o changeset: 3:9e887f7a939c |
|
1774 | o changeset: 3:9e887f7a939c | |
1775 | | parent: 0:f7ad41964313 |
|
1775 | | parent: 0:f7ad41964313 | |
1776 | ~ user: test |
|
1776 | ~ user: test | |
1777 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1777 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1778 | summary: bar to b |
|
1778 | summary: bar to b | |
1779 |
|
1779 | |||
1780 | Test that --date is preserved and reused in `hg graft --continue` |
|
1780 | Test that --date is preserved and reused in `hg graft --continue` | |
1781 |
|
1781 | |||
1782 | $ hg up '.^^' |
|
1782 | $ hg up '.^^' | |
1783 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1783 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1784 | $ hg graft -r 1 -r 2 --date '1234560000 120' |
|
1784 | $ hg graft -r 1 -r 2 --date '1234560000 120' | |
1785 | grafting 1:80e6d2c47cfe "added b" |
|
1785 | grafting 1:80e6d2c47cfe "added b" | |
1786 | merging b |
|
1786 | merging b | |
1787 | warning: conflicts while merging b! (edit, then use 'hg resolve --mark') |
|
1787 | warning: conflicts while merging b! (edit, then use 'hg resolve --mark') | |
1788 | abort: unresolved conflicts, can't continue |
|
1788 | abort: unresolved conflicts, can't continue | |
1789 | (use 'hg resolve' and 'hg graft --continue') |
|
1789 | (use 'hg resolve' and 'hg graft --continue') | |
1790 | [255] |
|
1790 | [255] | |
1791 |
|
1791 | |||
1792 | $ echo foobar > b |
|
1792 | $ echo foobar > b | |
1793 | $ hg resolve -m |
|
1793 | $ hg resolve -m | |
1794 | (no more unresolved files) |
|
1794 | (no more unresolved files) | |
1795 | continue: hg graft --continue |
|
1795 | continue: hg graft --continue | |
1796 | $ hg graft --continue |
|
1796 | $ hg graft --continue | |
1797 | grafting 1:80e6d2c47cfe "added b" |
|
1797 | grafting 1:80e6d2c47cfe "added b" | |
1798 | grafting 2:8be98ac1a569 "added c" |
|
1798 | grafting 2:8be98ac1a569 "added c" | |
1799 |
|
1799 | |||
1800 | $ hg log -Gr '.^^::.' |
|
1800 | $ hg log -Gr '.^^::.' | |
1801 | @ changeset: 9:1896b76e007a |
|
1801 | @ changeset: 9:1896b76e007a | |
1802 | | tag: tip |
|
1802 | | tag: tip | |
1803 | | user: test |
|
1803 | | user: test | |
1804 | | date: Fri Feb 13 21:18:00 2009 -0002 |
|
1804 | | date: Fri Feb 13 21:18:00 2009 -0002 | |
1805 | | summary: added c |
|
1805 | | summary: added c | |
1806 | | |
|
1806 | | | |
1807 | o changeset: 8:ce2b4f1632af |
|
1807 | o changeset: 8:ce2b4f1632af | |
1808 | | parent: 3:9e887f7a939c |
|
1808 | | parent: 3:9e887f7a939c | |
1809 | | user: test |
|
1809 | | user: test | |
1810 | | date: Fri Feb 13 21:18:00 2009 -0002 |
|
1810 | | date: Fri Feb 13 21:18:00 2009 -0002 | |
1811 | | summary: added b |
|
1811 | | summary: added b | |
1812 | | |
|
1812 | | | |
1813 | o changeset: 3:9e887f7a939c |
|
1813 | o changeset: 3:9e887f7a939c | |
1814 | | parent: 0:f7ad41964313 |
|
1814 | | parent: 0:f7ad41964313 | |
1815 | ~ user: test |
|
1815 | ~ user: test | |
1816 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1816 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1817 | summary: bar to b |
|
1817 | summary: bar to b | |
1818 |
|
1818 | |||
1819 | Test that --log is preserved and reused in `hg graft --continue` |
|
1819 | Test that --log is preserved and reused in `hg graft --continue` | |
1820 |
|
1820 | |||
1821 | $ hg up '.^^' |
|
1821 | $ hg up '.^^' | |
1822 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1822 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1823 | $ hg graft -r 1 -r 2 --log |
|
1823 | $ hg graft -r 1 -r 2 --log | |
1824 | grafting 1:80e6d2c47cfe "added b" |
|
1824 | grafting 1:80e6d2c47cfe "added b" | |
1825 | merging b |
|
1825 | merging b | |
1826 | warning: conflicts while merging b! (edit, then use 'hg resolve --mark') |
|
1826 | warning: conflicts while merging b! (edit, then use 'hg resolve --mark') | |
1827 | abort: unresolved conflicts, can't continue |
|
1827 | abort: unresolved conflicts, can't continue | |
1828 | (use 'hg resolve' and 'hg graft --continue') |
|
1828 | (use 'hg resolve' and 'hg graft --continue') | |
1829 | [255] |
|
1829 | [255] | |
1830 |
|
1830 | |||
1831 | $ echo foobar > b |
|
1831 | $ echo foobar > b | |
1832 | $ hg resolve -m |
|
1832 | $ hg resolve -m | |
1833 | (no more unresolved files) |
|
1833 | (no more unresolved files) | |
1834 | continue: hg graft --continue |
|
1834 | continue: hg graft --continue | |
1835 |
|
1835 | |||
1836 | $ hg graft --continue |
|
1836 | $ hg graft --continue | |
1837 | grafting 1:80e6d2c47cfe "added b" |
|
1837 | grafting 1:80e6d2c47cfe "added b" | |
1838 | grafting 2:8be98ac1a569 "added c" |
|
1838 | grafting 2:8be98ac1a569 "added c" | |
1839 |
|
1839 | |||
1840 | $ hg log -GT "{rev}:{node|short} {desc}" -r '.^^::.' |
|
1840 | $ hg log -GT "{rev}:{node|short} {desc}" -r '.^^::.' | |
1841 | @ 11:30c1050a58b2 added c |
|
1841 | @ 11:30c1050a58b2 added c | |
1842 | | (grafted from 8be98ac1a56990c2d9ca6861041b8390af7bd6f3) |
|
1842 | | (grafted from 8be98ac1a56990c2d9ca6861041b8390af7bd6f3) | |
1843 | o 10:ec7eda2313e2 added b |
|
1843 | o 10:ec7eda2313e2 added b | |
1844 | | (grafted from 80e6d2c47cfe5b3185519568327a17a061c7efb6) |
|
1844 | | (grafted from 80e6d2c47cfe5b3185519568327a17a061c7efb6) | |
1845 | o 3:9e887f7a939c bar to b |
|
1845 | o 3:9e887f7a939c bar to b | |
1846 | | |
|
1846 | | | |
1847 | ~ |
|
1847 | ~ | |
1848 |
|
1848 | |||
1849 | $ cd .. |
|
1849 | $ cd .. | |
1850 |
|
1850 | |||
1851 | Testing the --stop flag of `hg graft` which stops the interrupted graft |
|
1851 | Testing the --stop flag of `hg graft` which stops the interrupted graft | |
1852 |
|
1852 | |||
1853 | $ hg init stopgraft |
|
1853 | $ hg init stopgraft | |
1854 | $ cd stopgraft |
|
1854 | $ cd stopgraft | |
1855 | $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done; |
|
1855 | $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done; | |
1856 |
|
1856 | |||
1857 | $ hg log -G |
|
1857 | $ hg log -G | |
1858 | @ changeset: 3:9150fe93bec6 |
|
1858 | @ changeset: 3:9150fe93bec6 | |
1859 | | tag: tip |
|
1859 | | tag: tip | |
1860 | | user: test |
|
1860 | | user: test | |
1861 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1861 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1862 | | summary: added d |
|
1862 | | summary: added d | |
1863 | | |
|
1863 | | | |
1864 | o changeset: 2:155349b645be |
|
1864 | o changeset: 2:155349b645be | |
1865 | | user: test |
|
1865 | | user: test | |
1866 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1866 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1867 | | summary: added c |
|
1867 | | summary: added c | |
1868 | | |
|
1868 | | | |
1869 | o changeset: 1:5f6d8a4bf34a |
|
1869 | o changeset: 1:5f6d8a4bf34a | |
1870 | | user: test |
|
1870 | | user: test | |
1871 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1871 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1872 | | summary: added b |
|
1872 | | summary: added b | |
1873 | | |
|
1873 | | | |
1874 | o changeset: 0:9092f1db7931 |
|
1874 | o changeset: 0:9092f1db7931 | |
1875 | user: test |
|
1875 | user: test | |
1876 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1876 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1877 | summary: added a |
|
1877 | summary: added a | |
1878 |
|
1878 | |||
1879 | $ hg up '.^^' |
|
1879 | $ hg up '.^^' | |
1880 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1880 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
1881 |
|
1881 | |||
1882 | $ echo foo > d |
|
1882 | $ echo foo > d | |
1883 | $ hg ci -Aqm "added foo to d" |
|
1883 | $ hg ci -Aqm "added foo to d" | |
1884 |
|
1884 | |||
1885 | $ hg graft --stop |
|
1885 | $ hg graft --stop | |
1886 | abort: no interrupted graft found |
|
1886 | abort: no interrupted graft found | |
1887 | [255] |
|
1887 | [255] | |
1888 |
|
1888 | |||
1889 | $ hg graft -r 3 |
|
1889 | $ hg graft -r 3 | |
1890 | grafting 3:9150fe93bec6 "added d" |
|
1890 | grafting 3:9150fe93bec6 "added d" | |
1891 | merging d |
|
1891 | merging d | |
1892 | warning: conflicts while merging d! (edit, then use 'hg resolve --mark') |
|
1892 | warning: conflicts while merging d! (edit, then use 'hg resolve --mark') | |
1893 | abort: unresolved conflicts, can't continue |
|
1893 | abort: unresolved conflicts, can't continue | |
1894 | (use 'hg resolve' and 'hg graft --continue') |
|
1894 | (use 'hg resolve' and 'hg graft --continue') | |
1895 | [255] |
|
1895 | [255] | |
1896 |
|
1896 | |||
1897 | $ hg graft --stop --continue |
|
1897 | $ hg graft --stop --continue | |
1898 | abort: cannot use '--continue' and '--stop' together |
|
1898 | abort: cannot use '--continue' and '--stop' together | |
1899 | [255] |
|
1899 | [255] | |
1900 |
|
1900 | |||
1901 | $ hg graft --stop -U |
|
1901 | $ hg graft --stop -U | |
1902 | abort: cannot specify any other flag with '--stop' |
|
1902 | abort: cannot specify any other flag with '--stop' | |
1903 | [255] |
|
1903 | [255] | |
1904 | $ hg graft --stop --rev 4 |
|
1904 | $ hg graft --stop --rev 4 | |
1905 | abort: cannot specify any other flag with '--stop' |
|
1905 | abort: cannot specify any other flag with '--stop' | |
1906 | [255] |
|
1906 | [255] | |
1907 | $ hg graft --stop --log |
|
1907 | $ hg graft --stop --log | |
1908 | abort: cannot specify any other flag with '--stop' |
|
1908 | abort: cannot specify any other flag with '--stop' | |
1909 | [255] |
|
1909 | [255] | |
1910 |
|
1910 | |||
1911 | $ hg graft --stop |
|
1911 | $ hg graft --stop | |
1912 | stopped the interrupted graft |
|
1912 | stopped the interrupted graft | |
1913 | working directory is now at a0deacecd59d |
|
1913 | working directory is now at a0deacecd59d | |
1914 |
|
1914 | |||
1915 | $ hg diff |
|
1915 | $ hg diff | |
1916 |
|
1916 | |||
1917 | $ hg log -Gr '.' |
|
1917 | $ hg log -Gr '.' | |
1918 | @ changeset: 4:a0deacecd59d |
|
1918 | @ changeset: 4:a0deacecd59d | |
1919 | | tag: tip |
|
1919 | | tag: tip | |
1920 | ~ parent: 1:5f6d8a4bf34a |
|
1920 | ~ parent: 1:5f6d8a4bf34a | |
1921 | user: test |
|
1921 | user: test | |
1922 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1922 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1923 | summary: added foo to d |
|
1923 | summary: added foo to d | |
1924 |
|
1924 | |||
1925 | $ hg graft -r 2 -r 3 |
|
1925 | $ hg graft -r 2 -r 3 | |
1926 | grafting 2:155349b645be "added c" |
|
1926 | grafting 2:155349b645be "added c" | |
1927 | grafting 3:9150fe93bec6 "added d" |
|
1927 | grafting 3:9150fe93bec6 "added d" | |
1928 | merging d |
|
1928 | merging d | |
1929 | warning: conflicts while merging d! (edit, then use 'hg resolve --mark') |
|
1929 | warning: conflicts while merging d! (edit, then use 'hg resolve --mark') | |
1930 | abort: unresolved conflicts, can't continue |
|
1930 | abort: unresolved conflicts, can't continue | |
1931 | (use 'hg resolve' and 'hg graft --continue') |
|
1931 | (use 'hg resolve' and 'hg graft --continue') | |
1932 | [255] |
|
1932 | [255] | |
1933 |
|
1933 | |||
1934 | $ hg graft --stop |
|
1934 | $ hg graft --stop | |
1935 | stopped the interrupted graft |
|
1935 | stopped the interrupted graft | |
1936 | working directory is now at 75b447541a9e |
|
1936 | working directory is now at 75b447541a9e | |
1937 |
|
1937 | |||
1938 | $ hg diff |
|
1938 | $ hg diff | |
1939 |
|
1939 | |||
1940 | $ hg log -G -T "{rev}:{node|short} {desc}" |
|
1940 | $ hg log -G -T "{rev}:{node|short} {desc}" | |
1941 | @ 5:75b447541a9e added c |
|
1941 | @ 5:75b447541a9e added c | |
1942 | | |
|
1942 | | | |
1943 | o 4:a0deacecd59d added foo to d |
|
1943 | o 4:a0deacecd59d added foo to d | |
1944 | | |
|
1944 | | | |
1945 | | o 3:9150fe93bec6 added d |
|
1945 | | o 3:9150fe93bec6 added d | |
1946 | | | |
|
1946 | | | | |
1947 | | o 2:155349b645be added c |
|
1947 | | o 2:155349b645be added c | |
1948 | |/ |
|
1948 | |/ | |
1949 | o 1:5f6d8a4bf34a added b |
|
1949 | o 1:5f6d8a4bf34a added b | |
1950 | | |
|
1950 | | | |
1951 | o 0:9092f1db7931 added a |
|
1951 | o 0:9092f1db7931 added a | |
1952 |
|
1952 | |||
1953 | $ cd .. |
|
1953 | $ cd .. | |
1954 |
|
1954 | |||
1955 | Testing the --abort flag for `hg graft` which aborts and rollback to state |
|
1955 | Testing the --abort flag for `hg graft` which aborts and rollback to state | |
1956 | before the graft |
|
1956 | before the graft | |
1957 |
|
1957 | |||
1958 | $ hg init abortgraft |
|
1958 | $ hg init abortgraft | |
1959 | $ cd abortgraft |
|
1959 | $ cd abortgraft | |
1960 | $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done; |
|
1960 | $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done; | |
1961 |
|
1961 | |||
1962 | $ hg up '.^^' |
|
1962 | $ hg up '.^^' | |
1963 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1963 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
1964 |
|
1964 | |||
1965 | $ echo x > x |
|
1965 | $ echo x > x | |
1966 | $ hg ci -Aqm "added x" |
|
1966 | $ hg ci -Aqm "added x" | |
1967 | $ hg up '.^' |
|
1967 | $ hg up '.^' | |
1968 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1968 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1969 | $ echo foo > c |
|
1969 | $ echo foo > c | |
1970 | $ hg ci -Aqm "added foo to c" |
|
1970 | $ hg ci -Aqm "added foo to c" | |
1971 |
|
1971 | |||
1972 | $ hg log -GT "{rev}:{node|short} {desc}" |
|
1972 | $ hg log -GT "{rev}:{node|short} {desc}" | |
1973 | @ 5:36b793615f78 added foo to c |
|
1973 | @ 5:36b793615f78 added foo to c | |
1974 | | |
|
1974 | | | |
1975 | | o 4:863a25e1a9ea added x |
|
1975 | | o 4:863a25e1a9ea added x | |
1976 | |/ |
|
1976 | |/ | |
1977 | | o 3:9150fe93bec6 added d |
|
1977 | | o 3:9150fe93bec6 added d | |
1978 | | | |
|
1978 | | | | |
1979 | | o 2:155349b645be added c |
|
1979 | | o 2:155349b645be added c | |
1980 | |/ |
|
1980 | |/ | |
1981 | o 1:5f6d8a4bf34a added b |
|
1981 | o 1:5f6d8a4bf34a added b | |
1982 | | |
|
1982 | | | |
1983 | o 0:9092f1db7931 added a |
|
1983 | o 0:9092f1db7931 added a | |
1984 |
|
1984 | |||
1985 | $ hg up 9150fe93bec6 |
|
1985 | $ hg up 9150fe93bec6 | |
1986 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1986 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1987 |
|
1987 | |||
1988 | $ hg graft --abort |
|
1988 | $ hg graft --abort | |
1989 | abort: no interrupted graft to abort |
|
1989 | abort: no interrupted graft to abort | |
1990 | [255] |
|
1990 | [255] | |
1991 |
|
1991 | |||
1992 | when stripping is required |
|
1992 | when stripping is required | |
1993 | $ hg graft -r 4 -r 5 |
|
1993 | $ hg graft -r 4 -r 5 | |
1994 | grafting 4:863a25e1a9ea "added x" |
|
1994 | grafting 4:863a25e1a9ea "added x" | |
1995 | grafting 5:36b793615f78 "added foo to c" (tip) |
|
1995 | grafting 5:36b793615f78 "added foo to c" (tip) | |
1996 | merging c |
|
1996 | merging c | |
1997 | warning: conflicts while merging c! (edit, then use 'hg resolve --mark') |
|
1997 | warning: conflicts while merging c! (edit, then use 'hg resolve --mark') | |
1998 | abort: unresolved conflicts, can't continue |
|
1998 | abort: unresolved conflicts, can't continue | |
1999 | (use 'hg resolve' and 'hg graft --continue') |
|
1999 | (use 'hg resolve' and 'hg graft --continue') | |
2000 | [255] |
|
2000 | [255] | |
2001 |
|
2001 | |||
2002 | $ hg graft --continue --abort |
|
2002 | $ hg graft --continue --abort | |
2003 | abort: cannot use '--continue' and '--abort' together |
|
2003 | abort: cannot use '--continue' and '--abort' together | |
2004 | [255] |
|
2004 | [255] | |
2005 |
|
2005 | |||
2006 | $ hg graft --abort --stop |
|
2006 | $ hg graft --abort --stop | |
2007 | abort: cannot use '--abort' and '--stop' together |
|
2007 | abort: cannot use '--abort' and '--stop' together | |
2008 | [255] |
|
2008 | [255] | |
2009 |
|
2009 | |||
2010 | $ hg graft --abort --currentuser |
|
2010 | $ hg graft --abort --currentuser | |
2011 | abort: cannot specify any other flag with '--abort' |
|
2011 | abort: cannot specify any other flag with '--abort' | |
2012 | [255] |
|
2012 | [255] | |
2013 |
|
2013 | |||
2014 | $ hg graft --abort --edit |
|
2014 | $ hg graft --abort --edit | |
2015 | abort: cannot specify any other flag with '--abort' |
|
2015 | abort: cannot specify any other flag with '--abort' | |
2016 | [255] |
|
2016 | [255] | |
2017 |
|
2017 | |||
2018 | $ hg graft --abort |
|
2018 | $ hg graft --abort | |
2019 | graft aborted |
|
2019 | graft aborted | |
2020 | working directory is now at 9150fe93bec6 |
|
2020 | working directory is now at 9150fe93bec6 | |
2021 | $ hg log -GT "{rev}:{node|short} {desc}" |
|
2021 | $ hg log -GT "{rev}:{node|short} {desc}" | |
2022 | o 5:36b793615f78 added foo to c |
|
2022 | o 5:36b793615f78 added foo to c | |
2023 | | |
|
2023 | | | |
2024 | | o 4:863a25e1a9ea added x |
|
2024 | | o 4:863a25e1a9ea added x | |
2025 | |/ |
|
2025 | |/ | |
2026 | | @ 3:9150fe93bec6 added d |
|
2026 | | @ 3:9150fe93bec6 added d | |
2027 | | | |
|
2027 | | | | |
2028 | | o 2:155349b645be added c |
|
2028 | | o 2:155349b645be added c | |
2029 | |/ |
|
2029 | |/ | |
2030 | o 1:5f6d8a4bf34a added b |
|
2030 | o 1:5f6d8a4bf34a added b | |
2031 | | |
|
2031 | | | |
2032 | o 0:9092f1db7931 added a |
|
2032 | o 0:9092f1db7931 added a | |
2033 |
|
2033 | |||
2034 | when stripping is not required |
|
2034 | when stripping is not required | |
2035 | $ hg graft -r 5 |
|
2035 | $ hg graft -r 5 | |
2036 | grafting 5:36b793615f78 "added foo to c" (tip) |
|
2036 | grafting 5:36b793615f78 "added foo to c" (tip) | |
2037 | merging c |
|
2037 | merging c | |
2038 | warning: conflicts while merging c! (edit, then use 'hg resolve --mark') |
|
2038 | warning: conflicts while merging c! (edit, then use 'hg resolve --mark') | |
2039 | abort: unresolved conflicts, can't continue |
|
2039 | abort: unresolved conflicts, can't continue | |
2040 | (use 'hg resolve' and 'hg graft --continue') |
|
2040 | (use 'hg resolve' and 'hg graft --continue') | |
2041 | [255] |
|
2041 | [255] | |
2042 |
|
2042 | |||
2043 | $ hg graft --abort |
|
2043 | $ hg graft --abort | |
2044 | graft aborted |
|
2044 | graft aborted | |
2045 | working directory is now at 9150fe93bec6 |
|
2045 | working directory is now at 9150fe93bec6 | |
2046 | $ hg log -GT "{rev}:{node|short} {desc}" |
|
2046 | $ hg log -GT "{rev}:{node|short} {desc}" | |
2047 | o 5:36b793615f78 added foo to c |
|
2047 | o 5:36b793615f78 added foo to c | |
2048 | | |
|
2048 | | | |
2049 | | o 4:863a25e1a9ea added x |
|
2049 | | o 4:863a25e1a9ea added x | |
2050 | |/ |
|
2050 | |/ | |
2051 | | @ 3:9150fe93bec6 added d |
|
2051 | | @ 3:9150fe93bec6 added d | |
2052 | | | |
|
2052 | | | | |
2053 | | o 2:155349b645be added c |
|
2053 | | o 2:155349b645be added c | |
2054 | |/ |
|
2054 | |/ | |
2055 | o 1:5f6d8a4bf34a added b |
|
2055 | o 1:5f6d8a4bf34a added b | |
2056 | | |
|
2056 | | | |
2057 | o 0:9092f1db7931 added a |
|
2057 | o 0:9092f1db7931 added a | |
2058 |
|
2058 | |||
2059 | when some of the changesets became public |
|
2059 | when some of the changesets became public | |
2060 |
|
2060 | |||
2061 | $ hg graft -r 4 -r 5 |
|
2061 | $ hg graft -r 4 -r 5 | |
2062 | grafting 4:863a25e1a9ea "added x" |
|
2062 | grafting 4:863a25e1a9ea "added x" | |
2063 | grafting 5:36b793615f78 "added foo to c" (tip) |
|
2063 | grafting 5:36b793615f78 "added foo to c" (tip) | |
2064 | merging c |
|
2064 | merging c | |
2065 | warning: conflicts while merging c! (edit, then use 'hg resolve --mark') |
|
2065 | warning: conflicts while merging c! (edit, then use 'hg resolve --mark') | |
2066 | abort: unresolved conflicts, can't continue |
|
2066 | abort: unresolved conflicts, can't continue | |
2067 | (use 'hg resolve' and 'hg graft --continue') |
|
2067 | (use 'hg resolve' and 'hg graft --continue') | |
2068 | [255] |
|
2068 | [255] | |
2069 |
|
2069 | |||
2070 | $ hg log -GT "{rev}:{node|short} {desc}" |
|
2070 | $ hg log -GT "{rev}:{node|short} {desc}" | |
2071 | @ 6:6ec71c037d94 added x |
|
2071 | @ 6:6ec71c037d94 added x | |
2072 | | |
|
2072 | | | |
2073 | | o 5:36b793615f78 added foo to c |
|
2073 | | o 5:36b793615f78 added foo to c | |
2074 | | | |
|
2074 | | | | |
2075 | | | o 4:863a25e1a9ea added x |
|
2075 | | | o 4:863a25e1a9ea added x | |
2076 | | |/ |
|
2076 | | |/ | |
2077 | o | 3:9150fe93bec6 added d |
|
2077 | o | 3:9150fe93bec6 added d | |
2078 | | | |
|
2078 | | | | |
2079 | o | 2:155349b645be added c |
|
2079 | o | 2:155349b645be added c | |
2080 | |/ |
|
2080 | |/ | |
2081 | o 1:5f6d8a4bf34a added b |
|
2081 | o 1:5f6d8a4bf34a added b | |
2082 | | |
|
2082 | | | |
2083 | o 0:9092f1db7931 added a |
|
2083 | o 0:9092f1db7931 added a | |
2084 |
|
2084 | |||
2085 | $ hg phase -r 6 --public |
|
2085 | $ hg phase -r 6 --public | |
2086 |
|
2086 | |||
2087 | $ hg graft --abort |
|
2087 | $ hg graft --abort | |
2088 | cannot clean up public changesets 6ec71c037d94 |
|
2088 | cannot clean up public changesets 6ec71c037d94 | |
2089 | graft aborted |
|
2089 | graft aborted | |
2090 | working directory is now at 6ec71c037d94 |
|
2090 | working directory is now at 6ec71c037d94 | |
2091 |
|
2091 | |||
2092 | when we created new changesets on top of existing one |
|
2092 | when we created new changesets on top of existing one | |
2093 |
|
2093 | |||
2094 | $ hg up '.^^' |
|
2094 | $ hg up '.^^' | |
2095 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
2095 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
2096 | $ echo y > y |
|
2096 | $ echo y > y | |
2097 | $ hg ci -Aqm "added y" |
|
2097 | $ hg ci -Aqm "added y" | |
2098 | $ echo z > z |
|
2098 | $ echo z > z | |
2099 | $ hg ci -Aqm "added z" |
|
2099 | $ hg ci -Aqm "added z" | |
2100 |
|
2100 | |||
2101 | $ hg up 3 |
|
2101 | $ hg up 3 | |
2102 | 1 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
2102 | 1 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
2103 | $ hg log -GT "{rev}:{node|short} {desc}" |
|
2103 | $ hg log -GT "{rev}:{node|short} {desc}" | |
2104 | o 8:637f9e9bbfd4 added z |
|
2104 | o 8:637f9e9bbfd4 added z | |
2105 | | |
|
2105 | | | |
2106 | o 7:123221671fd4 added y |
|
2106 | o 7:123221671fd4 added y | |
2107 | | |
|
2107 | | | |
2108 | | o 6:6ec71c037d94 added x |
|
2108 | | o 6:6ec71c037d94 added x | |
2109 | | | |
|
2109 | | | | |
2110 | | | o 5:36b793615f78 added foo to c |
|
2110 | | | o 5:36b793615f78 added foo to c | |
2111 | | | | |
|
2111 | | | | | |
2112 | | | | o 4:863a25e1a9ea added x |
|
2112 | | | | o 4:863a25e1a9ea added x | |
2113 | | | |/ |
|
2113 | | | |/ | |
2114 | | @ | 3:9150fe93bec6 added d |
|
2114 | | @ | 3:9150fe93bec6 added d | |
2115 | |/ / |
|
2115 | |/ / | |
2116 | o / 2:155349b645be added c |
|
2116 | o / 2:155349b645be added c | |
2117 | |/ |
|
2117 | |/ | |
2118 | o 1:5f6d8a4bf34a added b |
|
2118 | o 1:5f6d8a4bf34a added b | |
2119 | | |
|
2119 | | | |
2120 | o 0:9092f1db7931 added a |
|
2120 | o 0:9092f1db7931 added a | |
2121 |
|
2121 | |||
2122 | $ hg graft -r 8 -r 7 -r 5 |
|
2122 | $ hg graft -r 8 -r 7 -r 5 | |
2123 | grafting 8:637f9e9bbfd4 "added z" (tip) |
|
2123 | grafting 8:637f9e9bbfd4 "added z" (tip) | |
2124 | grafting 7:123221671fd4 "added y" |
|
2124 | grafting 7:123221671fd4 "added y" | |
2125 | grafting 5:36b793615f78 "added foo to c" |
|
2125 | grafting 5:36b793615f78 "added foo to c" | |
2126 | merging c |
|
2126 | merging c | |
2127 | warning: conflicts while merging c! (edit, then use 'hg resolve --mark') |
|
2127 | warning: conflicts while merging c! (edit, then use 'hg resolve --mark') | |
2128 | abort: unresolved conflicts, can't continue |
|
2128 | abort: unresolved conflicts, can't continue | |
2129 | (use 'hg resolve' and 'hg graft --continue') |
|
2129 | (use 'hg resolve' and 'hg graft --continue') | |
2130 | [255] |
|
2130 | [255] | |
2131 |
|
2131 | |||
2132 | $ cd .. |
|
2132 | $ cd .. | |
2133 | $ hg init pullrepo |
|
2133 | $ hg init pullrepo | |
2134 | $ cd pullrepo |
|
2134 | $ cd pullrepo | |
2135 | $ cat >> .hg/hgrc <<EOF |
|
2135 | $ cat >> .hg/hgrc <<EOF | |
2136 | > [phases] |
|
2136 | > [phases] | |
2137 | > publish=False |
|
2137 | > publish=False | |
2138 | > EOF |
|
2138 | > EOF | |
2139 | $ hg pull ../abortgraft --config phases.publish=False |
|
2139 | $ hg pull ../abortgraft --config phases.publish=False | |
2140 | pulling from ../abortgraft |
|
2140 | pulling from ../abortgraft | |
2141 | requesting all changes |
|
2141 | requesting all changes | |
2142 | adding changesets |
|
2142 | adding changesets | |
2143 | adding manifests |
|
2143 | adding manifests | |
2144 | adding file changes |
|
2144 | adding file changes | |
2145 | added 11 changesets with 9 changes to 8 files (+4 heads) |
|
2145 | added 11 changesets with 9 changes to 8 files (+4 heads) | |
2146 | new changesets 9092f1db7931:6b98ff0062dd (6 drafts) |
|
2146 | new changesets 9092f1db7931:6b98ff0062dd (6 drafts) | |
2147 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
2147 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
2148 | $ hg up 9 |
|
2148 | $ hg up 9 | |
2149 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
2149 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
2150 | $ echo w > w |
|
2150 | $ echo w > w | |
2151 | $ hg ci -Aqm "added w" --config phases.publish=False |
|
2151 | $ hg ci -Aqm "added w" --config phases.publish=False | |
2152 |
|
2152 | |||
2153 | $ cd ../abortgraft |
|
2153 | $ cd ../abortgraft | |
2154 | $ hg pull ../pullrepo |
|
2154 | $ hg pull ../pullrepo | |
2155 | pulling from ../pullrepo |
|
2155 | pulling from ../pullrepo | |
2156 | searching for changes |
|
2156 | searching for changes | |
2157 | adding changesets |
|
2157 | adding changesets | |
2158 | adding manifests |
|
2158 | adding manifests | |
2159 | adding file changes |
|
2159 | adding file changes | |
2160 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
2160 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
2161 | new changesets 311dfc6cf3bf (1 drafts) |
|
2161 | new changesets 311dfc6cf3bf (1 drafts) | |
2162 | (run 'hg heads .' to see heads, 'hg merge' to merge) |
|
2162 | (run 'hg heads .' to see heads, 'hg merge' to merge) | |
2163 |
|
2163 | |||
2164 | $ hg graft --abort |
|
2164 | $ hg graft --abort | |
2165 | new changesets detected on destination branch, can't strip |
|
2165 | new changesets detected on destination branch, can't strip | |
2166 | graft aborted |
|
2166 | graft aborted | |
2167 | working directory is now at 6b98ff0062dd |
|
2167 | working directory is now at 6b98ff0062dd | |
2168 |
|
2168 | |||
2169 | $ cd .. |
|
2169 | $ cd .. | |
2170 |
|
2170 | |||
2171 | ============================ |
|
2171 | ============================ | |
2172 | Testing --no-commit option:| |
|
2172 | Testing --no-commit option:| | |
2173 | ============================ |
|
2173 | ============================ | |
2174 |
|
2174 | |||
2175 | $ hg init nocommit |
|
2175 | $ hg init nocommit | |
2176 | $ cd nocommit |
|
2176 | $ cd nocommit | |
2177 | $ echo a > a |
|
2177 | $ echo a > a | |
2178 | $ hg ci -qAma |
|
2178 | $ hg ci -qAma | |
2179 | $ echo b > b |
|
2179 | $ echo b > b | |
2180 | $ hg ci -qAmb |
|
2180 | $ hg ci -qAmb | |
2181 | $ hg up -q 0 |
|
2181 | $ hg up -q 0 | |
2182 | $ echo c > c |
|
2182 | $ echo c > c | |
2183 | $ hg ci -qAmc |
|
2183 | $ hg ci -qAmc | |
2184 | $ hg log -GT "{rev}:{node|short} {desc}\n" |
|
2184 | $ hg log -GT "{rev}:{node|short} {desc}\n" | |
2185 | @ 2:d36c0562f908 c |
|
2185 | @ 2:d36c0562f908 c | |
2186 | | |
|
2186 | | | |
2187 | | o 1:d2ae7f538514 b |
|
2187 | | o 1:d2ae7f538514 b | |
2188 | |/ |
|
2188 | |/ | |
2189 | o 0:cb9a9f314b8b a |
|
2189 | o 0:cb9a9f314b8b a | |
2190 |
|
2190 | |||
2191 |
|
2191 | |||
2192 | Check reporting when --no-commit used with non-applicable options: |
|
2192 | Check reporting when --no-commit used with non-applicable options: | |
2193 |
|
2193 | |||
2194 | $ hg graft 1 --no-commit -e |
|
2194 | $ hg graft 1 --no-commit -e | |
2195 | abort: cannot specify --no-commit and --edit together |
|
2195 | abort: cannot specify --no-commit and --edit together | |
2196 | [255] |
|
2196 | [255] | |
2197 |
|
2197 | |||
2198 | $ hg graft 1 --no-commit --log |
|
2198 | $ hg graft 1 --no-commit --log | |
2199 | abort: cannot specify --no-commit and --log together |
|
2199 | abort: cannot specify --no-commit and --log together | |
2200 | [255] |
|
2200 | [255] | |
2201 |
|
2201 | |||
2202 | $ hg graft 1 --no-commit -D |
|
2202 | $ hg graft 1 --no-commit -D | |
2203 | abort: cannot specify --no-commit and --currentdate together |
|
2203 | abort: cannot specify --no-commit and --currentdate together | |
2204 | [255] |
|
2204 | [255] | |
2205 |
|
2205 | |||
2206 | Test --no-commit is working: |
|
2206 | Test --no-commit is working: | |
2207 | $ hg graft 1 --no-commit |
|
2207 | $ hg graft 1 --no-commit | |
2208 | grafting 1:d2ae7f538514 "b" |
|
2208 | grafting 1:d2ae7f538514 "b" | |
2209 |
|
2209 | |||
2210 | $ hg log -GT "{rev}:{node|short} {desc}\n" |
|
2210 | $ hg log -GT "{rev}:{node|short} {desc}\n" | |
2211 | @ 2:d36c0562f908 c |
|
2211 | @ 2:d36c0562f908 c | |
2212 | | |
|
2212 | | | |
2213 | | o 1:d2ae7f538514 b |
|
2213 | | o 1:d2ae7f538514 b | |
2214 | |/ |
|
2214 | |/ | |
2215 | o 0:cb9a9f314b8b a |
|
2215 | o 0:cb9a9f314b8b a | |
2216 |
|
2216 | |||
2217 |
|
2217 | |||
2218 | $ hg diff |
|
2218 | $ hg diff | |
2219 | diff -r d36c0562f908 b |
|
2219 | diff -r d36c0562f908 b | |
2220 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2220 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2221 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
2221 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 | |
2222 | @@ -0,0 +1,1 @@ |
|
2222 | @@ -0,0 +1,1 @@ | |
2223 | +b |
|
2223 | +b | |
2224 |
|
2224 | |||
2225 | Prepare wrdir to check --no-commit is resepected after --continue: |
|
2225 | Prepare wrdir to check --no-commit is resepected after --continue: | |
2226 |
|
2226 | |||
2227 | $ hg up -qC |
|
2227 | $ hg up -qC | |
2228 | $ echo A>a |
|
2228 | $ echo A>a | |
2229 | $ hg ci -qm "A in file a" |
|
2229 | $ hg ci -qm "A in file a" | |
2230 | $ hg up -q 1 |
|
2230 | $ hg up -q 1 | |
2231 | $ echo B>a |
|
2231 | $ echo B>a | |
2232 | $ hg ci -qm "B in file a" |
|
2232 | $ hg ci -qm "B in file a" | |
2233 | $ hg log -GT "{rev}:{node|short} {desc}\n" |
|
2233 | $ hg log -GT "{rev}:{node|short} {desc}\n" | |
2234 | @ 4:2aa9ad1006ff B in file a |
|
2234 | @ 4:2aa9ad1006ff B in file a | |
2235 | | |
|
2235 | | | |
2236 | | o 3:09e253b87e17 A in file a |
|
2236 | | o 3:09e253b87e17 A in file a | |
2237 | | | |
|
2237 | | | | |
2238 | | o 2:d36c0562f908 c |
|
2238 | | o 2:d36c0562f908 c | |
2239 | | | |
|
2239 | | | | |
2240 | o | 1:d2ae7f538514 b |
|
2240 | o | 1:d2ae7f538514 b | |
2241 | |/ |
|
2241 | |/ | |
2242 | o 0:cb9a9f314b8b a |
|
2242 | o 0:cb9a9f314b8b a | |
2243 |
|
2243 | |||
2244 |
|
2244 | |||
2245 | $ hg graft 3 --no-commit |
|
2245 | $ hg graft 3 --no-commit | |
2246 | grafting 3:09e253b87e17 "A in file a" |
|
2246 | grafting 3:09e253b87e17 "A in file a" | |
2247 | merging a |
|
2247 | merging a | |
2248 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
2248 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
2249 | abort: unresolved conflicts, can't continue |
|
2249 | abort: unresolved conflicts, can't continue | |
2250 | (use 'hg resolve' and 'hg graft --continue') |
|
2250 | (use 'hg resolve' and 'hg graft --continue') | |
2251 | [255] |
|
2251 | [255] | |
2252 |
|
2252 | |||
2253 | Resolve conflict: |
|
2253 | Resolve conflict: | |
2254 | $ echo A>a |
|
2254 | $ echo A>a | |
2255 | $ hg resolve --mark |
|
2255 | $ hg resolve --mark | |
2256 | (no more unresolved files) |
|
2256 | (no more unresolved files) | |
2257 | continue: hg graft --continue |
|
2257 | continue: hg graft --continue | |
2258 |
|
2258 | |||
2259 | $ hg graft --continue |
|
2259 | $ hg graft --continue | |
2260 | grafting 3:09e253b87e17 "A in file a" |
|
2260 | grafting 3:09e253b87e17 "A in file a" | |
2261 | $ hg log -GT "{rev}:{node|short} {desc}\n" |
|
2261 | $ hg log -GT "{rev}:{node|short} {desc}\n" | |
2262 | @ 4:2aa9ad1006ff B in file a |
|
2262 | @ 4:2aa9ad1006ff B in file a | |
2263 | | |
|
2263 | | | |
2264 | | o 3:09e253b87e17 A in file a |
|
2264 | | o 3:09e253b87e17 A in file a | |
2265 | | | |
|
2265 | | | | |
2266 | | o 2:d36c0562f908 c |
|
2266 | | o 2:d36c0562f908 c | |
2267 | | | |
|
2267 | | | | |
2268 | o | 1:d2ae7f538514 b |
|
2268 | o | 1:d2ae7f538514 b | |
2269 | |/ |
|
2269 | |/ | |
2270 | o 0:cb9a9f314b8b a |
|
2270 | o 0:cb9a9f314b8b a | |
2271 |
|
2271 | |||
2272 | $ hg diff |
|
2272 | $ hg diff | |
2273 | diff -r 2aa9ad1006ff a |
|
2273 | diff -r 2aa9ad1006ff a | |
2274 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
2274 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
2275 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
2275 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
2276 | @@ -1,1 +1,1 @@ |
|
2276 | @@ -1,1 +1,1 @@ | |
2277 | -B |
|
2277 | -B | |
2278 | +A |
|
2278 | +A | |
2279 |
|
2279 | |||
2280 | $ hg up -qC |
|
2280 | $ hg up -qC | |
2281 |
|
2281 | |||
2282 | Check --no-commit is resepected when passed with --continue: |
|
2282 | Check --no-commit is resepected when passed with --continue: | |
2283 |
|
2283 | |||
2284 | $ hg graft 3 |
|
2284 | $ hg graft 3 | |
2285 | grafting 3:09e253b87e17 "A in file a" |
|
2285 | grafting 3:09e253b87e17 "A in file a" | |
2286 | merging a |
|
2286 | merging a | |
2287 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
2287 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
2288 | abort: unresolved conflicts, can't continue |
|
2288 | abort: unresolved conflicts, can't continue | |
2289 | (use 'hg resolve' and 'hg graft --continue') |
|
2289 | (use 'hg resolve' and 'hg graft --continue') | |
2290 | [255] |
|
2290 | [255] | |
2291 |
|
2291 | |||
2292 | Resolve conflict: |
|
2292 | Resolve conflict: | |
2293 | $ echo A>a |
|
2293 | $ echo A>a | |
2294 | $ hg resolve --mark |
|
2294 | $ hg resolve --mark | |
2295 | (no more unresolved files) |
|
2295 | (no more unresolved files) | |
2296 | continue: hg graft --continue |
|
2296 | continue: hg graft --continue | |
2297 |
|
2297 | |||
2298 | $ hg graft --continue --no-commit |
|
2298 | $ hg graft --continue --no-commit | |
2299 | grafting 3:09e253b87e17 "A in file a" |
|
2299 | grafting 3:09e253b87e17 "A in file a" | |
2300 | $ hg diff |
|
2300 | $ hg diff | |
2301 | diff -r 2aa9ad1006ff a |
|
2301 | diff -r 2aa9ad1006ff a | |
2302 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
2302 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
2303 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
2303 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
2304 | @@ -1,1 +1,1 @@ |
|
2304 | @@ -1,1 +1,1 @@ | |
2305 | -B |
|
2305 | -B | |
2306 | +A |
|
2306 | +A | |
2307 |
|
2307 | |||
2308 | $ hg log -GT "{rev}:{node|short} {desc}\n" |
|
2308 | $ hg log -GT "{rev}:{node|short} {desc}\n" | |
2309 | @ 4:2aa9ad1006ff B in file a |
|
2309 | @ 4:2aa9ad1006ff B in file a | |
2310 | | |
|
2310 | | | |
2311 | | o 3:09e253b87e17 A in file a |
|
2311 | | o 3:09e253b87e17 A in file a | |
2312 | | | |
|
2312 | | | | |
2313 | | o 2:d36c0562f908 c |
|
2313 | | o 2:d36c0562f908 c | |
2314 | | | |
|
2314 | | | | |
2315 | o | 1:d2ae7f538514 b |
|
2315 | o | 1:d2ae7f538514 b | |
2316 | |/ |
|
2316 | |/ | |
2317 | o 0:cb9a9f314b8b a |
|
2317 | o 0:cb9a9f314b8b a | |
2318 |
|
2318 | |||
2319 | $ hg up -qC |
|
2319 | $ hg up -qC | |
2320 |
|
2320 | |||
2321 | Test --no-commit when graft multiple revisions: |
|
2321 | Test --no-commit when graft multiple revisions: | |
2322 | When there is conflict: |
|
2322 | When there is conflict: | |
2323 | $ hg graft -r "2::3" --no-commit |
|
2323 | $ hg graft -r "2::3" --no-commit | |
2324 | grafting 2:d36c0562f908 "c" |
|
2324 | grafting 2:d36c0562f908 "c" | |
2325 | grafting 3:09e253b87e17 "A in file a" |
|
2325 | grafting 3:09e253b87e17 "A in file a" | |
2326 | merging a |
|
2326 | merging a | |
2327 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
2327 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
2328 | abort: unresolved conflicts, can't continue |
|
2328 | abort: unresolved conflicts, can't continue | |
2329 | (use 'hg resolve' and 'hg graft --continue') |
|
2329 | (use 'hg resolve' and 'hg graft --continue') | |
2330 | [255] |
|
2330 | [255] | |
2331 |
|
2331 | |||
2332 | $ echo A>a |
|
2332 | $ echo A>a | |
2333 | $ hg resolve --mark |
|
2333 | $ hg resolve --mark | |
2334 | (no more unresolved files) |
|
2334 | (no more unresolved files) | |
2335 | continue: hg graft --continue |
|
2335 | continue: hg graft --continue | |
2336 | $ hg graft --continue |
|
2336 | $ hg graft --continue | |
2337 | grafting 3:09e253b87e17 "A in file a" |
|
2337 | grafting 3:09e253b87e17 "A in file a" | |
2338 | $ hg diff |
|
2338 | $ hg diff | |
2339 | diff -r 2aa9ad1006ff a |
|
2339 | diff -r 2aa9ad1006ff a | |
2340 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
2340 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
2341 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
2341 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
2342 | @@ -1,1 +1,1 @@ |
|
2342 | @@ -1,1 +1,1 @@ | |
2343 | -B |
|
2343 | -B | |
2344 | +A |
|
2344 | +A | |
2345 | diff -r 2aa9ad1006ff c |
|
2345 | diff -r 2aa9ad1006ff c | |
2346 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2346 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2347 | +++ b/c Thu Jan 01 00:00:00 1970 +0000 |
|
2347 | +++ b/c Thu Jan 01 00:00:00 1970 +0000 | |
2348 | @@ -0,0 +1,1 @@ |
|
2348 | @@ -0,0 +1,1 @@ | |
2349 | +c |
|
2349 | +c | |
2350 |
|
2350 | |||
2351 | $ hg log -GT "{rev}:{node|short} {desc}\n" |
|
2351 | $ hg log -GT "{rev}:{node|short} {desc}\n" | |
2352 | @ 4:2aa9ad1006ff B in file a |
|
2352 | @ 4:2aa9ad1006ff B in file a | |
2353 | | |
|
2353 | | | |
2354 | | o 3:09e253b87e17 A in file a |
|
2354 | | o 3:09e253b87e17 A in file a | |
2355 | | | |
|
2355 | | | | |
2356 | | o 2:d36c0562f908 c |
|
2356 | | o 2:d36c0562f908 c | |
2357 | | | |
|
2357 | | | | |
2358 | o | 1:d2ae7f538514 b |
|
2358 | o | 1:d2ae7f538514 b | |
2359 | |/ |
|
2359 | |/ | |
2360 | o 0:cb9a9f314b8b a |
|
2360 | o 0:cb9a9f314b8b a | |
2361 |
|
2361 | |||
2362 | $ hg up -qC |
|
2362 | $ hg up -qC | |
2363 |
|
2363 | |||
2364 | When there is no conflict: |
|
2364 | When there is no conflict: | |
2365 | $ echo d>d |
|
2365 | $ echo d>d | |
2366 | $ hg add d -q |
|
2366 | $ hg add d -q | |
2367 | $ hg ci -qmd |
|
2367 | $ hg ci -qmd | |
2368 | $ hg up 3 -q |
|
2368 | $ hg up 3 -q | |
2369 | $ hg log -GT "{rev}:{node|short} {desc}\n" |
|
2369 | $ hg log -GT "{rev}:{node|short} {desc}\n" | |
2370 | o 5:baefa8927fc0 d |
|
2370 | o 5:baefa8927fc0 d | |
2371 | | |
|
2371 | | | |
2372 | o 4:2aa9ad1006ff B in file a |
|
2372 | o 4:2aa9ad1006ff B in file a | |
2373 | | |
|
2373 | | | |
2374 | | @ 3:09e253b87e17 A in file a |
|
2374 | | @ 3:09e253b87e17 A in file a | |
2375 | | | |
|
2375 | | | | |
2376 | | o 2:d36c0562f908 c |
|
2376 | | o 2:d36c0562f908 c | |
2377 | | | |
|
2377 | | | | |
2378 | o | 1:d2ae7f538514 b |
|
2378 | o | 1:d2ae7f538514 b | |
2379 | |/ |
|
2379 | |/ | |
2380 | o 0:cb9a9f314b8b a |
|
2380 | o 0:cb9a9f314b8b a | |
2381 |
|
2381 | |||
2382 |
|
2382 | |||
2383 | $ hg graft -r 1 -r 5 --no-commit |
|
2383 | $ hg graft -r 1 -r 5 --no-commit | |
2384 | grafting 1:d2ae7f538514 "b" |
|
2384 | grafting 1:d2ae7f538514 "b" | |
2385 | grafting 5:baefa8927fc0 "d" (tip) |
|
2385 | grafting 5:baefa8927fc0 "d" (tip) | |
2386 | $ hg diff |
|
2386 | $ hg diff | |
2387 | diff -r 09e253b87e17 b |
|
2387 | diff -r 09e253b87e17 b | |
2388 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2388 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2389 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
2389 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 | |
2390 | @@ -0,0 +1,1 @@ |
|
2390 | @@ -0,0 +1,1 @@ | |
2391 | +b |
|
2391 | +b | |
2392 | diff -r 09e253b87e17 d |
|
2392 | diff -r 09e253b87e17 d | |
2393 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2393 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2394 | +++ b/d Thu Jan 01 00:00:00 1970 +0000 |
|
2394 | +++ b/d Thu Jan 01 00:00:00 1970 +0000 | |
2395 | @@ -0,0 +1,1 @@ |
|
2395 | @@ -0,0 +1,1 @@ | |
2396 | +d |
|
2396 | +d | |
2397 | $ hg log -GT "{rev}:{node|short} {desc}\n" |
|
2397 | $ hg log -GT "{rev}:{node|short} {desc}\n" | |
2398 | o 5:baefa8927fc0 d |
|
2398 | o 5:baefa8927fc0 d | |
2399 | | |
|
2399 | | | |
2400 | o 4:2aa9ad1006ff B in file a |
|
2400 | o 4:2aa9ad1006ff B in file a | |
2401 | | |
|
2401 | | | |
2402 | | @ 3:09e253b87e17 A in file a |
|
2402 | | @ 3:09e253b87e17 A in file a | |
2403 | | | |
|
2403 | | | | |
2404 | | o 2:d36c0562f908 c |
|
2404 | | o 2:d36c0562f908 c | |
2405 | | | |
|
2405 | | | | |
2406 | o | 1:d2ae7f538514 b |
|
2406 | o | 1:d2ae7f538514 b | |
2407 | |/ |
|
2407 | |/ | |
2408 | o 0:cb9a9f314b8b a |
|
2408 | o 0:cb9a9f314b8b a | |
2409 |
|
2409 | |||
2410 | $ cd .. |
|
2410 | $ cd .. |
@@ -1,379 +1,379 | |||||
1 | $ cat <<'EOF' >> "$HGRCPATH" |
|
1 | $ cat <<'EOF' >> "$HGRCPATH" | |
2 | > [extensions] |
|
2 | > [extensions] | |
3 | > convert = |
|
3 | > convert = | |
4 | > [templates] |
|
4 | > [templates] | |
5 | > l = '{rev}:{node|short} p={p1rev},{p2rev} m={manifest} f={files|json}' |
|
5 | > l = '{rev}:{node|short} p={p1rev},{p2rev} m={manifest} f={files|json}' | |
6 | > EOF |
|
6 | > EOF | |
7 |
|
7 | |||
8 | $ check_convert_identity () { |
|
8 | $ check_convert_identity () { | |
9 | > hg convert -q "$1" "$1.converted" |
|
9 | > hg convert -q "$1" "$1.converted" | |
10 | > hg outgoing -q -R "$1.converted" "$1" |
|
10 | > hg outgoing -q -R "$1.converted" "$1" | |
11 | > if [ "$?" != 1 ]; then |
|
11 | > if [ "$?" != 1 ]; then | |
12 | > echo '*** BUG: hash changes on convert ***' |
|
12 | > echo '*** BUG: hash changes on convert ***' | |
13 | > hg log -R "$1.converted" -GTl |
|
13 | > hg log -R "$1.converted" -GTl | |
14 | > fi |
|
14 | > fi | |
15 | > } |
|
15 | > } | |
16 |
|
16 | |||
17 | Files added at both parents: |
|
17 | Files added at both parents: | |
18 |
|
18 | |||
19 | $ hg init added-both |
|
19 | $ hg init added-both | |
20 | $ cd added-both |
|
20 | $ cd added-both | |
21 | $ touch a b c |
|
21 | $ touch a b c | |
22 | $ hg ci -qAm0 a |
|
22 | $ hg ci -qAm0 a | |
23 | $ hg ci -qAm1 b |
|
23 | $ hg ci -qAm1 b | |
24 | $ hg up -q 0 |
|
24 | $ hg up -q 0 | |
25 | $ hg ci -qAm2 c |
|
25 | $ hg ci -qAm2 c | |
26 |
|
26 | |||
27 | $ hg merge |
|
27 | $ hg merge | |
28 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
28 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
29 | (branch merge, don't forget to commit) |
|
29 | (branch merge, don't forget to commit) | |
30 | $ hg ci --debug -m merge |
|
30 | $ hg ci --debug -m merge | |
31 | committing files: |
|
31 | committing files: | |
32 | b |
|
32 | b | |
33 | not reusing manifest (no file change in changelog, but manifest differs) |
|
33 | not reusing manifest (no file change in changelog, but manifest differs) | |
34 | committing manifest |
|
34 | committing manifest | |
35 | committing changelog |
|
35 | committing changelog | |
36 | updating the branch cache |
|
36 | updating the branch cache | |
37 | committed changeset 3:7aa8a293f5d97377037afc21e871e036e718d659 |
|
37 | committed changeset 3:7aa8a293f5d97377037afc21e871e036e718d659 | |
38 | $ hg log -GTl |
|
38 | $ hg log -GTl | |
39 | @ 3:7aa8a293f5d9 p=2,1 m=3:8667461869a1 f=[] |
|
39 | @ 3:7aa8a293f5d9 p=2,1 m=3:8667461869a1 f=[] | |
40 | |\ |
|
40 | |\ | |
41 | | o 2:e0ea47086fce p=0,-1 m=2:b2e5b07f9374 f=["c"] |
|
41 | | o 2:e0ea47086fce p=0,-1 m=2:b2e5b07f9374 f=["c"] | |
42 | | | |
|
42 | | | | |
43 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
|
43 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] | |
44 | |/ |
|
44 | |/ | |
45 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
|
45 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] | |
46 |
|
46 | |||
47 |
|
47 | |||
48 | $ cd .. |
|
48 | $ cd .. | |
49 | $ check_convert_identity added-both |
|
49 | $ check_convert_identity added-both | |
50 |
|
50 | |||
51 | Files added at both parents, but the other removed at the merge: |
|
51 | Files added at both parents, but the other removed at the merge: | |
52 | (In this case, ctx.files() after the commit contains the removed file "b", but |
|
52 | (In this case, ctx.files() after the commit contains the removed file "b", but | |
53 | its manifest does not differ from p1.) |
|
53 | its manifest does not differ from p1.) | |
54 |
|
54 | |||
55 | $ hg init added-both-removed-at-merge |
|
55 | $ hg init added-both-removed-at-merge | |
56 | $ cd added-both-removed-at-merge |
|
56 | $ cd added-both-removed-at-merge | |
57 | $ touch a b c |
|
57 | $ touch a b c | |
58 | $ hg ci -qAm0 a |
|
58 | $ hg ci -qAm0 a | |
59 | $ hg ci -qAm1 b |
|
59 | $ hg ci -qAm1 b | |
60 | $ hg up -q 0 |
|
60 | $ hg up -q 0 | |
61 | $ hg ci -qAm2 c |
|
61 | $ hg ci -qAm2 c | |
62 |
|
62 | |||
63 | $ hg merge |
|
63 | $ hg merge | |
64 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
64 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
65 | (branch merge, don't forget to commit) |
|
65 | (branch merge, don't forget to commit) | |
66 | $ hg rm -f b |
|
66 | $ hg rm -f b | |
67 | $ hg ci --debug -m merge |
|
67 | $ hg ci --debug -m merge | |
68 | committing files: |
|
68 | committing files: | |
69 | committing manifest |
|
69 | committing manifest | |
70 | committing changelog |
|
70 | committing changelog | |
71 | updating the branch cache |
|
71 | updating the branch cache | |
72 | committed changeset 3:915745f3ca3d9d699925269474c2d0a9526e8dfa |
|
72 | committed changeset 3:915745f3ca3d9d699925269474c2d0a9526e8dfa | |
73 | $ hg log -GTl |
|
73 | $ hg log -GTl | |
74 | @ 3:915745f3ca3d p=2,1 m=3:8e9cf3456921 f=["b"] |
|
74 | @ 3:915745f3ca3d p=2,1 m=3:8e9cf3456921 f=["b"] | |
75 | |\ |
|
75 | |\ | |
76 | | o 2:e0ea47086fce p=0,-1 m=2:b2e5b07f9374 f=["c"] |
|
76 | | o 2:e0ea47086fce p=0,-1 m=2:b2e5b07f9374 f=["c"] | |
77 | | | |
|
77 | | | | |
78 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
|
78 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] | |
79 | |/ |
|
79 | |/ | |
80 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
|
80 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] | |
81 |
|
81 | |||
82 |
|
82 | |||
83 | $ cd .. |
|
83 | $ cd .. | |
84 | $ check_convert_identity added-both |
|
84 | $ check_convert_identity added-both | |
85 |
|
85 | |||
86 | An identical file added at both parents: |
|
86 | An identical file added at both parents: | |
87 |
|
87 | |||
88 | $ hg init added-identical |
|
88 | $ hg init added-identical | |
89 | $ cd added-identical |
|
89 | $ cd added-identical | |
90 | $ touch a b |
|
90 | $ touch a b | |
91 | $ hg ci -qAm0 a |
|
91 | $ hg ci -qAm0 a | |
92 | $ hg ci -qAm1 b |
|
92 | $ hg ci -qAm1 b | |
93 | $ hg up -q 0 |
|
93 | $ hg up -q 0 | |
94 | $ touch b |
|
94 | $ touch b | |
95 | $ hg ci -qAm2 b |
|
95 | $ hg ci -qAm2 b | |
96 |
|
96 | |||
97 | $ hg merge |
|
97 | $ hg merge | |
98 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
98 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
99 | (branch merge, don't forget to commit) |
|
99 | (branch merge, don't forget to commit) | |
100 | $ hg ci --debug -m merge |
|
100 | $ hg ci --debug -m merge | |
101 | reusing manifest from p1 (no file change) |
|
101 | reusing manifest from p1 (no file change) | |
102 | committing changelog |
|
102 | committing changelog | |
103 | updating the branch cache |
|
103 | updating the branch cache | |
104 | committed changeset 3:de26182cd210f0c3fb175ca7616704ab963d3024 |
|
104 | committed changeset 3:de26182cd210f0c3fb175ca7616704ab963d3024 | |
105 | $ hg log -GTl |
|
105 | $ hg log -GTl | |
106 | @ 3:de26182cd210 p=2,1 m=1:686dbf0aeca4 f=[] |
|
106 | @ 3:de26182cd210 p=2,1 m=1:686dbf0aeca4 f=[] | |
107 | |\ |
|
107 | |\ | |
108 | | o 2:f00991f11eca p=0,-1 m=1:686dbf0aeca4 f=["b"] |
|
108 | | o 2:f00991f11eca p=0,-1 m=1:686dbf0aeca4 f=["b"] | |
109 | | | |
|
109 | | | | |
110 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
|
110 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] | |
111 | |/ |
|
111 | |/ | |
112 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
|
112 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] | |
113 |
|
113 | |||
114 |
|
114 | |||
115 | $ cd .. |
|
115 | $ cd .. | |
116 | $ check_convert_identity added-identical |
|
116 | $ check_convert_identity added-identical | |
117 |
|
117 | |||
118 | #if execbit |
|
118 | #if execbit | |
119 |
|
119 | |||
120 | An identical file added at both parents, but the flag differs. Take local: |
|
120 | An identical file added at both parents, but the flag differs. Take local: | |
121 |
|
121 | |||
122 | $ hg init flag-change-take-p1 |
|
122 | $ hg init flag-change-take-p1 | |
123 | $ cd flag-change-take-p1 |
|
123 | $ cd flag-change-take-p1 | |
124 | $ touch a b |
|
124 | $ touch a b | |
125 | $ hg ci -qAm0 a |
|
125 | $ hg ci -qAm0 a | |
126 | $ hg ci -qAm1 b |
|
126 | $ hg ci -qAm1 b | |
127 | $ hg up -q 0 |
|
127 | $ hg up -q 0 | |
128 | $ touch b |
|
128 | $ touch b | |
129 | $ chmod +x b |
|
129 | $ chmod +x b | |
130 | $ hg ci -qAm2 b |
|
130 | $ hg ci -qAm2 b | |
131 |
|
131 | |||
132 | $ hg merge |
|
132 | $ hg merge | |
133 | warning: cannot merge flags for b without common ancestor - keeping local flags |
|
133 | warning: cannot merge flags for b without common ancestor - keeping local flags | |
134 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
134 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
135 | (branch merge, don't forget to commit) |
|
135 | (branch merge, don't forget to commit) | |
136 | $ chmod +x b |
|
136 | $ chmod +x b | |
137 | $ hg ci --debug -m merge |
|
137 | $ hg ci --debug -m merge | |
138 | committing files: |
|
138 | committing files: | |
139 | b |
|
139 | b | |
140 |
reusing manifest f |
|
140 | reusing manifest from p1 (listed files actually unchanged) | |
141 | committing changelog |
|
141 | committing changelog | |
142 | updating the branch cache |
|
142 | updating the branch cache | |
143 | committed changeset 3:c8d50407916ef8a5a97cb6e36ca9bc844a6ee13e |
|
143 | committed changeset 3:c8d50407916ef8a5a97cb6e36ca9bc844a6ee13e | |
144 | $ hg log -GTl |
|
144 | $ hg log -GTl | |
145 | @ 3:c8d50407916e p=2,1 m=2:36b69ba4b24b f=[] |
|
145 | @ 3:c8d50407916e p=2,1 m=2:36b69ba4b24b f=[] | |
146 | |\ |
|
146 | |\ | |
147 | | o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"] |
|
147 | | o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"] | |
148 | | | |
|
148 | | | | |
149 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
|
149 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] | |
150 | |/ |
|
150 | |/ | |
151 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
|
151 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] | |
152 |
|
152 | |||
153 | $ hg files -vr3 |
|
153 | $ hg files -vr3 | |
154 | 0 a |
|
154 | 0 a | |
155 | 0 x b |
|
155 | 0 x b | |
156 |
|
156 | |||
157 | $ cd .. |
|
157 | $ cd .. | |
158 | $ check_convert_identity flag-change-take-p1 |
|
158 | $ check_convert_identity flag-change-take-p1 | |
159 |
|
159 | |||
160 | An identical file added at both parents, but the flag differs. Take other: |
|
160 | An identical file added at both parents, but the flag differs. Take other: | |
161 |
|
161 | |||
162 | $ hg init flag-change-take-p2 |
|
162 | $ hg init flag-change-take-p2 | |
163 | $ cd flag-change-take-p2 |
|
163 | $ cd flag-change-take-p2 | |
164 | $ touch a b |
|
164 | $ touch a b | |
165 | $ hg ci -qAm0 a |
|
165 | $ hg ci -qAm0 a | |
166 | $ hg ci -qAm1 b |
|
166 | $ hg ci -qAm1 b | |
167 | $ hg up -q 0 |
|
167 | $ hg up -q 0 | |
168 | $ touch b |
|
168 | $ touch b | |
169 | $ chmod +x b |
|
169 | $ chmod +x b | |
170 | $ hg ci -qAm2 b |
|
170 | $ hg ci -qAm2 b | |
171 |
|
171 | |||
172 | $ hg merge |
|
172 | $ hg merge | |
173 | warning: cannot merge flags for b without common ancestor - keeping local flags |
|
173 | warning: cannot merge flags for b without common ancestor - keeping local flags | |
174 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
174 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
175 | (branch merge, don't forget to commit) |
|
175 | (branch merge, don't forget to commit) | |
176 | $ chmod -x b |
|
176 | $ chmod -x b | |
177 | $ hg ci --debug -m merge |
|
177 | $ hg ci --debug -m merge | |
178 | committing files: |
|
178 | committing files: | |
179 | b |
|
179 | b | |
180 | committing manifest |
|
180 | committing manifest | |
181 | committing changelog |
|
181 | committing changelog | |
182 | updating the branch cache |
|
182 | updating the branch cache | |
183 | committed changeset 3:06a62a687d87c7d8944743dee1ee9d8c66b3f6e3 |
|
183 | committed changeset 3:06a62a687d87c7d8944743dee1ee9d8c66b3f6e3 | |
184 | $ hg log -GTl |
|
184 | $ hg log -GTl | |
185 | @ 3:06a62a687d87 p=2,1 m=3:2a315ba1aa45 f=["b"] |
|
185 | @ 3:06a62a687d87 p=2,1 m=3:2a315ba1aa45 f=["b"] | |
186 | |\ |
|
186 | |\ | |
187 | | o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"] |
|
187 | | o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"] | |
188 | | | |
|
188 | | | | |
189 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
|
189 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] | |
190 | |/ |
|
190 | |/ | |
191 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
|
191 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] | |
192 |
|
192 | |||
193 | $ hg files -vr3 |
|
193 | $ hg files -vr3 | |
194 | 0 a |
|
194 | 0 a | |
195 | 0 b |
|
195 | 0 b | |
196 |
|
196 | |||
197 | $ cd .. |
|
197 | $ cd .. | |
198 | $ check_convert_identity flag-change-take-p2 |
|
198 | $ check_convert_identity flag-change-take-p2 | |
199 |
|
199 | |||
200 | #endif |
|
200 | #endif | |
201 |
|
201 | |||
202 | An identical file added at both parents, one more file added at p2: |
|
202 | An identical file added at both parents, one more file added at p2: | |
203 |
|
203 | |||
204 | $ hg init added-some-p2 |
|
204 | $ hg init added-some-p2 | |
205 | $ cd added-some-p2 |
|
205 | $ cd added-some-p2 | |
206 | $ touch a b c |
|
206 | $ touch a b c | |
207 | $ hg ci -qAm0 a |
|
207 | $ hg ci -qAm0 a | |
208 | $ hg ci -qAm1 b |
|
208 | $ hg ci -qAm1 b | |
209 | $ hg ci -qAm2 c |
|
209 | $ hg ci -qAm2 c | |
210 | $ hg up -q 0 |
|
210 | $ hg up -q 0 | |
211 | $ touch b |
|
211 | $ touch b | |
212 | $ hg ci -qAm3 b |
|
212 | $ hg ci -qAm3 b | |
213 |
|
213 | |||
214 | $ hg merge |
|
214 | $ hg merge | |
215 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
215 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
216 | (branch merge, don't forget to commit) |
|
216 | (branch merge, don't forget to commit) | |
217 | $ hg ci --debug -m merge |
|
217 | $ hg ci --debug -m merge | |
218 | committing files: |
|
218 | committing files: | |
219 | c |
|
219 | c | |
220 | not reusing manifest (no file change in changelog, but manifest differs) |
|
220 | not reusing manifest (no file change in changelog, but manifest differs) | |
221 | committing manifest |
|
221 | committing manifest | |
222 | committing changelog |
|
222 | committing changelog | |
223 | updating the branch cache |
|
223 | updating the branch cache | |
224 | committed changeset 4:f7fbc4e4d9a8fde03ba475adad675578c8bf472d |
|
224 | committed changeset 4:f7fbc4e4d9a8fde03ba475adad675578c8bf472d | |
225 | $ hg log -GTl |
|
225 | $ hg log -GTl | |
226 | @ 4:f7fbc4e4d9a8 p=3,2 m=3:92acd5bfd716 f=[] |
|
226 | @ 4:f7fbc4e4d9a8 p=3,2 m=3:92acd5bfd716 f=[] | |
227 | |\ |
|
227 | |\ | |
228 | | o 3:e9d9f3cc981f p=0,-1 m=1:686dbf0aeca4 f=["b"] |
|
228 | | o 3:e9d9f3cc981f p=0,-1 m=1:686dbf0aeca4 f=["b"] | |
229 | | | |
|
229 | | | | |
230 | o | 2:93c5529a4ec7 p=1,-1 m=2:ae25a31b30b3 f=["c"] |
|
230 | o | 2:93c5529a4ec7 p=1,-1 m=2:ae25a31b30b3 f=["c"] | |
231 | | | |
|
231 | | | | |
232 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
|
232 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] | |
233 | |/ |
|
233 | |/ | |
234 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
|
234 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] | |
235 |
|
235 | |||
236 |
|
236 | |||
237 | $ cd .. |
|
237 | $ cd .. | |
238 | $ check_convert_identity added-some-p2 |
|
238 | $ check_convert_identity added-some-p2 | |
239 |
|
239 | |||
240 | An identical file added at both parents, one more file added at p1: |
|
240 | An identical file added at both parents, one more file added at p1: | |
241 | (In this case, p1 manifest is reused at the merge commit, which means the |
|
241 | (In this case, p1 manifest is reused at the merge commit, which means the | |
242 | manifest DAG does not have the same shape as the changelog.) |
|
242 | manifest DAG does not have the same shape as the changelog.) | |
243 |
|
243 | |||
244 | $ hg init added-some-p1 |
|
244 | $ hg init added-some-p1 | |
245 | $ cd added-some-p1 |
|
245 | $ cd added-some-p1 | |
246 | $ touch a b |
|
246 | $ touch a b | |
247 | $ hg ci -qAm0 a |
|
247 | $ hg ci -qAm0 a | |
248 | $ hg ci -qAm1 b |
|
248 | $ hg ci -qAm1 b | |
249 | $ hg up -q 0 |
|
249 | $ hg up -q 0 | |
250 | $ touch b c |
|
250 | $ touch b c | |
251 | $ hg ci -qAm2 b |
|
251 | $ hg ci -qAm2 b | |
252 | $ hg ci -qAm3 c |
|
252 | $ hg ci -qAm3 c | |
253 |
|
253 | |||
254 | $ hg merge |
|
254 | $ hg merge | |
255 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
255 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
256 | (branch merge, don't forget to commit) |
|
256 | (branch merge, don't forget to commit) | |
257 | $ hg ci --debug -m merge |
|
257 | $ hg ci --debug -m merge | |
258 | reusing manifest from p1 (no file change) |
|
258 | reusing manifest from p1 (no file change) | |
259 | committing changelog |
|
259 | committing changelog | |
260 | updating the branch cache |
|
260 | updating the branch cache | |
261 | committed changeset 4:a9f0f589a913f5a149dc10dfbd5af726977c36c4 |
|
261 | committed changeset 4:a9f0f589a913f5a149dc10dfbd5af726977c36c4 | |
262 | $ hg log -GTl |
|
262 | $ hg log -GTl | |
263 | @ 4:a9f0f589a913 p=3,1 m=2:ae25a31b30b3 f=[] |
|
263 | @ 4:a9f0f589a913 p=3,1 m=2:ae25a31b30b3 f=[] | |
264 | |\ |
|
264 | |\ | |
265 | | o 3:b8dc385241b5 p=2,-1 m=2:ae25a31b30b3 f=["c"] |
|
265 | | o 3:b8dc385241b5 p=2,-1 m=2:ae25a31b30b3 f=["c"] | |
266 | | | |
|
266 | | | | |
267 | | o 2:f00991f11eca p=0,-1 m=1:686dbf0aeca4 f=["b"] |
|
267 | | o 2:f00991f11eca p=0,-1 m=1:686dbf0aeca4 f=["b"] | |
268 | | | |
|
268 | | | | |
269 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] |
|
269 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] | |
270 | |/ |
|
270 | |/ | |
271 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] |
|
271 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] | |
272 |
|
272 | |||
273 |
|
273 | |||
274 | $ cd .. |
|
274 | $ cd .. | |
275 | $ check_convert_identity added-some-p1 |
|
275 | $ check_convert_identity added-some-p1 | |
276 |
|
276 | |||
277 | A file added at p2, a named branch created at p1: |
|
277 | A file added at p2, a named branch created at p1: | |
278 |
|
278 | |||
279 | $ hg init named-branch-p1 |
|
279 | $ hg init named-branch-p1 | |
280 | $ cd named-branch-p1 |
|
280 | $ cd named-branch-p1 | |
281 | $ touch a b |
|
281 | $ touch a b | |
282 | $ hg ci -qAm0 a |
|
282 | $ hg ci -qAm0 a | |
283 | $ hg ci -qAm1 b |
|
283 | $ hg ci -qAm1 b | |
284 | $ hg up -q 0 |
|
284 | $ hg up -q 0 | |
285 | $ hg branch -q foo |
|
285 | $ hg branch -q foo | |
286 | $ hg ci -m2 |
|
286 | $ hg ci -m2 | |
287 |
|
287 | |||
288 | $ hg merge default |
|
288 | $ hg merge default | |
289 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
289 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
290 | (branch merge, don't forget to commit) |
|
290 | (branch merge, don't forget to commit) | |
291 | $ hg ci --debug -m merge |
|
291 | $ hg ci --debug -m merge | |
292 | committing files: |
|
292 | committing files: | |
293 | b |
|
293 | b | |
294 | not reusing manifest (no file change in changelog, but manifest differs) |
|
294 | not reusing manifest (no file change in changelog, but manifest differs) | |
295 | committing manifest |
|
295 | committing manifest | |
296 | committing changelog |
|
296 | committing changelog | |
297 | updating the branch cache |
|
297 | updating the branch cache | |
298 | committed changeset 3:fb97d83b02fd072295cfc2171f21b7d38509bfd7 |
|
298 | committed changeset 3:fb97d83b02fd072295cfc2171f21b7d38509bfd7 | |
299 | $ hg log -GT'{l} branch={branch}' |
|
299 | $ hg log -GT'{l} branch={branch}' | |
300 | @ 3:fb97d83b02fd p=2,1 m=2:9091c64f4ea1 f=[] branch=foo |
|
300 | @ 3:fb97d83b02fd p=2,1 m=2:9091c64f4ea1 f=[] branch=foo | |
301 | |\ |
|
301 | |\ | |
302 | | o 2:a3a9fa6587e5 p=0,-1 m=0:8515d4bfda76 f=[] branch=foo |
|
302 | | o 2:a3a9fa6587e5 p=0,-1 m=0:8515d4bfda76 f=[] branch=foo | |
303 | | | |
|
303 | | | | |
304 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] branch=default |
|
304 | o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] branch=default | |
305 | |/ |
|
305 | |/ | |
306 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default |
|
306 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default | |
307 |
|
307 | |||
308 |
|
308 | |||
309 | $ cd .. |
|
309 | $ cd .. | |
310 | $ check_convert_identity named-branch-p1 |
|
310 | $ check_convert_identity named-branch-p1 | |
311 |
|
311 | |||
312 | A file added at p1, a named branch created at p2: |
|
312 | A file added at p1, a named branch created at p2: | |
313 | (In this case, p1 manifest is reused at the merge commit, which means the |
|
313 | (In this case, p1 manifest is reused at the merge commit, which means the | |
314 | manifest DAG does not have the same shape as the changelog.) |
|
314 | manifest DAG does not have the same shape as the changelog.) | |
315 |
|
315 | |||
316 | $ hg init named-branch-p2 |
|
316 | $ hg init named-branch-p2 | |
317 | $ cd named-branch-p2 |
|
317 | $ cd named-branch-p2 | |
318 | $ touch a b |
|
318 | $ touch a b | |
319 | $ hg ci -qAm0 a |
|
319 | $ hg ci -qAm0 a | |
320 | $ hg branch -q foo |
|
320 | $ hg branch -q foo | |
321 | $ hg ci -m1 |
|
321 | $ hg ci -m1 | |
322 | $ hg up -q 0 |
|
322 | $ hg up -q 0 | |
323 | $ hg ci -qAm1 b |
|
323 | $ hg ci -qAm1 b | |
324 |
|
324 | |||
325 | $ hg merge foo |
|
325 | $ hg merge foo | |
326 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
326 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
327 | (branch merge, don't forget to commit) |
|
327 | (branch merge, don't forget to commit) | |
328 | $ hg ci --debug -m merge |
|
328 | $ hg ci --debug -m merge | |
329 | reusing manifest from p1 (no file change) |
|
329 | reusing manifest from p1 (no file change) | |
330 | committing changelog |
|
330 | committing changelog | |
331 | updating the branch cache |
|
331 | updating the branch cache | |
332 | committed changeset 3:036823e24692218324d4af43b07ff89f8a000096 |
|
332 | committed changeset 3:036823e24692218324d4af43b07ff89f8a000096 | |
333 | $ hg log -GT'{l} branch={branch}' |
|
333 | $ hg log -GT'{l} branch={branch}' | |
334 | @ 3:036823e24692 p=2,1 m=1:686dbf0aeca4 f=[] branch=default |
|
334 | @ 3:036823e24692 p=2,1 m=1:686dbf0aeca4 f=[] branch=default | |
335 | |\ |
|
335 | |\ | |
336 | | o 2:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] branch=default |
|
336 | | o 2:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"] branch=default | |
337 | | | |
|
337 | | | | |
338 | o | 1:da38c8e00727 p=0,-1 m=0:8515d4bfda76 f=[] branch=foo |
|
338 | o | 1:da38c8e00727 p=0,-1 m=0:8515d4bfda76 f=[] branch=foo | |
339 | |/ |
|
339 | |/ | |
340 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default |
|
340 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default | |
341 |
|
341 | |||
342 |
|
342 | |||
343 | $ cd .. |
|
343 | $ cd .. | |
344 | $ check_convert_identity named-branch-p2 |
|
344 | $ check_convert_identity named-branch-p2 | |
345 |
|
345 | |||
346 | A file changed once at both parents, but amended to have identical content: |
|
346 | A file changed once at both parents, but amended to have identical content: | |
347 |
|
347 | |||
348 | $ hg init amend-p1 |
|
348 | $ hg init amend-p1 | |
349 | $ cd amend-p1 |
|
349 | $ cd amend-p1 | |
350 | $ touch a |
|
350 | $ touch a | |
351 | $ hg ci -qAm0 a |
|
351 | $ hg ci -qAm0 a | |
352 | $ echo foo > a |
|
352 | $ echo foo > a | |
353 | $ hg ci -m1 |
|
353 | $ hg ci -m1 | |
354 | $ hg up -q 0 |
|
354 | $ hg up -q 0 | |
355 | $ echo bar > a |
|
355 | $ echo bar > a | |
356 | $ hg ci -qm2 |
|
356 | $ hg ci -qm2 | |
357 | $ echo foo > a |
|
357 | $ echo foo > a | |
358 | $ hg ci -qm3 --amend |
|
358 | $ hg ci -qm3 --amend | |
359 |
|
359 | |||
360 | $ hg merge |
|
360 | $ hg merge | |
361 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
361 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
362 | (branch merge, don't forget to commit) |
|
362 | (branch merge, don't forget to commit) | |
363 | $ hg ci --debug -m merge |
|
363 | $ hg ci --debug -m merge | |
364 | reusing manifest from p1 (no file change) |
|
364 | reusing manifest from p1 (no file change) | |
365 | committing changelog |
|
365 | committing changelog | |
366 | updating the branch cache |
|
366 | updating the branch cache | |
367 | committed changeset 3:314e5bc5adf5c58ea571efabe33eedba20a201aa |
|
367 | committed changeset 3:314e5bc5adf5c58ea571efabe33eedba20a201aa | |
368 | $ hg log -GT'{l} branch={branch}' |
|
368 | $ hg log -GT'{l} branch={branch}' | |
369 | @ 3:314e5bc5adf5 p=2,1 m=1:d33ea248bd73 f=[] branch=default |
|
369 | @ 3:314e5bc5adf5 p=2,1 m=1:d33ea248bd73 f=[] branch=default | |
370 | |\ |
|
370 | |\ | |
371 | | o 2:de9c64f226a3 p=0,-1 m=1:d33ea248bd73 f=["a"] branch=default |
|
371 | | o 2:de9c64f226a3 p=0,-1 m=1:d33ea248bd73 f=["a"] branch=default | |
372 | | | |
|
372 | | | | |
373 | o | 1:6a74aec01b3c p=0,-1 m=1:d33ea248bd73 f=["a"] branch=default |
|
373 | o | 1:6a74aec01b3c p=0,-1 m=1:d33ea248bd73 f=["a"] branch=default | |
374 | |/ |
|
374 | |/ | |
375 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default |
|
375 | o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"] branch=default | |
376 |
|
376 | |||
377 |
|
377 | |||
378 | $ cd .. |
|
378 | $ cd .. | |
379 | $ check_convert_identity amend-p1 |
|
379 | $ check_convert_identity amend-p1 |
General Comments 0
You need to be logged in to leave comments.
Login now