Show More
@@ -1,1919 +1,1923 b'' | |||
|
1 | 1 | # context.py - changeset and file context objects for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from node import nullid, nullrev, wdirid, short, hex, bin |
|
9 | 9 | from i18n import _ |
|
10 | 10 | import mdiff, error, util, scmutil, subrepo, patch, encoding, phases |
|
11 | 11 | import match as matchmod |
|
12 | 12 | import os, errno, stat |
|
13 | 13 | import obsolete as obsmod |
|
14 | 14 | import repoview |
|
15 | 15 | import fileset |
|
16 | 16 | import revlog |
|
17 | 17 | |
|
18 | 18 | propertycache = util.propertycache |
|
19 | 19 | |
|
20 | 20 | # Phony node value to stand-in for new files in some uses of |
|
21 | 21 | # manifests. Manifests support 21-byte hashes for nodes which are |
|
22 | 22 | # dirty in the working copy. |
|
23 | 23 | _newnode = '!' * 21 |
|
24 | 24 | |
|
25 | 25 | class basectx(object): |
|
26 | 26 | """A basectx object represents the common logic for its children: |
|
27 | 27 | changectx: read-only context that is already present in the repo, |
|
28 | 28 | workingctx: a context that represents the working directory and can |
|
29 | 29 | be committed, |
|
30 | 30 | memctx: a context that represents changes in-memory and can also |
|
31 | 31 | be committed.""" |
|
32 | 32 | def __new__(cls, repo, changeid='', *args, **kwargs): |
|
33 | 33 | if isinstance(changeid, basectx): |
|
34 | 34 | return changeid |
|
35 | 35 | |
|
36 | 36 | o = super(basectx, cls).__new__(cls) |
|
37 | 37 | |
|
38 | 38 | o._repo = repo |
|
39 | 39 | o._rev = nullrev |
|
40 | 40 | o._node = nullid |
|
41 | 41 | |
|
42 | 42 | return o |
|
43 | 43 | |
|
44 | 44 | def __str__(self): |
|
45 | 45 | return short(self.node()) |
|
46 | 46 | |
|
47 | 47 | def __int__(self): |
|
48 | 48 | return self.rev() |
|
49 | 49 | |
|
50 | 50 | def __repr__(self): |
|
51 | 51 | return "<%s %s>" % (type(self).__name__, str(self)) |
|
52 | 52 | |
|
53 | 53 | def __eq__(self, other): |
|
54 | 54 | try: |
|
55 | 55 | return type(self) == type(other) and self._rev == other._rev |
|
56 | 56 | except AttributeError: |
|
57 | 57 | return False |
|
58 | 58 | |
|
59 | 59 | def __ne__(self, other): |
|
60 | 60 | return not (self == other) |
|
61 | 61 | |
|
62 | 62 | def __contains__(self, key): |
|
63 | 63 | return key in self._manifest |
|
64 | 64 | |
|
65 | 65 | def __getitem__(self, key): |
|
66 | 66 | return self.filectx(key) |
|
67 | 67 | |
|
68 | 68 | def __iter__(self): |
|
69 | 69 | return iter(self._manifest) |
|
70 | 70 | |
|
71 | 71 | def _manifestmatches(self, match, s): |
|
72 | 72 | """generate a new manifest filtered by the match argument |
|
73 | 73 | |
|
74 | 74 | This method is for internal use only and mainly exists to provide an |
|
75 | 75 | object oriented way for other contexts to customize the manifest |
|
76 | 76 | generation. |
|
77 | 77 | """ |
|
78 | 78 | return self.manifest().matches(match) |
|
79 | 79 | |
|
80 | 80 | def _matchstatus(self, other, match): |
|
81 | 81 | """return match.always if match is none |
|
82 | 82 | |
|
83 | 83 | This internal method provides a way for child objects to override the |
|
84 | 84 | match operator. |
|
85 | 85 | """ |
|
86 | 86 | return match or matchmod.always(self._repo.root, self._repo.getcwd()) |
|
87 | 87 | |
|
88 | 88 | def _buildstatus(self, other, s, match, listignored, listclean, |
|
89 | 89 | listunknown): |
|
90 | 90 | """build a status with respect to another context""" |
|
91 | 91 | # Load earliest manifest first for caching reasons. More specifically, |
|
92 | 92 | # if you have revisions 1000 and 1001, 1001 is probably stored as a |
|
93 | 93 | # delta against 1000. Thus, if you read 1000 first, we'll reconstruct |
|
94 | 94 | # 1000 and cache it so that when you read 1001, we just need to apply a |
|
95 | 95 | # delta to what's in the cache. So that's one full reconstruction + one |
|
96 | 96 | # delta application. |
|
97 | 97 | if self.rev() is not None and self.rev() < other.rev(): |
|
98 | 98 | self.manifest() |
|
99 | 99 | mf1 = other._manifestmatches(match, s) |
|
100 | 100 | mf2 = self._manifestmatches(match, s) |
|
101 | 101 | |
|
102 | 102 | modified, added = [], [] |
|
103 | 103 | removed = [] |
|
104 | 104 | clean = [] |
|
105 | 105 | deleted, unknown, ignored = s.deleted, s.unknown, s.ignored |
|
106 | 106 | deletedset = set(deleted) |
|
107 | 107 | d = mf1.diff(mf2, clean=listclean) |
|
108 | 108 | for fn, value in d.iteritems(): |
|
109 | 109 | if fn in deletedset: |
|
110 | 110 | continue |
|
111 | 111 | if value is None: |
|
112 | 112 | clean.append(fn) |
|
113 | 113 | continue |
|
114 | 114 | (node1, flag1), (node2, flag2) = value |
|
115 | 115 | if node1 is None: |
|
116 | 116 | added.append(fn) |
|
117 | 117 | elif node2 is None: |
|
118 | 118 | removed.append(fn) |
|
119 | 119 | elif node2 != _newnode: |
|
120 | 120 | # The file was not a new file in mf2, so an entry |
|
121 | 121 | # from diff is really a difference. |
|
122 | 122 | modified.append(fn) |
|
123 | 123 | elif self[fn].cmp(other[fn]): |
|
124 | 124 | # node2 was newnode, but the working file doesn't |
|
125 | 125 | # match the one in mf1. |
|
126 | 126 | modified.append(fn) |
|
127 | 127 | else: |
|
128 | 128 | clean.append(fn) |
|
129 | 129 | |
|
130 | 130 | if removed: |
|
131 | 131 | # need to filter files if they are already reported as removed |
|
132 | 132 | unknown = [fn for fn in unknown if fn not in mf1] |
|
133 | 133 | ignored = [fn for fn in ignored if fn not in mf1] |
|
134 | 134 | # if they're deleted, don't report them as removed |
|
135 | 135 | removed = [fn for fn in removed if fn not in deletedset] |
|
136 | 136 | |
|
137 | 137 | return scmutil.status(modified, added, removed, deleted, unknown, |
|
138 | 138 | ignored, clean) |
|
139 | 139 | |
|
140 | 140 | @propertycache |
|
141 | 141 | def substate(self): |
|
142 | 142 | return subrepo.state(self, self._repo.ui) |
|
143 | 143 | |
|
144 | 144 | def subrev(self, subpath): |
|
145 | 145 | return self.substate[subpath][1] |
|
146 | 146 | |
|
147 | 147 | def rev(self): |
|
148 | 148 | return self._rev |
|
149 | 149 | def node(self): |
|
150 | 150 | return self._node |
|
151 | 151 | def hex(self): |
|
152 | 152 | return hex(self.node()) |
|
153 | 153 | def manifest(self): |
|
154 | 154 | return self._manifest |
|
155 | 155 | def repo(self): |
|
156 | 156 | return self._repo |
|
157 | 157 | def phasestr(self): |
|
158 | 158 | return phases.phasenames[self.phase()] |
|
159 | 159 | def mutable(self): |
|
160 | 160 | return self.phase() > phases.public |
|
161 | 161 | |
|
162 | 162 | def getfileset(self, expr): |
|
163 | 163 | return fileset.getfileset(self, expr) |
|
164 | 164 | |
|
165 | 165 | def obsolete(self): |
|
166 | 166 | """True if the changeset is obsolete""" |
|
167 | 167 | return self.rev() in obsmod.getrevs(self._repo, 'obsolete') |
|
168 | 168 | |
|
169 | 169 | def extinct(self): |
|
170 | 170 | """True if the changeset is extinct""" |
|
171 | 171 | return self.rev() in obsmod.getrevs(self._repo, 'extinct') |
|
172 | 172 | |
|
173 | 173 | def unstable(self): |
|
174 | 174 | """True if the changeset is not obsolete but it's ancestor are""" |
|
175 | 175 | return self.rev() in obsmod.getrevs(self._repo, 'unstable') |
|
176 | 176 | |
|
177 | 177 | def bumped(self): |
|
178 | 178 | """True if the changeset try to be a successor of a public changeset |
|
179 | 179 | |
|
180 | 180 | Only non-public and non-obsolete changesets may be bumped. |
|
181 | 181 | """ |
|
182 | 182 | return self.rev() in obsmod.getrevs(self._repo, 'bumped') |
|
183 | 183 | |
|
184 | 184 | def divergent(self): |
|
185 | 185 | """Is a successors of a changeset with multiple possible successors set |
|
186 | 186 | |
|
187 | 187 | Only non-public and non-obsolete changesets may be divergent. |
|
188 | 188 | """ |
|
189 | 189 | return self.rev() in obsmod.getrevs(self._repo, 'divergent') |
|
190 | 190 | |
|
191 | 191 | def troubled(self): |
|
192 | 192 | """True if the changeset is either unstable, bumped or divergent""" |
|
193 | 193 | return self.unstable() or self.bumped() or self.divergent() |
|
194 | 194 | |
|
195 | 195 | def troubles(self): |
|
196 | 196 | """return the list of troubles affecting this changesets. |
|
197 | 197 | |
|
198 | 198 | Troubles are returned as strings. possible values are: |
|
199 | 199 | - unstable, |
|
200 | 200 | - bumped, |
|
201 | 201 | - divergent. |
|
202 | 202 | """ |
|
203 | 203 | troubles = [] |
|
204 | 204 | if self.unstable(): |
|
205 | 205 | troubles.append('unstable') |
|
206 | 206 | if self.bumped(): |
|
207 | 207 | troubles.append('bumped') |
|
208 | 208 | if self.divergent(): |
|
209 | 209 | troubles.append('divergent') |
|
210 | 210 | return troubles |
|
211 | 211 | |
|
212 | 212 | def parents(self): |
|
213 | 213 | """return contexts for each parent changeset""" |
|
214 | 214 | return self._parents |
|
215 | 215 | |
|
216 | 216 | def p1(self): |
|
217 | 217 | return self._parents[0] |
|
218 | 218 | |
|
219 | 219 | def p2(self): |
|
220 | 220 | if len(self._parents) == 2: |
|
221 | 221 | return self._parents[1] |
|
222 | 222 | return changectx(self._repo, -1) |
|
223 | 223 | |
|
224 | 224 | def _fileinfo(self, path): |
|
225 | 225 | if '_manifest' in self.__dict__: |
|
226 | 226 | try: |
|
227 | 227 | return self._manifest[path], self._manifest.flags(path) |
|
228 | 228 | except KeyError: |
|
229 | 229 | raise error.ManifestLookupError(self._node, path, |
|
230 | 230 | _('not found in manifest')) |
|
231 | 231 | if '_manifestdelta' in self.__dict__ or path in self.files(): |
|
232 | 232 | if path in self._manifestdelta: |
|
233 | 233 | return (self._manifestdelta[path], |
|
234 | 234 | self._manifestdelta.flags(path)) |
|
235 | 235 | node, flag = self._repo.manifest.find(self._changeset[0], path) |
|
236 | 236 | if not node: |
|
237 | 237 | raise error.ManifestLookupError(self._node, path, |
|
238 | 238 | _('not found in manifest')) |
|
239 | 239 | |
|
240 | 240 | return node, flag |
|
241 | 241 | |
|
242 | 242 | def filenode(self, path): |
|
243 | 243 | return self._fileinfo(path)[0] |
|
244 | 244 | |
|
245 | 245 | def flags(self, path): |
|
246 | 246 | try: |
|
247 | 247 | return self._fileinfo(path)[1] |
|
248 | 248 | except error.LookupError: |
|
249 | 249 | return '' |
|
250 | 250 | |
|
251 | 251 | def sub(self, path): |
|
252 | 252 | '''return a subrepo for the stored revision of path, never wdir()''' |
|
253 | 253 | return subrepo.subrepo(self, path) |
|
254 | 254 | |
|
255 | 255 | def nullsub(self, path, pctx): |
|
256 | 256 | return subrepo.nullsubrepo(self, path, pctx) |
|
257 | 257 | |
|
258 | 258 | def workingsub(self, path): |
|
259 | 259 | '''return a subrepo for the stored revision, or wdir if this is a wdir |
|
260 | 260 | context. |
|
261 | 261 | ''' |
|
262 | 262 | return subrepo.subrepo(self, path, allowwdir=True) |
|
263 | 263 | |
|
264 | 264 | def match(self, pats=[], include=None, exclude=None, default='glob', |
|
265 | 265 | listsubrepos=False, badfn=None): |
|
266 | 266 | r = self._repo |
|
267 | 267 | return matchmod.match(r.root, r.getcwd(), pats, |
|
268 | 268 | include, exclude, default, |
|
269 | 269 | auditor=r.auditor, ctx=self, |
|
270 | 270 | listsubrepos=listsubrepos, badfn=badfn) |
|
271 | 271 | |
|
272 | 272 | def diff(self, ctx2=None, match=None, **opts): |
|
273 | 273 | """Returns a diff generator for the given contexts and matcher""" |
|
274 | 274 | if ctx2 is None: |
|
275 | 275 | ctx2 = self.p1() |
|
276 | 276 | if ctx2 is not None: |
|
277 | 277 | ctx2 = self._repo[ctx2] |
|
278 | 278 | diffopts = patch.diffopts(self._repo.ui, opts) |
|
279 | 279 | return patch.diff(self._repo, ctx2, self, match=match, opts=diffopts) |
|
280 | 280 | |
|
281 | 281 | def dirs(self): |
|
282 | 282 | return self._manifest.dirs() |
|
283 | 283 | |
|
284 | 284 | def hasdir(self, dir): |
|
285 | 285 | return self._manifest.hasdir(dir) |
|
286 | 286 | |
|
287 | 287 | def dirty(self, missing=False, merge=True, branch=True): |
|
288 | 288 | return False |
|
289 | 289 | |
|
290 | 290 | def status(self, other=None, match=None, listignored=False, |
|
291 | 291 | listclean=False, listunknown=False, listsubrepos=False): |
|
292 | 292 | """return status of files between two nodes or node and working |
|
293 | 293 | directory. |
|
294 | 294 | |
|
295 | 295 | If other is None, compare this node with working directory. |
|
296 | 296 | |
|
297 | 297 | returns (modified, added, removed, deleted, unknown, ignored, clean) |
|
298 | 298 | """ |
|
299 | 299 | |
|
300 | 300 | ctx1 = self |
|
301 | 301 | ctx2 = self._repo[other] |
|
302 | 302 | |
|
303 | 303 | # This next code block is, admittedly, fragile logic that tests for |
|
304 | 304 | # reversing the contexts and wouldn't need to exist if it weren't for |
|
305 | 305 | # the fast (and common) code path of comparing the working directory |
|
306 | 306 | # with its first parent. |
|
307 | 307 | # |
|
308 | 308 | # What we're aiming for here is the ability to call: |
|
309 | 309 | # |
|
310 | 310 | # workingctx.status(parentctx) |
|
311 | 311 | # |
|
312 | 312 | # If we always built the manifest for each context and compared those, |
|
313 | 313 | # then we'd be done. But the special case of the above call means we |
|
314 | 314 | # just copy the manifest of the parent. |
|
315 | 315 | reversed = False |
|
316 | 316 | if (not isinstance(ctx1, changectx) |
|
317 | 317 | and isinstance(ctx2, changectx)): |
|
318 | 318 | reversed = True |
|
319 | 319 | ctx1, ctx2 = ctx2, ctx1 |
|
320 | 320 | |
|
321 | 321 | match = ctx2._matchstatus(ctx1, match) |
|
322 | 322 | r = scmutil.status([], [], [], [], [], [], []) |
|
323 | 323 | r = ctx2._buildstatus(ctx1, r, match, listignored, listclean, |
|
324 | 324 | listunknown) |
|
325 | 325 | |
|
326 | 326 | if reversed: |
|
327 | 327 | # Reverse added and removed. Clear deleted, unknown and ignored as |
|
328 | 328 | # these make no sense to reverse. |
|
329 | 329 | r = scmutil.status(r.modified, r.removed, r.added, [], [], [], |
|
330 | 330 | r.clean) |
|
331 | 331 | |
|
332 | 332 | if listsubrepos: |
|
333 | 333 | for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): |
|
334 | 334 | rev2 = ctx2.subrev(subpath) |
|
335 | 335 | try: |
|
336 | 336 | submatch = matchmod.narrowmatcher(subpath, match) |
|
337 | 337 | s = sub.status(rev2, match=submatch, ignored=listignored, |
|
338 | 338 | clean=listclean, unknown=listunknown, |
|
339 | 339 | listsubrepos=True) |
|
340 | 340 | for rfiles, sfiles in zip(r, s): |
|
341 | 341 | rfiles.extend("%s/%s" % (subpath, f) for f in sfiles) |
|
342 | 342 | except error.LookupError: |
|
343 | 343 | self._repo.ui.status(_("skipping missing " |
|
344 | 344 | "subrepository: %s\n") % subpath) |
|
345 | 345 | |
|
346 | 346 | for l in r: |
|
347 | 347 | l.sort() |
|
348 | 348 | |
|
349 | 349 | return r |
|
350 | 350 | |
|
351 | 351 | |
|
352 | 352 | def makememctx(repo, parents, text, user, date, branch, files, store, |
|
353 | 353 | editor=None, extra=None): |
|
354 | 354 | def getfilectx(repo, memctx, path): |
|
355 | 355 | data, mode, copied = store.getfile(path) |
|
356 | 356 | if data is None: |
|
357 | 357 | return None |
|
358 | 358 | islink, isexec = mode |
|
359 | 359 | return memfilectx(repo, path, data, islink=islink, isexec=isexec, |
|
360 | 360 | copied=copied, memctx=memctx) |
|
361 | 361 | if extra is None: |
|
362 | 362 | extra = {} |
|
363 | 363 | if branch: |
|
364 | 364 | extra['branch'] = encoding.fromlocal(branch) |
|
365 | 365 | ctx = memctx(repo, parents, text, files, getfilectx, user, |
|
366 | 366 | date, extra, editor) |
|
367 | 367 | return ctx |
|
368 | 368 | |
|
369 | 369 | class changectx(basectx): |
|
370 | 370 | """A changecontext object makes access to data related to a particular |
|
371 | 371 | changeset convenient. It represents a read-only context already present in |
|
372 | 372 | the repo.""" |
|
373 | 373 | def __init__(self, repo, changeid=''): |
|
374 | 374 | """changeid is a revision number, node, or tag""" |
|
375 | 375 | |
|
376 | 376 | # since basectx.__new__ already took care of copying the object, we |
|
377 | 377 | # don't need to do anything in __init__, so we just exit here |
|
378 | 378 | if isinstance(changeid, basectx): |
|
379 | 379 | return |
|
380 | 380 | |
|
381 | 381 | if changeid == '': |
|
382 | 382 | changeid = '.' |
|
383 | 383 | self._repo = repo |
|
384 | 384 | |
|
385 | 385 | try: |
|
386 | 386 | if isinstance(changeid, int): |
|
387 | 387 | self._node = repo.changelog.node(changeid) |
|
388 | 388 | self._rev = changeid |
|
389 | 389 | return |
|
390 | 390 | if isinstance(changeid, long): |
|
391 | 391 | changeid = str(changeid) |
|
392 | 392 | if changeid == 'null': |
|
393 | 393 | self._node = nullid |
|
394 | 394 | self._rev = nullrev |
|
395 | 395 | return |
|
396 | 396 | if changeid == 'tip': |
|
397 | 397 | self._node = repo.changelog.tip() |
|
398 | 398 | self._rev = repo.changelog.rev(self._node) |
|
399 | 399 | return |
|
400 | 400 | if changeid == '.' or changeid == repo.dirstate.p1(): |
|
401 | 401 | # this is a hack to delay/avoid loading obsmarkers |
|
402 | 402 | # when we know that '.' won't be hidden |
|
403 | 403 | self._node = repo.dirstate.p1() |
|
404 | 404 | self._rev = repo.unfiltered().changelog.rev(self._node) |
|
405 | 405 | return |
|
406 | 406 | if len(changeid) == 20: |
|
407 | 407 | try: |
|
408 | 408 | self._node = changeid |
|
409 | 409 | self._rev = repo.changelog.rev(changeid) |
|
410 | 410 | return |
|
411 | 411 | except error.FilteredRepoLookupError: |
|
412 | 412 | raise |
|
413 | 413 | except LookupError: |
|
414 | 414 | pass |
|
415 | 415 | |
|
416 | 416 | try: |
|
417 | 417 | r = int(changeid) |
|
418 | 418 | if str(r) != changeid: |
|
419 | 419 | raise ValueError |
|
420 | 420 | l = len(repo.changelog) |
|
421 | 421 | if r < 0: |
|
422 | 422 | r += l |
|
423 | 423 | if r < 0 or r >= l: |
|
424 | 424 | raise ValueError |
|
425 | 425 | self._rev = r |
|
426 | 426 | self._node = repo.changelog.node(r) |
|
427 | 427 | return |
|
428 | 428 | except error.FilteredIndexError: |
|
429 | 429 | raise |
|
430 | 430 | except (ValueError, OverflowError, IndexError): |
|
431 | 431 | pass |
|
432 | 432 | |
|
433 | 433 | if len(changeid) == 40: |
|
434 | 434 | try: |
|
435 | 435 | self._node = bin(changeid) |
|
436 | 436 | self._rev = repo.changelog.rev(self._node) |
|
437 | 437 | return |
|
438 | 438 | except error.FilteredLookupError: |
|
439 | 439 | raise |
|
440 | 440 | except (TypeError, LookupError): |
|
441 | 441 | pass |
|
442 | 442 | |
|
443 | 443 | # lookup bookmarks through the name interface |
|
444 | 444 | try: |
|
445 | 445 | self._node = repo.names.singlenode(repo, changeid) |
|
446 | 446 | self._rev = repo.changelog.rev(self._node) |
|
447 | 447 | return |
|
448 | 448 | except KeyError: |
|
449 | 449 | pass |
|
450 | 450 | except error.FilteredRepoLookupError: |
|
451 | 451 | raise |
|
452 | 452 | except error.RepoLookupError: |
|
453 | 453 | pass |
|
454 | 454 | |
|
455 | 455 | self._node = repo.unfiltered().changelog._partialmatch(changeid) |
|
456 | 456 | if self._node is not None: |
|
457 | 457 | self._rev = repo.changelog.rev(self._node) |
|
458 | 458 | return |
|
459 | 459 | |
|
460 | 460 | # lookup failed |
|
461 | 461 | # check if it might have come from damaged dirstate |
|
462 | 462 | # |
|
463 | 463 | # XXX we could avoid the unfiltered if we had a recognizable |
|
464 | 464 | # exception for filtered changeset access |
|
465 | 465 | if changeid in repo.unfiltered().dirstate.parents(): |
|
466 | 466 | msg = _("working directory has unknown parent '%s'!") |
|
467 | 467 | raise error.Abort(msg % short(changeid)) |
|
468 | 468 | try: |
|
469 | 469 | if len(changeid) == 20: |
|
470 | 470 | changeid = hex(changeid) |
|
471 | 471 | except TypeError: |
|
472 | 472 | pass |
|
473 | 473 | except (error.FilteredIndexError, error.FilteredLookupError, |
|
474 | 474 | error.FilteredRepoLookupError): |
|
475 | 475 | if repo.filtername.startswith('visible'): |
|
476 | 476 | msg = _("hidden revision '%s'") % changeid |
|
477 | 477 | hint = _('use --hidden to access hidden revisions') |
|
478 | 478 | raise error.FilteredRepoLookupError(msg, hint=hint) |
|
479 | 479 | msg = _("filtered revision '%s' (not in '%s' subset)") |
|
480 | 480 | msg %= (changeid, repo.filtername) |
|
481 | 481 | raise error.FilteredRepoLookupError(msg) |
|
482 | 482 | except IndexError: |
|
483 | 483 | pass |
|
484 | 484 | raise error.RepoLookupError( |
|
485 | 485 | _("unknown revision '%s'") % changeid) |
|
486 | 486 | |
|
487 | 487 | def __hash__(self): |
|
488 | 488 | try: |
|
489 | 489 | return hash(self._rev) |
|
490 | 490 | except AttributeError: |
|
491 | 491 | return id(self) |
|
492 | 492 | |
|
493 | 493 | def __nonzero__(self): |
|
494 | 494 | return self._rev != nullrev |
|
495 | 495 | |
|
496 | 496 | @propertycache |
|
497 | 497 | def _changeset(self): |
|
498 | 498 | return self._repo.changelog.read(self.rev()) |
|
499 | 499 | |
|
500 | 500 | @propertycache |
|
501 | 501 | def _manifest(self): |
|
502 | 502 | return self._repo.manifest.read(self._changeset[0]) |
|
503 | 503 | |
|
504 | 504 | @propertycache |
|
505 | 505 | def _manifestdelta(self): |
|
506 | 506 | return self._repo.manifest.readdelta(self._changeset[0]) |
|
507 | 507 | |
|
508 | 508 | @propertycache |
|
509 | 509 | def _parents(self): |
|
510 | 510 | p = self._repo.changelog.parentrevs(self._rev) |
|
511 | 511 | if p[1] == nullrev: |
|
512 | 512 | p = p[:-1] |
|
513 | 513 | return [changectx(self._repo, x) for x in p] |
|
514 | 514 | |
|
515 | 515 | def changeset(self): |
|
516 | 516 | return self._changeset |
|
517 | 517 | def manifestnode(self): |
|
518 | 518 | return self._changeset[0] |
|
519 | 519 | |
|
520 | 520 | def user(self): |
|
521 | 521 | return self._changeset[1] |
|
522 | 522 | def date(self): |
|
523 | 523 | return self._changeset[2] |
|
524 | 524 | def files(self): |
|
525 | 525 | return self._changeset[3] |
|
526 | 526 | def description(self): |
|
527 | 527 | return self._changeset[4] |
|
528 | 528 | def branch(self): |
|
529 | 529 | return encoding.tolocal(self._changeset[5].get("branch")) |
|
530 | 530 | def closesbranch(self): |
|
531 | 531 | return 'close' in self._changeset[5] |
|
532 | 532 | def extra(self): |
|
533 | 533 | return self._changeset[5] |
|
534 | 534 | def tags(self): |
|
535 | 535 | return self._repo.nodetags(self._node) |
|
536 | 536 | def bookmarks(self): |
|
537 | 537 | return self._repo.nodebookmarks(self._node) |
|
538 | 538 | def phase(self): |
|
539 | 539 | return self._repo._phasecache.phase(self._repo, self._rev) |
|
540 | 540 | def hidden(self): |
|
541 | 541 | return self._rev in repoview.filterrevs(self._repo, 'visible') |
|
542 | 542 | |
|
543 | 543 | def children(self): |
|
544 | 544 | """return contexts for each child changeset""" |
|
545 | 545 | c = self._repo.changelog.children(self._node) |
|
546 | 546 | return [changectx(self._repo, x) for x in c] |
|
547 | 547 | |
|
548 | 548 | def ancestors(self): |
|
549 | 549 | for a in self._repo.changelog.ancestors([self._rev]): |
|
550 | 550 | yield changectx(self._repo, a) |
|
551 | 551 | |
|
552 | 552 | def descendants(self): |
|
553 | 553 | for d in self._repo.changelog.descendants([self._rev]): |
|
554 | 554 | yield changectx(self._repo, d) |
|
555 | 555 | |
|
556 | 556 | def filectx(self, path, fileid=None, filelog=None): |
|
557 | 557 | """get a file context from this changeset""" |
|
558 | 558 | if fileid is None: |
|
559 | 559 | fileid = self.filenode(path) |
|
560 | 560 | return filectx(self._repo, path, fileid=fileid, |
|
561 | 561 | changectx=self, filelog=filelog) |
|
562 | 562 | |
|
563 | 563 | def ancestor(self, c2, warn=False): |
|
564 | 564 | """return the "best" ancestor context of self and c2 |
|
565 | 565 | |
|
566 | 566 | If there are multiple candidates, it will show a message and check |
|
567 | 567 | merge.preferancestor configuration before falling back to the |
|
568 | 568 | revlog ancestor.""" |
|
569 | 569 | # deal with workingctxs |
|
570 | 570 | n2 = c2._node |
|
571 | 571 | if n2 is None: |
|
572 | 572 | n2 = c2._parents[0]._node |
|
573 | 573 | cahs = self._repo.changelog.commonancestorsheads(self._node, n2) |
|
574 | 574 | if not cahs: |
|
575 | 575 | anc = nullid |
|
576 | 576 | elif len(cahs) == 1: |
|
577 | 577 | anc = cahs[0] |
|
578 | 578 | else: |
|
579 | 579 | for r in self._repo.ui.configlist('merge', 'preferancestor'): |
|
580 | 580 | try: |
|
581 | 581 | ctx = changectx(self._repo, r) |
|
582 | 582 | except error.RepoLookupError: |
|
583 | 583 | continue |
|
584 | 584 | anc = ctx.node() |
|
585 | 585 | if anc in cahs: |
|
586 | 586 | break |
|
587 | 587 | else: |
|
588 | 588 | anc = self._repo.changelog.ancestor(self._node, n2) |
|
589 | 589 | if warn: |
|
590 | 590 | self._repo.ui.status( |
|
591 | 591 | (_("note: using %s as ancestor of %s and %s\n") % |
|
592 | 592 | (short(anc), short(self._node), short(n2))) + |
|
593 | 593 | ''.join(_(" alternatively, use --config " |
|
594 | 594 | "merge.preferancestor=%s\n") % |
|
595 | 595 | short(n) for n in sorted(cahs) if n != anc)) |
|
596 | 596 | return changectx(self._repo, anc) |
|
597 | 597 | |
|
598 | 598 | def descendant(self, other): |
|
599 | 599 | """True if other is descendant of this changeset""" |
|
600 | 600 | return self._repo.changelog.descendant(self._rev, other._rev) |
|
601 | 601 | |
|
602 | 602 | def walk(self, match): |
|
603 | 603 | '''Generates matching file names.''' |
|
604 | 604 | |
|
605 | 605 | # Wrap match.bad method to have message with nodeid |
|
606 | 606 | def bad(fn, msg): |
|
607 | 607 | # The manifest doesn't know about subrepos, so don't complain about |
|
608 | 608 | # paths into valid subrepos. |
|
609 | 609 | if any(fn == s or fn.startswith(s + '/') |
|
610 | 610 | for s in self.substate): |
|
611 | 611 | return |
|
612 | 612 | match.bad(fn, _('no such file in rev %s') % self) |
|
613 | 613 | |
|
614 | 614 | m = matchmod.badmatch(match, bad) |
|
615 | 615 | return self._manifest.walk(m) |
|
616 | 616 | |
|
617 | 617 | def matches(self, match): |
|
618 | 618 | return self.walk(match) |
|
619 | 619 | |
|
620 | 620 | class basefilectx(object): |
|
621 | 621 | """A filecontext object represents the common logic for its children: |
|
622 | 622 | filectx: read-only access to a filerevision that is already present |
|
623 | 623 | in the repo, |
|
624 | 624 | workingfilectx: a filecontext that represents files from the working |
|
625 | 625 | directory, |
|
626 | 626 | memfilectx: a filecontext that represents files in-memory.""" |
|
627 | 627 | def __new__(cls, repo, path, *args, **kwargs): |
|
628 | 628 | return super(basefilectx, cls).__new__(cls) |
|
629 | 629 | |
|
630 | 630 | @propertycache |
|
631 | 631 | def _filelog(self): |
|
632 | 632 | return self._repo.file(self._path) |
|
633 | 633 | |
|
634 | 634 | @propertycache |
|
635 | 635 | def _changeid(self): |
|
636 | 636 | if '_changeid' in self.__dict__: |
|
637 | 637 | return self._changeid |
|
638 | 638 | elif '_changectx' in self.__dict__: |
|
639 | 639 | return self._changectx.rev() |
|
640 | 640 | elif '_descendantrev' in self.__dict__: |
|
641 | 641 | # this file context was created from a revision with a known |
|
642 | 642 | # descendant, we can (lazily) correct for linkrev aliases |
|
643 | 643 | return self._adjustlinkrev(self._path, self._filelog, |
|
644 | 644 | self._filenode, self._descendantrev) |
|
645 | 645 | else: |
|
646 | 646 | return self._filelog.linkrev(self._filerev) |
|
647 | 647 | |
|
648 | 648 | @propertycache |
|
649 | 649 | def _filenode(self): |
|
650 | 650 | if '_fileid' in self.__dict__: |
|
651 | 651 | return self._filelog.lookup(self._fileid) |
|
652 | 652 | else: |
|
653 | 653 | return self._changectx.filenode(self._path) |
|
654 | 654 | |
|
655 | 655 | @propertycache |
|
656 | 656 | def _filerev(self): |
|
657 | 657 | return self._filelog.rev(self._filenode) |
|
658 | 658 | |
|
659 | 659 | @propertycache |
|
660 | 660 | def _repopath(self): |
|
661 | 661 | return self._path |
|
662 | 662 | |
|
663 | 663 | def __nonzero__(self): |
|
664 | 664 | try: |
|
665 | 665 | self._filenode |
|
666 | 666 | return True |
|
667 | 667 | except error.LookupError: |
|
668 | 668 | # file is missing |
|
669 | 669 | return False |
|
670 | 670 | |
|
671 | 671 | def __str__(self): |
|
672 | 672 | return "%s@%s" % (self.path(), self._changectx) |
|
673 | 673 | |
|
674 | 674 | def __repr__(self): |
|
675 | 675 | return "<%s %s>" % (type(self).__name__, str(self)) |
|
676 | 676 | |
|
677 | 677 | def __hash__(self): |
|
678 | 678 | try: |
|
679 | 679 | return hash((self._path, self._filenode)) |
|
680 | 680 | except AttributeError: |
|
681 | 681 | return id(self) |
|
682 | 682 | |
|
683 | 683 | def __eq__(self, other): |
|
684 | 684 | try: |
|
685 | 685 | return (type(self) == type(other) and self._path == other._path |
|
686 | 686 | and self._filenode == other._filenode) |
|
687 | 687 | except AttributeError: |
|
688 | 688 | return False |
|
689 | 689 | |
|
690 | 690 | def __ne__(self, other): |
|
691 | 691 | return not (self == other) |
|
692 | 692 | |
|
693 | 693 | def filerev(self): |
|
694 | 694 | return self._filerev |
|
695 | 695 | def filenode(self): |
|
696 | 696 | return self._filenode |
|
697 | 697 | def flags(self): |
|
698 | 698 | return self._changectx.flags(self._path) |
|
699 | 699 | def filelog(self): |
|
700 | 700 | return self._filelog |
|
701 | 701 | def rev(self): |
|
702 | 702 | return self._changeid |
|
703 | 703 | def linkrev(self): |
|
704 | 704 | return self._filelog.linkrev(self._filerev) |
|
705 | 705 | def node(self): |
|
706 | 706 | return self._changectx.node() |
|
707 | 707 | def hex(self): |
|
708 | 708 | return self._changectx.hex() |
|
709 | 709 | def user(self): |
|
710 | 710 | return self._changectx.user() |
|
711 | 711 | def date(self): |
|
712 | 712 | return self._changectx.date() |
|
713 | 713 | def files(self): |
|
714 | 714 | return self._changectx.files() |
|
715 | 715 | def description(self): |
|
716 | 716 | return self._changectx.description() |
|
717 | 717 | def branch(self): |
|
718 | 718 | return self._changectx.branch() |
|
719 | 719 | def extra(self): |
|
720 | 720 | return self._changectx.extra() |
|
721 | 721 | def phase(self): |
|
722 | 722 | return self._changectx.phase() |
|
723 | 723 | def phasestr(self): |
|
724 | 724 | return self._changectx.phasestr() |
|
725 | 725 | def manifest(self): |
|
726 | 726 | return self._changectx.manifest() |
|
727 | 727 | def changectx(self): |
|
728 | 728 | return self._changectx |
|
729 | 729 | def repo(self): |
|
730 | 730 | return self._repo |
|
731 | 731 | |
|
732 | 732 | def path(self): |
|
733 | 733 | return self._path |
|
734 | 734 | |
|
735 | 735 | def isbinary(self): |
|
736 | 736 | try: |
|
737 | 737 | return util.binary(self.data()) |
|
738 | 738 | except IOError: |
|
739 | 739 | return False |
|
740 | 740 | def isexec(self): |
|
741 | 741 | return 'x' in self.flags() |
|
742 | 742 | def islink(self): |
|
743 | 743 | return 'l' in self.flags() |
|
744 | 744 | |
|
745 | 745 | def cmp(self, fctx): |
|
746 | 746 | """compare with other file context |
|
747 | 747 | |
|
748 | 748 | returns True if different than fctx. |
|
749 | 749 | """ |
|
750 | 750 | if (fctx._filerev is None |
|
751 | 751 | and (self._repo._encodefilterpats |
|
752 | 752 | # if file data starts with '\1\n', empty metadata block is |
|
753 | 753 | # prepended, which adds 4 bytes to filelog.size(). |
|
754 | 754 | or self.size() - 4 == fctx.size()) |
|
755 | 755 | or self.size() == fctx.size()): |
|
756 | 756 | return self._filelog.cmp(self._filenode, fctx.data()) |
|
757 | 757 | |
|
758 | 758 | return True |
|
759 | 759 | |
|
760 | 760 | def _adjustlinkrev(self, path, filelog, fnode, srcrev, inclusive=False): |
|
761 | 761 | """return the first ancestor of <srcrev> introducing <fnode> |
|
762 | 762 | |
|
763 | 763 | If the linkrev of the file revision does not point to an ancestor of |
|
764 | 764 | srcrev, we'll walk down the ancestors until we find one introducing |
|
765 | 765 | this file revision. |
|
766 | 766 | |
|
767 | 767 | :repo: a localrepository object (used to access changelog and manifest) |
|
768 | 768 | :path: the file path |
|
769 | 769 | :fnode: the nodeid of the file revision |
|
770 | 770 | :filelog: the filelog of this path |
|
771 | 771 | :srcrev: the changeset revision we search ancestors from |
|
772 | 772 | :inclusive: if true, the src revision will also be checked |
|
773 | 773 | """ |
|
774 | 774 | repo = self._repo |
|
775 | 775 | cl = repo.unfiltered().changelog |
|
776 | 776 | ma = repo.manifest |
|
777 | 777 | # fetch the linkrev |
|
778 | 778 | fr = filelog.rev(fnode) |
|
779 | 779 | lkr = filelog.linkrev(fr) |
|
780 | 780 | # hack to reuse ancestor computation when searching for renames |
|
781 | 781 | memberanc = getattr(self, '_ancestrycontext', None) |
|
782 | 782 | iteranc = None |
|
783 | 783 | if srcrev is None: |
|
784 | 784 | # wctx case, used by workingfilectx during mergecopy |
|
785 | 785 | revs = [p.rev() for p in self._repo[None].parents()] |
|
786 | 786 | inclusive = True # we skipped the real (revless) source |
|
787 | 787 | else: |
|
788 | 788 | revs = [srcrev] |
|
789 | 789 | if memberanc is None: |
|
790 | 790 | memberanc = iteranc = cl.ancestors(revs, lkr, |
|
791 | 791 | inclusive=inclusive) |
|
792 | 792 | # check if this linkrev is an ancestor of srcrev |
|
793 | 793 | if lkr not in memberanc: |
|
794 | 794 | if iteranc is None: |
|
795 | 795 | iteranc = cl.ancestors(revs, lkr, inclusive=inclusive) |
|
796 | 796 | for a in iteranc: |
|
797 | 797 | ac = cl.read(a) # get changeset data (we avoid object creation) |
|
798 | 798 | if path in ac[3]: # checking the 'files' field. |
|
799 | 799 | # The file has been touched, check if the content is |
|
800 | 800 | # similar to the one we search for. |
|
801 | 801 | if fnode == ma.readfast(ac[0]).get(path): |
|
802 | 802 | return a |
|
803 | 803 | # In theory, we should never get out of that loop without a result. |
|
804 | 804 | # But if manifest uses a buggy file revision (not children of the |
|
805 | 805 | # one it replaces) we could. Such a buggy situation will likely |
|
806 | 806 | # result is crash somewhere else at to some point. |
|
807 | 807 | return lkr |
|
808 | 808 | |
|
809 | 809 | def introrev(self): |
|
810 | 810 | """return the rev of the changeset which introduced this file revision |
|
811 | 811 | |
|
812 | 812 | This method is different from linkrev because it take into account the |
|
813 | 813 | changeset the filectx was created from. It ensures the returned |
|
814 | 814 | revision is one of its ancestors. This prevents bugs from |
|
815 | 815 | 'linkrev-shadowing' when a file revision is used by multiple |
|
816 | 816 | changesets. |
|
817 | 817 | """ |
|
818 | 818 | lkr = self.linkrev() |
|
819 | 819 | attrs = vars(self) |
|
820 | 820 | noctx = not ('_changeid' in attrs or '_changectx' in attrs) |
|
821 | 821 | if noctx or self.rev() == lkr: |
|
822 | 822 | return self.linkrev() |
|
823 | 823 | return self._adjustlinkrev(self._path, self._filelog, self._filenode, |
|
824 | 824 | self.rev(), inclusive=True) |
|
825 | 825 | |
|
826 | 826 | def _parentfilectx(self, path, fileid, filelog): |
|
827 | 827 | """create parent filectx keeping ancestry info for _adjustlinkrev()""" |
|
828 | 828 | fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog) |
|
829 | 829 | if '_changeid' in vars(self) or '_changectx' in vars(self): |
|
830 | 830 | # If self is associated with a changeset (probably explicitly |
|
831 | 831 | # fed), ensure the created filectx is associated with a |
|
832 | 832 | # changeset that is an ancestor of self.changectx. |
|
833 | 833 | # This lets us later use _adjustlinkrev to get a correct link. |
|
834 | 834 | fctx._descendantrev = self.rev() |
|
835 | 835 | fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) |
|
836 | 836 | elif '_descendantrev' in vars(self): |
|
837 | 837 | # Otherwise propagate _descendantrev if we have one associated. |
|
838 | 838 | fctx._descendantrev = self._descendantrev |
|
839 | 839 | fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) |
|
840 | 840 | return fctx |
|
841 | 841 | |
|
842 | 842 | def parents(self): |
|
843 | 843 | _path = self._path |
|
844 | 844 | fl = self._filelog |
|
845 | 845 | parents = self._filelog.parents(self._filenode) |
|
846 | 846 | pl = [(_path, node, fl) for node in parents if node != nullid] |
|
847 | 847 | |
|
848 | 848 | r = fl.renamed(self._filenode) |
|
849 | 849 | if r: |
|
850 | 850 | # - In the simple rename case, both parent are nullid, pl is empty. |
|
851 | 851 | # - In case of merge, only one of the parent is null id and should |
|
852 | 852 | # be replaced with the rename information. This parent is -always- |
|
853 | 853 | # the first one. |
|
854 | 854 | # |
|
855 | 855 | # As null id have always been filtered out in the previous list |
|
856 | 856 | # comprehension, inserting to 0 will always result in "replacing |
|
857 | 857 | # first nullid parent with rename information. |
|
858 | 858 | pl.insert(0, (r[0], r[1], self._repo.file(r[0]))) |
|
859 | 859 | |
|
860 | 860 | return [self._parentfilectx(path, fnode, l) for path, fnode, l in pl] |
|
861 | 861 | |
|
862 | 862 | def p1(self): |
|
863 | 863 | return self.parents()[0] |
|
864 | 864 | |
|
865 | 865 | def p2(self): |
|
866 | 866 | p = self.parents() |
|
867 | 867 | if len(p) == 2: |
|
868 | 868 | return p[1] |
|
869 | 869 | return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog) |
|
870 | 870 | |
|
871 | 871 | def annotate(self, follow=False, linenumber=None, diffopts=None): |
|
872 | 872 | '''returns a list of tuples of (ctx, line) for each line |
|
873 | 873 | in the file, where ctx is the filectx of the node where |
|
874 | 874 | that line was last changed. |
|
875 | 875 | This returns tuples of ((ctx, linenumber), line) for each line, |
|
876 | 876 | if "linenumber" parameter is NOT "None". |
|
877 | 877 | In such tuples, linenumber means one at the first appearance |
|
878 | 878 | in the managed file. |
|
879 | 879 | To reduce annotation cost, |
|
880 | 880 | this returns fixed value(False is used) as linenumber, |
|
881 | 881 | if "linenumber" parameter is "False".''' |
|
882 | 882 | |
|
883 | 883 | if linenumber is None: |
|
884 | 884 | def decorate(text, rev): |
|
885 | 885 | return ([rev] * len(text.splitlines()), text) |
|
886 | 886 | elif linenumber: |
|
887 | 887 | def decorate(text, rev): |
|
888 | 888 | size = len(text.splitlines()) |
|
889 | 889 | return ([(rev, i) for i in xrange(1, size + 1)], text) |
|
890 | 890 | else: |
|
891 | 891 | def decorate(text, rev): |
|
892 | 892 | return ([(rev, False)] * len(text.splitlines()), text) |
|
893 | 893 | |
|
894 | 894 | def pair(parent, child): |
|
895 | 895 | blocks = mdiff.allblocks(parent[1], child[1], opts=diffopts, |
|
896 | 896 | refine=True) |
|
897 | 897 | for (a1, a2, b1, b2), t in blocks: |
|
898 | 898 | # Changed blocks ('!') or blocks made only of blank lines ('~') |
|
899 | 899 | # belong to the child. |
|
900 | 900 | if t == '=': |
|
901 | 901 | child[0][b1:b2] = parent[0][a1:a2] |
|
902 | 902 | return child |
|
903 | 903 | |
|
904 | 904 | getlog = util.lrucachefunc(lambda x: self._repo.file(x)) |
|
905 | 905 | |
|
906 | 906 | def parents(f): |
|
907 | 907 | # Cut _descendantrev here to mitigate the penalty of lazy linkrev |
|
908 | 908 | # adjustment. Otherwise, p._adjustlinkrev() would walk changelog |
|
909 | 909 | # from the topmost introrev (= srcrev) down to p.linkrev() if it |
|
910 | 910 | # isn't an ancestor of the srcrev. |
|
911 | 911 | f._changeid |
|
912 | 912 | pl = f.parents() |
|
913 | 913 | |
|
914 | 914 | # Don't return renamed parents if we aren't following. |
|
915 | 915 | if not follow: |
|
916 | 916 | pl = [p for p in pl if p.path() == f.path()] |
|
917 | 917 | |
|
918 | 918 | # renamed filectx won't have a filelog yet, so set it |
|
919 | 919 | # from the cache to save time |
|
920 | 920 | for p in pl: |
|
921 | 921 | if not '_filelog' in p.__dict__: |
|
922 | 922 | p._filelog = getlog(p.path()) |
|
923 | 923 | |
|
924 | 924 | return pl |
|
925 | 925 | |
|
926 | 926 | # use linkrev to find the first changeset where self appeared |
|
927 | 927 | base = self |
|
928 | 928 | introrev = self.introrev() |
|
929 | 929 | if self.rev() != introrev: |
|
930 | 930 | base = self.filectx(self.filenode(), changeid=introrev) |
|
931 | 931 | if getattr(base, '_ancestrycontext', None) is None: |
|
932 | 932 | cl = self._repo.changelog |
|
933 | 933 | if introrev is None: |
|
934 | 934 | # wctx is not inclusive, but works because _ancestrycontext |
|
935 | 935 | # is used to test filelog revisions |
|
936 | 936 | ac = cl.ancestors([p.rev() for p in base.parents()], |
|
937 | 937 | inclusive=True) |
|
938 | 938 | else: |
|
939 | 939 | ac = cl.ancestors([introrev], inclusive=True) |
|
940 | 940 | base._ancestrycontext = ac |
|
941 | 941 | |
|
942 | 942 | # This algorithm would prefer to be recursive, but Python is a |
|
943 | 943 | # bit recursion-hostile. Instead we do an iterative |
|
944 | 944 | # depth-first search. |
|
945 | 945 | |
|
946 | 946 | visit = [base] |
|
947 | 947 | hist = {} |
|
948 | 948 | pcache = {} |
|
949 | 949 | needed = {base: 1} |
|
950 | 950 | while visit: |
|
951 | 951 | f = visit[-1] |
|
952 | 952 | pcached = f in pcache |
|
953 | 953 | if not pcached: |
|
954 | 954 | pcache[f] = parents(f) |
|
955 | 955 | |
|
956 | 956 | ready = True |
|
957 | 957 | pl = pcache[f] |
|
958 | 958 | for p in pl: |
|
959 | 959 | if p not in hist: |
|
960 | 960 | ready = False |
|
961 | 961 | visit.append(p) |
|
962 | 962 | if not pcached: |
|
963 | 963 | needed[p] = needed.get(p, 0) + 1 |
|
964 | 964 | if ready: |
|
965 | 965 | visit.pop() |
|
966 | 966 | reusable = f in hist |
|
967 | 967 | if reusable: |
|
968 | 968 | curr = hist[f] |
|
969 | 969 | else: |
|
970 | 970 | curr = decorate(f.data(), f) |
|
971 | 971 | for p in pl: |
|
972 | 972 | if not reusable: |
|
973 | 973 | curr = pair(hist[p], curr) |
|
974 | 974 | if needed[p] == 1: |
|
975 | 975 | del hist[p] |
|
976 | 976 | del needed[p] |
|
977 | 977 | else: |
|
978 | 978 | needed[p] -= 1 |
|
979 | 979 | |
|
980 | 980 | hist[f] = curr |
|
981 | 981 | pcache[f] = [] |
|
982 | 982 | |
|
983 | 983 | return zip(hist[base][0], hist[base][1].splitlines(True)) |
|
984 | 984 | |
|
985 | 985 | def ancestors(self, followfirst=False): |
|
986 | 986 | visit = {} |
|
987 | 987 | c = self |
|
988 | 988 | if followfirst: |
|
989 | 989 | cut = 1 |
|
990 | 990 | else: |
|
991 | 991 | cut = None |
|
992 | 992 | |
|
993 | 993 | while True: |
|
994 | 994 | for parent in c.parents()[:cut]: |
|
995 | 995 | visit[(parent.linkrev(), parent.filenode())] = parent |
|
996 | 996 | if not visit: |
|
997 | 997 | break |
|
998 | 998 | c = visit.pop(max(visit)) |
|
999 | 999 | yield c |
|
1000 | 1000 | |
|
1001 | 1001 | class filectx(basefilectx): |
|
1002 | 1002 | """A filecontext object makes access to data related to a particular |
|
1003 | 1003 | filerevision convenient.""" |
|
1004 | 1004 | def __init__(self, repo, path, changeid=None, fileid=None, |
|
1005 | 1005 | filelog=None, changectx=None): |
|
1006 | 1006 | """changeid can be a changeset revision, node, or tag. |
|
1007 | 1007 | fileid can be a file revision or node.""" |
|
1008 | 1008 | self._repo = repo |
|
1009 | 1009 | self._path = path |
|
1010 | 1010 | |
|
1011 | 1011 | assert (changeid is not None |
|
1012 | 1012 | or fileid is not None |
|
1013 | 1013 | or changectx is not None), \ |
|
1014 | 1014 | ("bad args: changeid=%r, fileid=%r, changectx=%r" |
|
1015 | 1015 | % (changeid, fileid, changectx)) |
|
1016 | 1016 | |
|
1017 | 1017 | if filelog is not None: |
|
1018 | 1018 | self._filelog = filelog |
|
1019 | 1019 | |
|
1020 | 1020 | if changeid is not None: |
|
1021 | 1021 | self._changeid = changeid |
|
1022 | 1022 | if changectx is not None: |
|
1023 | 1023 | self._changectx = changectx |
|
1024 | 1024 | if fileid is not None: |
|
1025 | 1025 | self._fileid = fileid |
|
1026 | 1026 | |
|
1027 | 1027 | @propertycache |
|
1028 | 1028 | def _changectx(self): |
|
1029 | 1029 | try: |
|
1030 | 1030 | return changectx(self._repo, self._changeid) |
|
1031 | 1031 | except error.FilteredRepoLookupError: |
|
1032 | 1032 | # Linkrev may point to any revision in the repository. When the |
|
1033 | 1033 | # repository is filtered this may lead to `filectx` trying to build |
|
1034 | 1034 | # `changectx` for filtered revision. In such case we fallback to |
|
1035 | 1035 | # creating `changectx` on the unfiltered version of the reposition. |
|
1036 | 1036 | # This fallback should not be an issue because `changectx` from |
|
1037 | 1037 | # `filectx` are not used in complex operations that care about |
|
1038 | 1038 | # filtering. |
|
1039 | 1039 | # |
|
1040 | 1040 | # This fallback is a cheap and dirty fix that prevent several |
|
1041 | 1041 | # crashes. It does not ensure the behavior is correct. However the |
|
1042 | 1042 | # behavior was not correct before filtering either and "incorrect |
|
1043 | 1043 | # behavior" is seen as better as "crash" |
|
1044 | 1044 | # |
|
1045 | 1045 | # Linkrevs have several serious troubles with filtering that are |
|
1046 | 1046 | # complicated to solve. Proper handling of the issue here should be |
|
1047 | 1047 | # considered when solving linkrev issue are on the table. |
|
1048 | 1048 | return changectx(self._repo.unfiltered(), self._changeid) |
|
1049 | 1049 | |
|
1050 | 1050 | def filectx(self, fileid, changeid=None): |
|
1051 | 1051 | '''opens an arbitrary revision of the file without |
|
1052 | 1052 | opening a new filelog''' |
|
1053 | 1053 | return filectx(self._repo, self._path, fileid=fileid, |
|
1054 | 1054 | filelog=self._filelog, changeid=changeid) |
|
1055 | 1055 | |
|
1056 | 1056 | def data(self): |
|
1057 | 1057 | try: |
|
1058 | 1058 | return self._filelog.read(self._filenode) |
|
1059 | 1059 | except error.CensoredNodeError: |
|
1060 | 1060 | if self._repo.ui.config("censor", "policy", "abort") == "ignore": |
|
1061 | 1061 | return "" |
|
1062 | 1062 | raise util.Abort(_("censored node: %s") % short(self._filenode), |
|
1063 | 1063 | hint=_("set censor.policy to ignore errors")) |
|
1064 | 1064 | |
|
1065 | 1065 | def size(self): |
|
1066 | 1066 | return self._filelog.size(self._filerev) |
|
1067 | 1067 | |
|
1068 | 1068 | def renamed(self): |
|
1069 | 1069 | """check if file was actually renamed in this changeset revision |
|
1070 | 1070 | |
|
1071 | 1071 | If rename logged in file revision, we report copy for changeset only |
|
1072 | 1072 | if file revisions linkrev points back to the changeset in question |
|
1073 | 1073 | or both changeset parents contain different file revisions. |
|
1074 | 1074 | """ |
|
1075 | 1075 | |
|
1076 | 1076 | renamed = self._filelog.renamed(self._filenode) |
|
1077 | 1077 | if not renamed: |
|
1078 | 1078 | return renamed |
|
1079 | 1079 | |
|
1080 | 1080 | if self.rev() == self.linkrev(): |
|
1081 | 1081 | return renamed |
|
1082 | 1082 | |
|
1083 | 1083 | name = self.path() |
|
1084 | 1084 | fnode = self._filenode |
|
1085 | 1085 | for p in self._changectx.parents(): |
|
1086 | 1086 | try: |
|
1087 | 1087 | if fnode == p.filenode(name): |
|
1088 | 1088 | return None |
|
1089 | 1089 | except error.LookupError: |
|
1090 | 1090 | pass |
|
1091 | 1091 | return renamed |
|
1092 | 1092 | |
|
1093 | 1093 | def children(self): |
|
1094 | 1094 | # hard for renames |
|
1095 | 1095 | c = self._filelog.children(self._filenode) |
|
1096 | 1096 | return [filectx(self._repo, self._path, fileid=x, |
|
1097 | 1097 | filelog=self._filelog) for x in c] |
|
1098 | 1098 | |
|
1099 | 1099 | class committablectx(basectx): |
|
1100 | 1100 | """A committablectx object provides common functionality for a context that |
|
1101 | 1101 | wants the ability to commit, e.g. workingctx or memctx.""" |
|
1102 | 1102 | def __init__(self, repo, text="", user=None, date=None, extra=None, |
|
1103 | 1103 | changes=None): |
|
1104 | 1104 | self._repo = repo |
|
1105 | 1105 | self._rev = None |
|
1106 | 1106 | self._node = None |
|
1107 | 1107 | self._text = text |
|
1108 | 1108 | if date: |
|
1109 | 1109 | self._date = util.parsedate(date) |
|
1110 | 1110 | if user: |
|
1111 | 1111 | self._user = user |
|
1112 | 1112 | if changes: |
|
1113 | 1113 | self._status = changes |
|
1114 | 1114 | |
|
1115 | 1115 | self._extra = {} |
|
1116 | 1116 | if extra: |
|
1117 | 1117 | self._extra = extra.copy() |
|
1118 | 1118 | if 'branch' not in self._extra: |
|
1119 | 1119 | try: |
|
1120 | 1120 | branch = encoding.fromlocal(self._repo.dirstate.branch()) |
|
1121 | 1121 | except UnicodeDecodeError: |
|
1122 | 1122 | raise util.Abort(_('branch name not in UTF-8!')) |
|
1123 | 1123 | self._extra['branch'] = branch |
|
1124 | 1124 | if self._extra['branch'] == '': |
|
1125 | 1125 | self._extra['branch'] = 'default' |
|
1126 | 1126 | |
|
1127 | 1127 | def __str__(self): |
|
1128 | 1128 | return str(self._parents[0]) + "+" |
|
1129 | 1129 | |
|
1130 | 1130 | def __nonzero__(self): |
|
1131 | 1131 | return True |
|
1132 | 1132 | |
|
1133 | 1133 | def _buildflagfunc(self): |
|
1134 | 1134 | # Create a fallback function for getting file flags when the |
|
1135 | 1135 | # filesystem doesn't support them |
|
1136 | 1136 | |
|
1137 | 1137 | copiesget = self._repo.dirstate.copies().get |
|
1138 | 1138 | |
|
1139 | 1139 | if len(self._parents) < 2: |
|
1140 | 1140 | # when we have one parent, it's easy: copy from parent |
|
1141 | 1141 | man = self._parents[0].manifest() |
|
1142 | 1142 | def func(f): |
|
1143 | 1143 | f = copiesget(f, f) |
|
1144 | 1144 | return man.flags(f) |
|
1145 | 1145 | else: |
|
1146 | 1146 | # merges are tricky: we try to reconstruct the unstored |
|
1147 | 1147 | # result from the merge (issue1802) |
|
1148 | 1148 | p1, p2 = self._parents |
|
1149 | 1149 | pa = p1.ancestor(p2) |
|
1150 | 1150 | m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest() |
|
1151 | 1151 | |
|
1152 | 1152 | def func(f): |
|
1153 | 1153 | f = copiesget(f, f) # may be wrong for merges with copies |
|
1154 | 1154 | fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f) |
|
1155 | 1155 | if fl1 == fl2: |
|
1156 | 1156 | return fl1 |
|
1157 | 1157 | if fl1 == fla: |
|
1158 | 1158 | return fl2 |
|
1159 | 1159 | if fl2 == fla: |
|
1160 | 1160 | return fl1 |
|
1161 | 1161 | return '' # punt for conflicts |
|
1162 | 1162 | |
|
1163 | 1163 | return func |
|
1164 | 1164 | |
|
1165 | 1165 | @propertycache |
|
1166 | 1166 | def _flagfunc(self): |
|
1167 | 1167 | return self._repo.dirstate.flagfunc(self._buildflagfunc) |
|
1168 | 1168 | |
|
1169 | 1169 | @propertycache |
|
1170 | 1170 | def _manifest(self): |
|
1171 | 1171 | """generate a manifest corresponding to the values in self._status |
|
1172 | 1172 | |
|
1173 | 1173 | This reuse the file nodeid from parent, but we append an extra letter |
|
1174 | 1174 | when modified. Modified files get an extra 'm' while added files get |
|
1175 | 1175 | an extra 'a'. This is used by manifests merge to see that files |
|
1176 | 1176 | are different and by update logic to avoid deleting newly added files. |
|
1177 | 1177 | """ |
|
1178 | 1178 | |
|
1179 | 1179 | man1 = self._parents[0].manifest() |
|
1180 | 1180 | man = man1.copy() |
|
1181 | 1181 | if len(self._parents) > 1: |
|
1182 | 1182 | man2 = self.p2().manifest() |
|
1183 | 1183 | def getman(f): |
|
1184 | 1184 | if f in man1: |
|
1185 | 1185 | return man1 |
|
1186 | 1186 | return man2 |
|
1187 | 1187 | else: |
|
1188 | 1188 | getman = lambda f: man1 |
|
1189 | 1189 | |
|
1190 | 1190 | copied = self._repo.dirstate.copies() |
|
1191 | 1191 | ff = self._flagfunc |
|
1192 | 1192 | for i, l in (("a", self._status.added), ("m", self._status.modified)): |
|
1193 | 1193 | for f in l: |
|
1194 | 1194 | orig = copied.get(f, f) |
|
1195 | 1195 | man[f] = getman(orig).get(orig, nullid) + i |
|
1196 | 1196 | try: |
|
1197 | 1197 | man.setflag(f, ff(f)) |
|
1198 | 1198 | except OSError: |
|
1199 | 1199 | pass |
|
1200 | 1200 | |
|
1201 | 1201 | for f in self._status.deleted + self._status.removed: |
|
1202 | 1202 | if f in man: |
|
1203 | 1203 | del man[f] |
|
1204 | 1204 | |
|
1205 | 1205 | return man |
|
1206 | 1206 | |
|
1207 | 1207 | @propertycache |
|
1208 | 1208 | def _status(self): |
|
1209 | 1209 | return self._repo.status() |
|
1210 | 1210 | |
|
1211 | 1211 | @propertycache |
|
1212 | 1212 | def _user(self): |
|
1213 | 1213 | return self._repo.ui.username() |
|
1214 | 1214 | |
|
1215 | 1215 | @propertycache |
|
1216 | 1216 | def _date(self): |
|
1217 | 1217 | return util.makedate() |
|
1218 | 1218 | |
|
1219 | 1219 | def subrev(self, subpath): |
|
1220 | 1220 | return None |
|
1221 | 1221 | |
|
1222 | 1222 | def manifestnode(self): |
|
1223 | 1223 | return None |
|
1224 | 1224 | def user(self): |
|
1225 | 1225 | return self._user or self._repo.ui.username() |
|
1226 | 1226 | def date(self): |
|
1227 | 1227 | return self._date |
|
1228 | 1228 | def description(self): |
|
1229 | 1229 | return self._text |
|
1230 | 1230 | def files(self): |
|
1231 | 1231 | return sorted(self._status.modified + self._status.added + |
|
1232 | 1232 | self._status.removed) |
|
1233 | 1233 | |
|
1234 | 1234 | def modified(self): |
|
1235 | 1235 | return self._status.modified |
|
1236 | 1236 | def added(self): |
|
1237 | 1237 | return self._status.added |
|
1238 | 1238 | def removed(self): |
|
1239 | 1239 | return self._status.removed |
|
1240 | 1240 | def deleted(self): |
|
1241 | 1241 | return self._status.deleted |
|
1242 | 1242 | def branch(self): |
|
1243 | 1243 | return encoding.tolocal(self._extra['branch']) |
|
1244 | 1244 | def closesbranch(self): |
|
1245 | 1245 | return 'close' in self._extra |
|
1246 | 1246 | def extra(self): |
|
1247 | 1247 | return self._extra |
|
1248 | 1248 | |
|
1249 | 1249 | def tags(self): |
|
1250 | 1250 | return [] |
|
1251 | 1251 | |
|
1252 | 1252 | def bookmarks(self): |
|
1253 | 1253 | b = [] |
|
1254 | 1254 | for p in self.parents(): |
|
1255 | 1255 | b.extend(p.bookmarks()) |
|
1256 | 1256 | return b |
|
1257 | 1257 | |
|
1258 | 1258 | def phase(self): |
|
1259 | 1259 | phase = phases.draft # default phase to draft |
|
1260 | 1260 | for p in self.parents(): |
|
1261 | 1261 | phase = max(phase, p.phase()) |
|
1262 | 1262 | return phase |
|
1263 | 1263 | |
|
1264 | 1264 | def hidden(self): |
|
1265 | 1265 | return False |
|
1266 | 1266 | |
|
1267 | 1267 | def children(self): |
|
1268 | 1268 | return [] |
|
1269 | 1269 | |
|
1270 | 1270 | def flags(self, path): |
|
1271 | 1271 | if '_manifest' in self.__dict__: |
|
1272 | 1272 | try: |
|
1273 | 1273 | return self._manifest.flags(path) |
|
1274 | 1274 | except KeyError: |
|
1275 | 1275 | return '' |
|
1276 | 1276 | |
|
1277 | 1277 | try: |
|
1278 | 1278 | return self._flagfunc(path) |
|
1279 | 1279 | except OSError: |
|
1280 | 1280 | return '' |
|
1281 | 1281 | |
|
1282 | 1282 | def ancestor(self, c2): |
|
1283 | 1283 | """return the "best" ancestor context of self and c2""" |
|
1284 | 1284 | return self._parents[0].ancestor(c2) # punt on two parents for now |
|
1285 | 1285 | |
|
1286 | 1286 | def walk(self, match): |
|
1287 | 1287 | '''Generates matching file names.''' |
|
1288 | 1288 | return sorted(self._repo.dirstate.walk(match, sorted(self.substate), |
|
1289 | 1289 | True, False)) |
|
1290 | 1290 | |
|
1291 | 1291 | def matches(self, match): |
|
1292 | 1292 | return sorted(self._repo.dirstate.matches(match)) |
|
1293 | 1293 | |
|
1294 | 1294 | def ancestors(self): |
|
1295 | 1295 | for p in self._parents: |
|
1296 | 1296 | yield p |
|
1297 | 1297 | for a in self._repo.changelog.ancestors( |
|
1298 | 1298 | [p.rev() for p in self._parents]): |
|
1299 | 1299 | yield changectx(self._repo, a) |
|
1300 | 1300 | |
|
1301 | 1301 | def markcommitted(self, node): |
|
1302 | 1302 | """Perform post-commit cleanup necessary after committing this ctx |
|
1303 | 1303 | |
|
1304 | 1304 | Specifically, this updates backing stores this working context |
|
1305 | 1305 | wraps to reflect the fact that the changes reflected by this |
|
1306 | 1306 | workingctx have been committed. For example, it marks |
|
1307 | 1307 | modified and added files as normal in the dirstate. |
|
1308 | 1308 | |
|
1309 | 1309 | """ |
|
1310 | 1310 | |
|
1311 | 1311 | self._repo.dirstate.beginparentchange() |
|
1312 | 1312 | for f in self.modified() + self.added(): |
|
1313 | 1313 | self._repo.dirstate.normal(f) |
|
1314 | 1314 | for f in self.removed(): |
|
1315 | 1315 | self._repo.dirstate.drop(f) |
|
1316 | 1316 | self._repo.dirstate.setparents(node) |
|
1317 | 1317 | self._repo.dirstate.endparentchange() |
|
1318 | 1318 | |
|
1319 | 1319 | class workingctx(committablectx): |
|
1320 | 1320 | """A workingctx object makes access to data related to |
|
1321 | 1321 | the current working directory convenient. |
|
1322 | 1322 | date - any valid date string or (unixtime, offset), or None. |
|
1323 | 1323 | user - username string, or None. |
|
1324 | 1324 | extra - a dictionary of extra values, or None. |
|
1325 | 1325 | changes - a list of file lists as returned by localrepo.status() |
|
1326 | 1326 | or None to use the repository status. |
|
1327 | 1327 | """ |
|
1328 | 1328 | def __init__(self, repo, text="", user=None, date=None, extra=None, |
|
1329 | 1329 | changes=None): |
|
1330 | 1330 | super(workingctx, self).__init__(repo, text, user, date, extra, changes) |
|
1331 | 1331 | |
|
1332 | 1332 | def __iter__(self): |
|
1333 | 1333 | d = self._repo.dirstate |
|
1334 | 1334 | for f in d: |
|
1335 | 1335 | if d[f] != 'r': |
|
1336 | 1336 | yield f |
|
1337 | 1337 | |
|
1338 | 1338 | def __contains__(self, key): |
|
1339 | 1339 | return self._repo.dirstate[key] not in "?r" |
|
1340 | 1340 | |
|
1341 | 1341 | def hex(self): |
|
1342 | 1342 | return hex(wdirid) |
|
1343 | 1343 | |
|
1344 | 1344 | @propertycache |
|
1345 | 1345 | def _parents(self): |
|
1346 | 1346 | p = self._repo.dirstate.parents() |
|
1347 | 1347 | if p[1] == nullid: |
|
1348 | 1348 | p = p[:-1] |
|
1349 | 1349 | return [changectx(self._repo, x) for x in p] |
|
1350 | 1350 | |
|
1351 | 1351 | def filectx(self, path, filelog=None): |
|
1352 | 1352 | """get a file context from the working directory""" |
|
1353 | 1353 | return workingfilectx(self._repo, path, workingctx=self, |
|
1354 | 1354 | filelog=filelog) |
|
1355 | 1355 | |
|
1356 | 1356 | def dirty(self, missing=False, merge=True, branch=True): |
|
1357 | 1357 | "check whether a working directory is modified" |
|
1358 | 1358 | # check subrepos first |
|
1359 | 1359 | for s in sorted(self.substate): |
|
1360 | 1360 | if self.sub(s).dirty(): |
|
1361 | 1361 | return True |
|
1362 | 1362 | # check current working dir |
|
1363 | 1363 | return ((merge and self.p2()) or |
|
1364 | 1364 | (branch and self.branch() != self.p1().branch()) or |
|
1365 | 1365 | self.modified() or self.added() or self.removed() or |
|
1366 | 1366 | (missing and self.deleted())) |
|
1367 | 1367 | |
|
1368 | 1368 | def add(self, list, prefix=""): |
|
1369 | 1369 | join = lambda f: os.path.join(prefix, f) |
|
1370 | 1370 | wlock = self._repo.wlock() |
|
1371 | 1371 | ui, ds = self._repo.ui, self._repo.dirstate |
|
1372 | 1372 | try: |
|
1373 | 1373 | rejected = [] |
|
1374 | 1374 | lstat = self._repo.wvfs.lstat |
|
1375 | 1375 | for f in list: |
|
1376 | 1376 | scmutil.checkportable(ui, join(f)) |
|
1377 | 1377 | try: |
|
1378 | 1378 | st = lstat(f) |
|
1379 | 1379 | except OSError: |
|
1380 | 1380 | ui.warn(_("%s does not exist!\n") % join(f)) |
|
1381 | 1381 | rejected.append(f) |
|
1382 | 1382 | continue |
|
1383 | 1383 | if st.st_size > 10000000: |
|
1384 | 1384 | ui.warn(_("%s: up to %d MB of RAM may be required " |
|
1385 | 1385 | "to manage this file\n" |
|
1386 | 1386 | "(use 'hg revert %s' to cancel the " |
|
1387 | 1387 | "pending addition)\n") |
|
1388 | 1388 | % (f, 3 * st.st_size // 1000000, join(f))) |
|
1389 | 1389 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): |
|
1390 | 1390 | ui.warn(_("%s not added: only files and symlinks " |
|
1391 | 1391 | "supported currently\n") % join(f)) |
|
1392 | 1392 | rejected.append(f) |
|
1393 | 1393 | elif ds[f] in 'amn': |
|
1394 | 1394 | ui.warn(_("%s already tracked!\n") % join(f)) |
|
1395 | 1395 | elif ds[f] == 'r': |
|
1396 | 1396 | ds.normallookup(f) |
|
1397 | 1397 | else: |
|
1398 | 1398 | ds.add(f) |
|
1399 | 1399 | return rejected |
|
1400 | 1400 | finally: |
|
1401 | 1401 | wlock.release() |
|
1402 | 1402 | |
|
1403 | 1403 | def forget(self, files, prefix=""): |
|
1404 | 1404 | join = lambda f: os.path.join(prefix, f) |
|
1405 | 1405 | wlock = self._repo.wlock() |
|
1406 | 1406 | try: |
|
1407 | 1407 | rejected = [] |
|
1408 | 1408 | for f in files: |
|
1409 | 1409 | if f not in self._repo.dirstate: |
|
1410 | 1410 | self._repo.ui.warn(_("%s not tracked!\n") % join(f)) |
|
1411 | 1411 | rejected.append(f) |
|
1412 | 1412 | elif self._repo.dirstate[f] != 'a': |
|
1413 | 1413 | self._repo.dirstate.remove(f) |
|
1414 | 1414 | else: |
|
1415 | 1415 | self._repo.dirstate.drop(f) |
|
1416 | 1416 | return rejected |
|
1417 | 1417 | finally: |
|
1418 | 1418 | wlock.release() |
|
1419 | 1419 | |
|
1420 | 1420 | def undelete(self, list): |
|
1421 | 1421 | pctxs = self.parents() |
|
1422 | 1422 | wlock = self._repo.wlock() |
|
1423 | 1423 | try: |
|
1424 | 1424 | for f in list: |
|
1425 | 1425 | if self._repo.dirstate[f] != 'r': |
|
1426 | 1426 | self._repo.ui.warn(_("%s not removed!\n") % f) |
|
1427 | 1427 | else: |
|
1428 | 1428 | fctx = f in pctxs[0] and pctxs[0][f] or pctxs[1][f] |
|
1429 | 1429 | t = fctx.data() |
|
1430 | 1430 | self._repo.wwrite(f, t, fctx.flags()) |
|
1431 | 1431 | self._repo.dirstate.normal(f) |
|
1432 | 1432 | finally: |
|
1433 | 1433 | wlock.release() |
|
1434 | 1434 | |
|
1435 | 1435 | def copy(self, source, dest): |
|
1436 | 1436 | try: |
|
1437 | 1437 | st = self._repo.wvfs.lstat(dest) |
|
1438 | 1438 | except OSError as err: |
|
1439 | 1439 | if err.errno != errno.ENOENT: |
|
1440 | 1440 | raise |
|
1441 | 1441 | self._repo.ui.warn(_("%s does not exist!\n") % dest) |
|
1442 | 1442 | return |
|
1443 | 1443 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): |
|
1444 | 1444 | self._repo.ui.warn(_("copy failed: %s is not a file or a " |
|
1445 | 1445 | "symbolic link\n") % dest) |
|
1446 | 1446 | else: |
|
1447 | 1447 | wlock = self._repo.wlock() |
|
1448 | 1448 | try: |
|
1449 | 1449 | if self._repo.dirstate[dest] in '?': |
|
1450 | 1450 | self._repo.dirstate.add(dest) |
|
1451 | 1451 | elif self._repo.dirstate[dest] in 'r': |
|
1452 | 1452 | self._repo.dirstate.normallookup(dest) |
|
1453 | 1453 | self._repo.dirstate.copy(source, dest) |
|
1454 | 1454 | finally: |
|
1455 | 1455 | wlock.release() |
|
1456 | 1456 | |
|
1457 | 1457 | def match(self, pats=[], include=None, exclude=None, default='glob', |
|
1458 | 1458 | listsubrepos=False, badfn=None): |
|
1459 | 1459 | r = self._repo |
|
1460 | 1460 | |
|
1461 | 1461 | # Only a case insensitive filesystem needs magic to translate user input |
|
1462 | 1462 | # to actual case in the filesystem. |
|
1463 | 1463 | if not util.checkcase(r.root): |
|
1464 | 1464 | return matchmod.icasefsmatcher(r.root, r.getcwd(), pats, include, |
|
1465 | 1465 | exclude, default, r.auditor, self, |
|
1466 | 1466 | listsubrepos=listsubrepos, |
|
1467 | 1467 | badfn=badfn) |
|
1468 | 1468 | return matchmod.match(r.root, r.getcwd(), pats, |
|
1469 | 1469 | include, exclude, default, |
|
1470 | 1470 | auditor=r.auditor, ctx=self, |
|
1471 | 1471 | listsubrepos=listsubrepos, badfn=badfn) |
|
1472 | 1472 | |
|
1473 | 1473 | def _filtersuspectsymlink(self, files): |
|
1474 | 1474 | if not files or self._repo.dirstate._checklink: |
|
1475 | 1475 | return files |
|
1476 | 1476 | |
|
1477 | 1477 | # Symlink placeholders may get non-symlink-like contents |
|
1478 | 1478 | # via user error or dereferencing by NFS or Samba servers, |
|
1479 | 1479 | # so we filter out any placeholders that don't look like a |
|
1480 | 1480 | # symlink |
|
1481 | 1481 | sane = [] |
|
1482 | 1482 | for f in files: |
|
1483 | 1483 | if self.flags(f) == 'l': |
|
1484 | 1484 | d = self[f].data() |
|
1485 | 1485 | if d == '' or len(d) >= 1024 or '\n' in d or util.binary(d): |
|
1486 | 1486 | self._repo.ui.debug('ignoring suspect symlink placeholder' |
|
1487 | 1487 | ' "%s"\n' % f) |
|
1488 | 1488 | continue |
|
1489 | 1489 | sane.append(f) |
|
1490 | 1490 | return sane |
|
1491 | 1491 | |
|
1492 | 1492 | def _checklookup(self, files): |
|
1493 | 1493 | # check for any possibly clean files |
|
1494 | 1494 | if not files: |
|
1495 | 1495 | return [], [] |
|
1496 | 1496 | |
|
1497 | 1497 | modified = [] |
|
1498 | 1498 | fixup = [] |
|
1499 | 1499 | pctx = self._parents[0] |
|
1500 | 1500 | # do a full compare of any files that might have changed |
|
1501 | 1501 | for f in sorted(files): |
|
1502 | 1502 | if (f not in pctx or self.flags(f) != pctx.flags(f) |
|
1503 | 1503 | or pctx[f].cmp(self[f])): |
|
1504 | 1504 | modified.append(f) |
|
1505 | 1505 | else: |
|
1506 | 1506 | fixup.append(f) |
|
1507 | 1507 | |
|
1508 | 1508 | # update dirstate for files that are actually clean |
|
1509 | 1509 | if fixup: |
|
1510 | 1510 | try: |
|
1511 | 1511 | # updating the dirstate is optional |
|
1512 | 1512 | # so we don't wait on the lock |
|
1513 | 1513 | # wlock can invalidate the dirstate, so cache normal _after_ |
|
1514 | 1514 | # taking the lock |
|
1515 | 1515 | wlock = self._repo.wlock(False) |
|
1516 | 1516 | normal = self._repo.dirstate.normal |
|
1517 | 1517 | try: |
|
1518 | 1518 | for f in fixup: |
|
1519 | 1519 | normal(f) |
|
1520 | # write changes out explicitly, because nesting | |
|
1521 | # wlock at runtime may prevent 'wlock.release()' | |
|
1522 | # below from doing so for subsequent changing files | |
|
1523 | self._repo.dirstate.write() | |
|
1520 | 1524 | finally: |
|
1521 | 1525 | wlock.release() |
|
1522 | 1526 | except error.LockError: |
|
1523 | 1527 | pass |
|
1524 | 1528 | return modified, fixup |
|
1525 | 1529 | |
|
1526 | 1530 | def _manifestmatches(self, match, s): |
|
1527 | 1531 | """Slow path for workingctx |
|
1528 | 1532 | |
|
1529 | 1533 | The fast path is when we compare the working directory to its parent |
|
1530 | 1534 | which means this function is comparing with a non-parent; therefore we |
|
1531 | 1535 | need to build a manifest and return what matches. |
|
1532 | 1536 | """ |
|
1533 | 1537 | mf = self._repo['.']._manifestmatches(match, s) |
|
1534 | 1538 | for f in s.modified + s.added: |
|
1535 | 1539 | mf[f] = _newnode |
|
1536 | 1540 | mf.setflag(f, self.flags(f)) |
|
1537 | 1541 | for f in s.removed: |
|
1538 | 1542 | if f in mf: |
|
1539 | 1543 | del mf[f] |
|
1540 | 1544 | return mf |
|
1541 | 1545 | |
|
1542 | 1546 | def _dirstatestatus(self, match=None, ignored=False, clean=False, |
|
1543 | 1547 | unknown=False): |
|
1544 | 1548 | '''Gets the status from the dirstate -- internal use only.''' |
|
1545 | 1549 | listignored, listclean, listunknown = ignored, clean, unknown |
|
1546 | 1550 | match = match or matchmod.always(self._repo.root, self._repo.getcwd()) |
|
1547 | 1551 | subrepos = [] |
|
1548 | 1552 | if '.hgsub' in self: |
|
1549 | 1553 | subrepos = sorted(self.substate) |
|
1550 | 1554 | cmp, s = self._repo.dirstate.status(match, subrepos, listignored, |
|
1551 | 1555 | listclean, listunknown) |
|
1552 | 1556 | |
|
1553 | 1557 | # check for any possibly clean files |
|
1554 | 1558 | if cmp: |
|
1555 | 1559 | modified2, fixup = self._checklookup(cmp) |
|
1556 | 1560 | s.modified.extend(modified2) |
|
1557 | 1561 | |
|
1558 | 1562 | # update dirstate for files that are actually clean |
|
1559 | 1563 | if fixup and listclean: |
|
1560 | 1564 | s.clean.extend(fixup) |
|
1561 | 1565 | |
|
1562 | 1566 | if match.always(): |
|
1563 | 1567 | # cache for performance |
|
1564 | 1568 | if s.unknown or s.ignored or s.clean: |
|
1565 | 1569 | # "_status" is cached with list*=False in the normal route |
|
1566 | 1570 | self._status = scmutil.status(s.modified, s.added, s.removed, |
|
1567 | 1571 | s.deleted, [], [], []) |
|
1568 | 1572 | else: |
|
1569 | 1573 | self._status = s |
|
1570 | 1574 | |
|
1571 | 1575 | return s |
|
1572 | 1576 | |
|
1573 | 1577 | def _buildstatus(self, other, s, match, listignored, listclean, |
|
1574 | 1578 | listunknown): |
|
1575 | 1579 | """build a status with respect to another context |
|
1576 | 1580 | |
|
1577 | 1581 | This includes logic for maintaining the fast path of status when |
|
1578 | 1582 | comparing the working directory against its parent, which is to skip |
|
1579 | 1583 | building a new manifest if self (working directory) is not comparing |
|
1580 | 1584 | against its parent (repo['.']). |
|
1581 | 1585 | """ |
|
1582 | 1586 | s = self._dirstatestatus(match, listignored, listclean, listunknown) |
|
1583 | 1587 | # Filter out symlinks that, in the case of FAT32 and NTFS filesystems, |
|
1584 | 1588 | # might have accidentally ended up with the entire contents of the file |
|
1585 | 1589 | # they are supposed to be linking to. |
|
1586 | 1590 | s.modified[:] = self._filtersuspectsymlink(s.modified) |
|
1587 | 1591 | if other != self._repo['.']: |
|
1588 | 1592 | s = super(workingctx, self)._buildstatus(other, s, match, |
|
1589 | 1593 | listignored, listclean, |
|
1590 | 1594 | listunknown) |
|
1591 | 1595 | return s |
|
1592 | 1596 | |
|
1593 | 1597 | def _matchstatus(self, other, match): |
|
1594 | 1598 | """override the match method with a filter for directory patterns |
|
1595 | 1599 | |
|
1596 | 1600 | We use inheritance to customize the match.bad method only in cases of |
|
1597 | 1601 | workingctx since it belongs only to the working directory when |
|
1598 | 1602 | comparing against the parent changeset. |
|
1599 | 1603 | |
|
1600 | 1604 | If we aren't comparing against the working directory's parent, then we |
|
1601 | 1605 | just use the default match object sent to us. |
|
1602 | 1606 | """ |
|
1603 | 1607 | superself = super(workingctx, self) |
|
1604 | 1608 | match = superself._matchstatus(other, match) |
|
1605 | 1609 | if other != self._repo['.']: |
|
1606 | 1610 | def bad(f, msg): |
|
1607 | 1611 | # 'f' may be a directory pattern from 'match.files()', |
|
1608 | 1612 | # so 'f not in ctx1' is not enough |
|
1609 | 1613 | if f not in other and not other.hasdir(f): |
|
1610 | 1614 | self._repo.ui.warn('%s: %s\n' % |
|
1611 | 1615 | (self._repo.dirstate.pathto(f), msg)) |
|
1612 | 1616 | match.bad = bad |
|
1613 | 1617 | return match |
|
1614 | 1618 | |
|
1615 | 1619 | class committablefilectx(basefilectx): |
|
1616 | 1620 | """A committablefilectx provides common functionality for a file context |
|
1617 | 1621 | that wants the ability to commit, e.g. workingfilectx or memfilectx.""" |
|
1618 | 1622 | def __init__(self, repo, path, filelog=None, ctx=None): |
|
1619 | 1623 | self._repo = repo |
|
1620 | 1624 | self._path = path |
|
1621 | 1625 | self._changeid = None |
|
1622 | 1626 | self._filerev = self._filenode = None |
|
1623 | 1627 | |
|
1624 | 1628 | if filelog is not None: |
|
1625 | 1629 | self._filelog = filelog |
|
1626 | 1630 | if ctx: |
|
1627 | 1631 | self._changectx = ctx |
|
1628 | 1632 | |
|
1629 | 1633 | def __nonzero__(self): |
|
1630 | 1634 | return True |
|
1631 | 1635 | |
|
1632 | 1636 | def linkrev(self): |
|
1633 | 1637 | # linked to self._changectx no matter if file is modified or not |
|
1634 | 1638 | return self.rev() |
|
1635 | 1639 | |
|
1636 | 1640 | def parents(self): |
|
1637 | 1641 | '''return parent filectxs, following copies if necessary''' |
|
1638 | 1642 | def filenode(ctx, path): |
|
1639 | 1643 | return ctx._manifest.get(path, nullid) |
|
1640 | 1644 | |
|
1641 | 1645 | path = self._path |
|
1642 | 1646 | fl = self._filelog |
|
1643 | 1647 | pcl = self._changectx._parents |
|
1644 | 1648 | renamed = self.renamed() |
|
1645 | 1649 | |
|
1646 | 1650 | if renamed: |
|
1647 | 1651 | pl = [renamed + (None,)] |
|
1648 | 1652 | else: |
|
1649 | 1653 | pl = [(path, filenode(pcl[0], path), fl)] |
|
1650 | 1654 | |
|
1651 | 1655 | for pc in pcl[1:]: |
|
1652 | 1656 | pl.append((path, filenode(pc, path), fl)) |
|
1653 | 1657 | |
|
1654 | 1658 | return [self._parentfilectx(p, fileid=n, filelog=l) |
|
1655 | 1659 | for p, n, l in pl if n != nullid] |
|
1656 | 1660 | |
|
1657 | 1661 | def children(self): |
|
1658 | 1662 | return [] |
|
1659 | 1663 | |
|
1660 | 1664 | class workingfilectx(committablefilectx): |
|
1661 | 1665 | """A workingfilectx object makes access to data related to a particular |
|
1662 | 1666 | file in the working directory convenient.""" |
|
1663 | 1667 | def __init__(self, repo, path, filelog=None, workingctx=None): |
|
1664 | 1668 | super(workingfilectx, self).__init__(repo, path, filelog, workingctx) |
|
1665 | 1669 | |
|
1666 | 1670 | @propertycache |
|
1667 | 1671 | def _changectx(self): |
|
1668 | 1672 | return workingctx(self._repo) |
|
1669 | 1673 | |
|
1670 | 1674 | def data(self): |
|
1671 | 1675 | return self._repo.wread(self._path) |
|
1672 | 1676 | def renamed(self): |
|
1673 | 1677 | rp = self._repo.dirstate.copied(self._path) |
|
1674 | 1678 | if not rp: |
|
1675 | 1679 | return None |
|
1676 | 1680 | return rp, self._changectx._parents[0]._manifest.get(rp, nullid) |
|
1677 | 1681 | |
|
1678 | 1682 | def size(self): |
|
1679 | 1683 | return self._repo.wvfs.lstat(self._path).st_size |
|
1680 | 1684 | def date(self): |
|
1681 | 1685 | t, tz = self._changectx.date() |
|
1682 | 1686 | try: |
|
1683 | 1687 | return (int(self._repo.wvfs.lstat(self._path).st_mtime), tz) |
|
1684 | 1688 | except OSError as err: |
|
1685 | 1689 | if err.errno != errno.ENOENT: |
|
1686 | 1690 | raise |
|
1687 | 1691 | return (t, tz) |
|
1688 | 1692 | |
|
1689 | 1693 | def cmp(self, fctx): |
|
1690 | 1694 | """compare with other file context |
|
1691 | 1695 | |
|
1692 | 1696 | returns True if different than fctx. |
|
1693 | 1697 | """ |
|
1694 | 1698 | # fctx should be a filectx (not a workingfilectx) |
|
1695 | 1699 | # invert comparison to reuse the same code path |
|
1696 | 1700 | return fctx.cmp(self) |
|
1697 | 1701 | |
|
1698 | 1702 | def remove(self, ignoremissing=False): |
|
1699 | 1703 | """wraps unlink for a repo's working directory""" |
|
1700 | 1704 | util.unlinkpath(self._repo.wjoin(self._path), ignoremissing) |
|
1701 | 1705 | |
|
1702 | 1706 | def write(self, data, flags): |
|
1703 | 1707 | """wraps repo.wwrite""" |
|
1704 | 1708 | self._repo.wwrite(self._path, data, flags) |
|
1705 | 1709 | |
|
1706 | 1710 | class workingcommitctx(workingctx): |
|
1707 | 1711 | """A workingcommitctx object makes access to data related to |
|
1708 | 1712 | the revision being committed convenient. |
|
1709 | 1713 | |
|
1710 | 1714 | This hides changes in the working directory, if they aren't |
|
1711 | 1715 | committed in this context. |
|
1712 | 1716 | """ |
|
1713 | 1717 | def __init__(self, repo, changes, |
|
1714 | 1718 | text="", user=None, date=None, extra=None): |
|
1715 | 1719 | super(workingctx, self).__init__(repo, text, user, date, extra, |
|
1716 | 1720 | changes) |
|
1717 | 1721 | |
|
1718 | 1722 | def _dirstatestatus(self, match=None, ignored=False, clean=False, |
|
1719 | 1723 | unknown=False): |
|
1720 | 1724 | """Return matched files only in ``self._status`` |
|
1721 | 1725 | |
|
1722 | 1726 | Uncommitted files appear "clean" via this context, even if |
|
1723 | 1727 | they aren't actually so in the working directory. |
|
1724 | 1728 | """ |
|
1725 | 1729 | match = match or matchmod.always(self._repo.root, self._repo.getcwd()) |
|
1726 | 1730 | if clean: |
|
1727 | 1731 | clean = [f for f in self._manifest if f not in self._changedset] |
|
1728 | 1732 | else: |
|
1729 | 1733 | clean = [] |
|
1730 | 1734 | return scmutil.status([f for f in self._status.modified if match(f)], |
|
1731 | 1735 | [f for f in self._status.added if match(f)], |
|
1732 | 1736 | [f for f in self._status.removed if match(f)], |
|
1733 | 1737 | [], [], [], clean) |
|
1734 | 1738 | |
|
1735 | 1739 | @propertycache |
|
1736 | 1740 | def _changedset(self): |
|
1737 | 1741 | """Return the set of files changed in this context |
|
1738 | 1742 | """ |
|
1739 | 1743 | changed = set(self._status.modified) |
|
1740 | 1744 | changed.update(self._status.added) |
|
1741 | 1745 | changed.update(self._status.removed) |
|
1742 | 1746 | return changed |
|
1743 | 1747 | |
|
1744 | 1748 | class memctx(committablectx): |
|
1745 | 1749 | """Use memctx to perform in-memory commits via localrepo.commitctx(). |
|
1746 | 1750 | |
|
1747 | 1751 | Revision information is supplied at initialization time while |
|
1748 | 1752 | related files data and is made available through a callback |
|
1749 | 1753 | mechanism. 'repo' is the current localrepo, 'parents' is a |
|
1750 | 1754 | sequence of two parent revisions identifiers (pass None for every |
|
1751 | 1755 | missing parent), 'text' is the commit message and 'files' lists |
|
1752 | 1756 | names of files touched by the revision (normalized and relative to |
|
1753 | 1757 | repository root). |
|
1754 | 1758 | |
|
1755 | 1759 | filectxfn(repo, memctx, path) is a callable receiving the |
|
1756 | 1760 | repository, the current memctx object and the normalized path of |
|
1757 | 1761 | requested file, relative to repository root. It is fired by the |
|
1758 | 1762 | commit function for every file in 'files', but calls order is |
|
1759 | 1763 | undefined. If the file is available in the revision being |
|
1760 | 1764 | committed (updated or added), filectxfn returns a memfilectx |
|
1761 | 1765 | object. If the file was removed, filectxfn raises an |
|
1762 | 1766 | IOError. Moved files are represented by marking the source file |
|
1763 | 1767 | removed and the new file added with copy information (see |
|
1764 | 1768 | memfilectx). |
|
1765 | 1769 | |
|
1766 | 1770 | user receives the committer name and defaults to current |
|
1767 | 1771 | repository username, date is the commit date in any format |
|
1768 | 1772 | supported by util.parsedate() and defaults to current date, extra |
|
1769 | 1773 | is a dictionary of metadata or is left empty. |
|
1770 | 1774 | """ |
|
1771 | 1775 | |
|
1772 | 1776 | # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files. |
|
1773 | 1777 | # Extensions that need to retain compatibility across Mercurial 3.1 can use |
|
1774 | 1778 | # this field to determine what to do in filectxfn. |
|
1775 | 1779 | _returnnoneformissingfiles = True |
|
1776 | 1780 | |
|
1777 | 1781 | def __init__(self, repo, parents, text, files, filectxfn, user=None, |
|
1778 | 1782 | date=None, extra=None, editor=False): |
|
1779 | 1783 | super(memctx, self).__init__(repo, text, user, date, extra) |
|
1780 | 1784 | self._rev = None |
|
1781 | 1785 | self._node = None |
|
1782 | 1786 | parents = [(p or nullid) for p in parents] |
|
1783 | 1787 | p1, p2 = parents |
|
1784 | 1788 | self._parents = [changectx(self._repo, p) for p in (p1, p2)] |
|
1785 | 1789 | files = sorted(set(files)) |
|
1786 | 1790 | self._files = files |
|
1787 | 1791 | self.substate = {} |
|
1788 | 1792 | |
|
1789 | 1793 | # if store is not callable, wrap it in a function |
|
1790 | 1794 | if not callable(filectxfn): |
|
1791 | 1795 | def getfilectx(repo, memctx, path): |
|
1792 | 1796 | fctx = filectxfn[path] |
|
1793 | 1797 | # this is weird but apparently we only keep track of one parent |
|
1794 | 1798 | # (why not only store that instead of a tuple?) |
|
1795 | 1799 | copied = fctx.renamed() |
|
1796 | 1800 | if copied: |
|
1797 | 1801 | copied = copied[0] |
|
1798 | 1802 | return memfilectx(repo, path, fctx.data(), |
|
1799 | 1803 | islink=fctx.islink(), isexec=fctx.isexec(), |
|
1800 | 1804 | copied=copied, memctx=memctx) |
|
1801 | 1805 | self._filectxfn = getfilectx |
|
1802 | 1806 | else: |
|
1803 | 1807 | # "util.cachefunc" reduces invocation of possibly expensive |
|
1804 | 1808 | # "filectxfn" for performance (e.g. converting from another VCS) |
|
1805 | 1809 | self._filectxfn = util.cachefunc(filectxfn) |
|
1806 | 1810 | |
|
1807 | 1811 | if extra: |
|
1808 | 1812 | self._extra = extra.copy() |
|
1809 | 1813 | else: |
|
1810 | 1814 | self._extra = {} |
|
1811 | 1815 | |
|
1812 | 1816 | if self._extra.get('branch', '') == '': |
|
1813 | 1817 | self._extra['branch'] = 'default' |
|
1814 | 1818 | |
|
1815 | 1819 | if editor: |
|
1816 | 1820 | self._text = editor(self._repo, self, []) |
|
1817 | 1821 | self._repo.savecommitmessage(self._text) |
|
1818 | 1822 | |
|
1819 | 1823 | def filectx(self, path, filelog=None): |
|
1820 | 1824 | """get a file context from the working directory |
|
1821 | 1825 | |
|
1822 | 1826 | Returns None if file doesn't exist and should be removed.""" |
|
1823 | 1827 | return self._filectxfn(self._repo, self, path) |
|
1824 | 1828 | |
|
1825 | 1829 | def commit(self): |
|
1826 | 1830 | """commit context to the repo""" |
|
1827 | 1831 | return self._repo.commitctx(self) |
|
1828 | 1832 | |
|
1829 | 1833 | @propertycache |
|
1830 | 1834 | def _manifest(self): |
|
1831 | 1835 | """generate a manifest based on the return values of filectxfn""" |
|
1832 | 1836 | |
|
1833 | 1837 | # keep this simple for now; just worry about p1 |
|
1834 | 1838 | pctx = self._parents[0] |
|
1835 | 1839 | man = pctx.manifest().copy() |
|
1836 | 1840 | |
|
1837 | 1841 | for f in self._status.modified: |
|
1838 | 1842 | p1node = nullid |
|
1839 | 1843 | p2node = nullid |
|
1840 | 1844 | p = pctx[f].parents() # if file isn't in pctx, check p2? |
|
1841 | 1845 | if len(p) > 0: |
|
1842 | 1846 | p1node = p[0].node() |
|
1843 | 1847 | if len(p) > 1: |
|
1844 | 1848 | p2node = p[1].node() |
|
1845 | 1849 | man[f] = revlog.hash(self[f].data(), p1node, p2node) |
|
1846 | 1850 | |
|
1847 | 1851 | for f in self._status.added: |
|
1848 | 1852 | man[f] = revlog.hash(self[f].data(), nullid, nullid) |
|
1849 | 1853 | |
|
1850 | 1854 | for f in self._status.removed: |
|
1851 | 1855 | if f in man: |
|
1852 | 1856 | del man[f] |
|
1853 | 1857 | |
|
1854 | 1858 | return man |
|
1855 | 1859 | |
|
1856 | 1860 | @propertycache |
|
1857 | 1861 | def _status(self): |
|
1858 | 1862 | """Calculate exact status from ``files`` specified at construction |
|
1859 | 1863 | """ |
|
1860 | 1864 | man1 = self.p1().manifest() |
|
1861 | 1865 | p2 = self._parents[1] |
|
1862 | 1866 | # "1 < len(self._parents)" can't be used for checking |
|
1863 | 1867 | # existence of the 2nd parent, because "memctx._parents" is |
|
1864 | 1868 | # explicitly initialized by the list, of which length is 2. |
|
1865 | 1869 | if p2.node() != nullid: |
|
1866 | 1870 | man2 = p2.manifest() |
|
1867 | 1871 | managing = lambda f: f in man1 or f in man2 |
|
1868 | 1872 | else: |
|
1869 | 1873 | managing = lambda f: f in man1 |
|
1870 | 1874 | |
|
1871 | 1875 | modified, added, removed = [], [], [] |
|
1872 | 1876 | for f in self._files: |
|
1873 | 1877 | if not managing(f): |
|
1874 | 1878 | added.append(f) |
|
1875 | 1879 | elif self[f]: |
|
1876 | 1880 | modified.append(f) |
|
1877 | 1881 | else: |
|
1878 | 1882 | removed.append(f) |
|
1879 | 1883 | |
|
1880 | 1884 | return scmutil.status(modified, added, removed, [], [], [], []) |
|
1881 | 1885 | |
|
1882 | 1886 | class memfilectx(committablefilectx): |
|
1883 | 1887 | """memfilectx represents an in-memory file to commit. |
|
1884 | 1888 | |
|
1885 | 1889 | See memctx and committablefilectx for more details. |
|
1886 | 1890 | """ |
|
1887 | 1891 | def __init__(self, repo, path, data, islink=False, |
|
1888 | 1892 | isexec=False, copied=None, memctx=None): |
|
1889 | 1893 | """ |
|
1890 | 1894 | path is the normalized file path relative to repository root. |
|
1891 | 1895 | data is the file content as a string. |
|
1892 | 1896 | islink is True if the file is a symbolic link. |
|
1893 | 1897 | isexec is True if the file is executable. |
|
1894 | 1898 | copied is the source file path if current file was copied in the |
|
1895 | 1899 | revision being committed, or None.""" |
|
1896 | 1900 | super(memfilectx, self).__init__(repo, path, None, memctx) |
|
1897 | 1901 | self._data = data |
|
1898 | 1902 | self._flags = (islink and 'l' or '') + (isexec and 'x' or '') |
|
1899 | 1903 | self._copied = None |
|
1900 | 1904 | if copied: |
|
1901 | 1905 | self._copied = (copied, nullid) |
|
1902 | 1906 | |
|
1903 | 1907 | def data(self): |
|
1904 | 1908 | return self._data |
|
1905 | 1909 | def size(self): |
|
1906 | 1910 | return len(self.data()) |
|
1907 | 1911 | def flags(self): |
|
1908 | 1912 | return self._flags |
|
1909 | 1913 | def renamed(self): |
|
1910 | 1914 | return self._copied |
|
1911 | 1915 | |
|
1912 | 1916 | def remove(self, ignoremissing=False): |
|
1913 | 1917 | """wraps unlink for a repo's working directory""" |
|
1914 | 1918 | # need to figure out what to do here |
|
1915 | 1919 | del self._changectx[self._path] |
|
1916 | 1920 | |
|
1917 | 1921 | def write(self, data, flags): |
|
1918 | 1922 | """wraps repo.wwrite""" |
|
1919 | 1923 | self._data = data |
@@ -1,1093 +1,1089 b'' | |||
|
1 | 1 | This file contains testcases that tend to be related to special cases or less |
|
2 | 2 | common commands affecting largefile. |
|
3 | 3 | |
|
4 | 4 | Each sections should be independent of each others. |
|
5 | 5 | |
|
6 | 6 | $ USERCACHE="$TESTTMP/cache"; export USERCACHE |
|
7 | 7 | $ mkdir "${USERCACHE}" |
|
8 | 8 | $ cat >> $HGRCPATH <<EOF |
|
9 | 9 | > [extensions] |
|
10 | 10 | > largefiles= |
|
11 | 11 | > purge= |
|
12 | 12 | > rebase= |
|
13 | 13 | > transplant= |
|
14 | 14 | > [phases] |
|
15 | 15 | > publish=False |
|
16 | 16 | > [largefiles] |
|
17 | 17 | > minsize=2 |
|
18 | 18 | > patterns=glob:**.dat |
|
19 | 19 | > usercache=${USERCACHE} |
|
20 | 20 | > [hooks] |
|
21 | 21 | > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status" |
|
22 | 22 | > EOF |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | Test copies and moves from a directory other than root (issue3516) |
|
27 | 27 | ========================================================================= |
|
28 | 28 | |
|
29 | 29 | $ hg init lf_cpmv |
|
30 | 30 | $ cd lf_cpmv |
|
31 | 31 | $ mkdir dira |
|
32 | 32 | $ mkdir dira/dirb |
|
33 | 33 | $ touch dira/dirb/largefile |
|
34 | 34 | $ hg add --large dira/dirb/largefile |
|
35 | 35 | $ hg commit -m "added" |
|
36 | 36 | Invoking status precommit hook |
|
37 | 37 | A dira/dirb/largefile |
|
38 | 38 | $ cd dira |
|
39 | 39 | $ hg cp dirb/largefile foo/largefile |
|
40 | 40 | |
|
41 | 41 | TODO: Ideally, this should mention the largefile, not the standin |
|
42 | 42 | $ hg log -T '{rev}\n' --stat 'set:clean()' |
|
43 | 43 | 0 |
|
44 | 44 | .hglf/dira/dirb/largefile | 1 + |
|
45 | 45 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
46 | 46 | |
|
47 | 47 | $ hg ci -m "deep copy" |
|
48 | 48 | Invoking status precommit hook |
|
49 | 49 | A dira/foo/largefile |
|
50 | 50 | $ find . | sort |
|
51 | 51 | . |
|
52 | 52 | ./dirb |
|
53 | 53 | ./dirb/largefile |
|
54 | 54 | ./foo |
|
55 | 55 | ./foo/largefile |
|
56 | 56 | $ hg mv foo/largefile baz/largefile |
|
57 | 57 | $ hg ci -m "moved" |
|
58 | 58 | Invoking status precommit hook |
|
59 | 59 | A dira/baz/largefile |
|
60 | 60 | R dira/foo/largefile |
|
61 | 61 | $ find . | sort |
|
62 | 62 | . |
|
63 | 63 | ./baz |
|
64 | 64 | ./baz/largefile |
|
65 | 65 | ./dirb |
|
66 | 66 | ./dirb/largefile |
|
67 | 67 | $ cd .. |
|
68 | 68 | $ hg mv dira dirc |
|
69 | 69 | moving .hglf/dira/baz/largefile to .hglf/dirc/baz/largefile (glob) |
|
70 | 70 | moving .hglf/dira/dirb/largefile to .hglf/dirc/dirb/largefile (glob) |
|
71 | 71 | $ find * | sort |
|
72 | 72 | dirc |
|
73 | 73 | dirc/baz |
|
74 | 74 | dirc/baz/largefile |
|
75 | 75 | dirc/dirb |
|
76 | 76 | dirc/dirb/largefile |
|
77 | 77 | |
|
78 | 78 | $ hg clone -q . ../fetch |
|
79 | 79 | $ hg --config extensions.fetch= fetch ../fetch |
|
80 | 80 | abort: uncommitted changes |
|
81 | 81 | [255] |
|
82 | 82 | $ hg up -qC |
|
83 | 83 | $ cd .. |
|
84 | 84 | |
|
85 | 85 | Clone a local repository owned by another user |
|
86 | 86 | =================================================== |
|
87 | 87 | |
|
88 | 88 | #if unix-permissions |
|
89 | 89 | |
|
90 | 90 | We have to simulate that here by setting $HOME and removing write permissions |
|
91 | 91 | $ ORIGHOME="$HOME" |
|
92 | 92 | $ mkdir alice |
|
93 | 93 | $ HOME="`pwd`/alice" |
|
94 | 94 | $ cd alice |
|
95 | 95 | $ hg init pubrepo |
|
96 | 96 | $ cd pubrepo |
|
97 | 97 | $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null |
|
98 | 98 | $ hg add --large a-large-file |
|
99 | 99 | $ hg commit -m "Add a large file" |
|
100 | 100 | Invoking status precommit hook |
|
101 | 101 | A a-large-file |
|
102 | 102 | $ cd .. |
|
103 | 103 | $ chmod -R a-w pubrepo |
|
104 | 104 | $ cd .. |
|
105 | 105 | $ mkdir bob |
|
106 | 106 | $ HOME="`pwd`/bob" |
|
107 | 107 | $ cd bob |
|
108 | 108 | $ hg clone --pull ../alice/pubrepo pubrepo |
|
109 | 109 | requesting all changes |
|
110 | 110 | adding changesets |
|
111 | 111 | adding manifests |
|
112 | 112 | adding file changes |
|
113 | 113 | added 1 changesets with 1 changes to 1 files |
|
114 | 114 | updating to branch default |
|
115 | 115 | getting changed largefiles |
|
116 | 116 | 1 largefiles updated, 0 removed |
|
117 | 117 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
118 | 118 | $ cd .. |
|
119 | 119 | $ chmod -R u+w alice/pubrepo |
|
120 | 120 | $ HOME="$ORIGHOME" |
|
121 | 121 | |
|
122 | 122 | #endif |
|
123 | 123 | |
|
124 | 124 | |
|
125 | 125 | Symlink to a large largefile should behave the same as a symlink to a normal file |
|
126 | 126 | ===================================================================================== |
|
127 | 127 | |
|
128 | 128 | #if symlink |
|
129 | 129 | |
|
130 | 130 | $ hg init largesymlink |
|
131 | 131 | $ cd largesymlink |
|
132 | 132 | $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null |
|
133 | 133 | $ hg add --large largefile |
|
134 | 134 | $ hg commit -m "commit a large file" |
|
135 | 135 | Invoking status precommit hook |
|
136 | 136 | A largefile |
|
137 | 137 | $ ln -s largefile largelink |
|
138 | 138 | $ hg add largelink |
|
139 | 139 | $ hg commit -m "commit a large symlink" |
|
140 | 140 | Invoking status precommit hook |
|
141 | 141 | A largelink |
|
142 | 142 | $ rm -f largelink |
|
143 | 143 | $ hg up >/dev/null |
|
144 | 144 | $ test -f largelink |
|
145 | 145 | [1] |
|
146 | 146 | $ test -L largelink |
|
147 | 147 | [1] |
|
148 | 148 | $ rm -f largelink # make next part of the test independent of the previous |
|
149 | 149 | $ hg up -C >/dev/null |
|
150 | 150 | $ test -f largelink |
|
151 | 151 | $ test -L largelink |
|
152 | 152 | $ cd .. |
|
153 | 153 | |
|
154 | 154 | #endif |
|
155 | 155 | |
|
156 | 156 | |
|
157 | 157 | test for pattern matching on 'hg status': |
|
158 | 158 | ============================================== |
|
159 | 159 | |
|
160 | 160 | |
|
161 | 161 | to boost performance, largefiles checks whether specified patterns are |
|
162 | 162 | related to largefiles in working directory (NOT to STANDIN) or not. |
|
163 | 163 | |
|
164 | 164 | $ hg init statusmatch |
|
165 | 165 | $ cd statusmatch |
|
166 | 166 | |
|
167 | 167 | $ mkdir -p a/b/c/d |
|
168 | 168 | $ echo normal > a/b/c/d/e.normal.txt |
|
169 | 169 | $ hg add a/b/c/d/e.normal.txt |
|
170 | 170 | $ echo large > a/b/c/d/e.large.txt |
|
171 | 171 | $ hg add --large a/b/c/d/e.large.txt |
|
172 | 172 | $ mkdir -p a/b/c/x |
|
173 | 173 | $ echo normal > a/b/c/x/y.normal.txt |
|
174 | 174 | $ hg add a/b/c/x/y.normal.txt |
|
175 | 175 | $ hg commit -m 'add files' |
|
176 | 176 | Invoking status precommit hook |
|
177 | 177 | A a/b/c/d/e.large.txt |
|
178 | 178 | A a/b/c/d/e.normal.txt |
|
179 | 179 | A a/b/c/x/y.normal.txt |
|
180 | 180 | |
|
181 | 181 | (1) no pattern: no performance boost |
|
182 | 182 | $ hg status -A |
|
183 | 183 | C a/b/c/d/e.large.txt |
|
184 | 184 | C a/b/c/d/e.normal.txt |
|
185 | 185 | C a/b/c/x/y.normal.txt |
|
186 | 186 | |
|
187 | 187 | (2) pattern not related to largefiles: performance boost |
|
188 | 188 | $ hg status -A a/b/c/x |
|
189 | 189 | C a/b/c/x/y.normal.txt |
|
190 | 190 | |
|
191 | 191 | (3) pattern related to largefiles: no performance boost |
|
192 | 192 | $ hg status -A a/b/c/d |
|
193 | 193 | C a/b/c/d/e.large.txt |
|
194 | 194 | C a/b/c/d/e.normal.txt |
|
195 | 195 | |
|
196 | 196 | (4) pattern related to STANDIN (not to largefiles): performance boost |
|
197 | 197 | $ hg status -A .hglf/a |
|
198 | 198 | C .hglf/a/b/c/d/e.large.txt |
|
199 | 199 | |
|
200 | 200 | (5) mixed case: no performance boost |
|
201 | 201 | $ hg status -A a/b/c/x a/b/c/d |
|
202 | 202 | C a/b/c/d/e.large.txt |
|
203 | 203 | C a/b/c/d/e.normal.txt |
|
204 | 204 | C a/b/c/x/y.normal.txt |
|
205 | 205 | |
|
206 | 206 | verify that largefiles doesn't break filesets |
|
207 | 207 | |
|
208 | 208 | $ hg log --rev . --exclude "set:binary()" |
|
209 | 209 | changeset: 0:41bd42f10efa |
|
210 | 210 | tag: tip |
|
211 | 211 | user: test |
|
212 | 212 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
213 | 213 | summary: add files |
|
214 | 214 | |
|
215 | 215 | verify that large files in subrepos handled properly |
|
216 | 216 | $ hg init subrepo |
|
217 | 217 | $ echo "subrepo = subrepo" > .hgsub |
|
218 | 218 | $ hg add .hgsub |
|
219 | 219 | $ hg ci -m "add subrepo" |
|
220 | 220 | Invoking status precommit hook |
|
221 | 221 | A .hgsub |
|
222 | 222 | ? .hgsubstate |
|
223 | 223 | $ echo "rev 1" > subrepo/large.txt |
|
224 | 224 | $ hg add --large subrepo/large.txt |
|
225 | 225 | $ hg sum |
|
226 | 226 | parent: 1:8ee150ea2e9c tip |
|
227 | 227 | add subrepo |
|
228 | 228 | branch: default |
|
229 | 229 | commit: 1 subrepos |
|
230 | 230 | update: (current) |
|
231 | 231 | phases: 2 draft |
|
232 | 232 | $ hg st |
|
233 | 233 | $ hg st -S |
|
234 | 234 | A subrepo/large.txt |
|
235 | 235 | $ hg ci -S -m "commit top repo" |
|
236 | 236 | committing subrepository subrepo |
|
237 | 237 | Invoking status precommit hook |
|
238 | 238 | A large.txt |
|
239 | 239 | Invoking status precommit hook |
|
240 | 240 | M .hgsubstate |
|
241 | 241 | # No differences |
|
242 | 242 | $ hg st -S |
|
243 | 243 | $ hg sum |
|
244 | 244 | parent: 2:ce4cd0c527a6 tip |
|
245 | 245 | commit top repo |
|
246 | 246 | branch: default |
|
247 | 247 | commit: (clean) |
|
248 | 248 | update: (current) |
|
249 | 249 | phases: 3 draft |
|
250 | 250 | $ echo "rev 2" > subrepo/large.txt |
|
251 | 251 | $ hg st -S |
|
252 | 252 | M subrepo/large.txt |
|
253 | 253 | $ hg sum |
|
254 | 254 | parent: 2:ce4cd0c527a6 tip |
|
255 | 255 | commit top repo |
|
256 | 256 | branch: default |
|
257 | 257 | commit: 1 subrepos |
|
258 | 258 | update: (current) |
|
259 | 259 | phases: 3 draft |
|
260 | 260 | $ hg ci -m "this commit should fail without -S" |
|
261 | 261 | abort: uncommitted changes in subrepository 'subrepo' |
|
262 | 262 | (use --subrepos for recursive commit) |
|
263 | 263 | [255] |
|
264 | 264 | |
|
265 | 265 | Add a normal file to the subrepo, then test archiving |
|
266 | 266 | |
|
267 | 267 | $ echo 'normal file' > subrepo/normal.txt |
|
268 | 268 | $ touch large.dat |
|
269 | 269 | $ mv subrepo/large.txt subrepo/renamed-large.txt |
|
270 | 270 | $ hg addremove -S --dry-run |
|
271 | 271 | adding large.dat as a largefile |
|
272 | 272 | removing subrepo/large.txt |
|
273 | 273 | adding subrepo/normal.txt |
|
274 | 274 | adding subrepo/renamed-large.txt |
|
275 | 275 | $ hg status -S |
|
276 | 276 | ! subrepo/large.txt |
|
277 | 277 | ? large.dat |
|
278 | 278 | ? subrepo/normal.txt |
|
279 | 279 | ? subrepo/renamed-large.txt |
|
280 | 280 | |
|
281 | 281 | $ hg addremove --dry-run subrepo |
|
282 | 282 | removing subrepo/large.txt (glob) |
|
283 | 283 | adding subrepo/normal.txt (glob) |
|
284 | 284 | adding subrepo/renamed-large.txt (glob) |
|
285 | 285 | $ hg status -S |
|
286 | 286 | ! subrepo/large.txt |
|
287 | 287 | ? large.dat |
|
288 | 288 | ? subrepo/normal.txt |
|
289 | 289 | ? subrepo/renamed-large.txt |
|
290 | 290 | $ cd .. |
|
291 | 291 | |
|
292 | 292 | $ hg -R statusmatch addremove --dry-run statusmatch/subrepo |
|
293 | 293 | removing statusmatch/subrepo/large.txt (glob) |
|
294 | 294 | adding statusmatch/subrepo/normal.txt (glob) |
|
295 | 295 | adding statusmatch/subrepo/renamed-large.txt (glob) |
|
296 | 296 | $ hg -R statusmatch status -S |
|
297 | 297 | ! subrepo/large.txt |
|
298 | 298 | ? large.dat |
|
299 | 299 | ? subrepo/normal.txt |
|
300 | 300 | ? subrepo/renamed-large.txt |
|
301 | 301 | |
|
302 | 302 | $ hg -R statusmatch addremove --dry-run -S |
|
303 | 303 | adding large.dat as a largefile |
|
304 | 304 | removing subrepo/large.txt |
|
305 | 305 | adding subrepo/normal.txt |
|
306 | 306 | adding subrepo/renamed-large.txt |
|
307 | 307 | $ cd statusmatch |
|
308 | 308 | |
|
309 | 309 | $ mv subrepo/renamed-large.txt subrepo/large.txt |
|
310 | 310 | $ hg addremove subrepo |
|
311 | 311 | adding subrepo/normal.txt (glob) |
|
312 | 312 | $ hg forget subrepo/normal.txt |
|
313 | 313 | |
|
314 | 314 | $ hg addremove -S |
|
315 | 315 | adding large.dat as a largefile |
|
316 | 316 | adding subrepo/normal.txt |
|
317 | 317 | $ rm large.dat |
|
318 | 318 | |
|
319 | 319 | $ hg addremove subrepo |
|
320 | 320 | $ hg addremove -S |
|
321 | 321 | removing large.dat |
|
322 | 322 | |
|
323 | 323 | Lock in subrepo, otherwise the change isn't archived |
|
324 | 324 | |
|
325 | 325 | $ hg ci -S -m "add normal file to top level" |
|
326 | 326 | committing subrepository subrepo |
|
327 | 327 | Invoking status precommit hook |
|
328 | 328 | M large.txt |
|
329 | 329 | A normal.txt |
|
330 | 330 | Invoking status precommit hook |
|
331 | 331 | M .hgsubstate |
|
332 | 332 | $ hg archive -S ../lf_subrepo_archive |
|
333 | 333 | $ find ../lf_subrepo_archive | sort |
|
334 | 334 | ../lf_subrepo_archive |
|
335 | 335 | ../lf_subrepo_archive/.hg_archival.txt |
|
336 | 336 | ../lf_subrepo_archive/.hgsub |
|
337 | 337 | ../lf_subrepo_archive/.hgsubstate |
|
338 | 338 | ../lf_subrepo_archive/a |
|
339 | 339 | ../lf_subrepo_archive/a/b |
|
340 | 340 | ../lf_subrepo_archive/a/b/c |
|
341 | 341 | ../lf_subrepo_archive/a/b/c/d |
|
342 | 342 | ../lf_subrepo_archive/a/b/c/d/e.large.txt |
|
343 | 343 | ../lf_subrepo_archive/a/b/c/d/e.normal.txt |
|
344 | 344 | ../lf_subrepo_archive/a/b/c/x |
|
345 | 345 | ../lf_subrepo_archive/a/b/c/x/y.normal.txt |
|
346 | 346 | ../lf_subrepo_archive/subrepo |
|
347 | 347 | ../lf_subrepo_archive/subrepo/large.txt |
|
348 | 348 | ../lf_subrepo_archive/subrepo/normal.txt |
|
349 | 349 | $ cat ../lf_subrepo_archive/.hg_archival.txt |
|
350 | 350 | repo: 41bd42f10efa43698cc02052ea0977771cba506d |
|
351 | 351 | node: d56a95e6522858bc08a724c4fe2bdee066d1c30b |
|
352 | 352 | branch: default |
|
353 | 353 | latesttag: null |
|
354 | 354 | latesttagdistance: 4 |
|
355 | 355 | changessincelatesttag: 4 |
|
356 | 356 | |
|
357 | 357 | Test update with subrepos. |
|
358 | 358 | |
|
359 | 359 | $ hg update 0 |
|
360 | 360 | getting changed largefiles |
|
361 | 361 | 0 largefiles updated, 1 removed |
|
362 | 362 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
363 | 363 | $ hg status -S |
|
364 | 364 | $ hg update tip |
|
365 | 365 | getting changed largefiles |
|
366 | 366 | 1 largefiles updated, 0 removed |
|
367 | 367 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
368 | 368 | $ hg status -S |
|
369 | 369 | # modify a large file |
|
370 | 370 | $ echo "modified" > subrepo/large.txt |
|
371 | 371 | $ hg st -S |
|
372 | 372 | M subrepo/large.txt |
|
373 | 373 | # update -C should revert the change. |
|
374 | 374 | $ hg update -C |
|
375 | 375 | getting changed largefiles |
|
376 | 376 | 1 largefiles updated, 0 removed |
|
377 | 377 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
378 | 378 | $ hg status -S |
|
379 | 379 | |
|
380 | 380 | $ hg forget -v subrepo/large.txt |
|
381 | 381 | removing subrepo/large.txt (glob) |
|
382 | 382 | |
|
383 | 383 | Test reverting a forgotten file |
|
384 | 384 | $ hg revert -R subrepo subrepo/large.txt |
|
385 | 385 | $ hg status -SA subrepo/large.txt |
|
386 | 386 | C subrepo/large.txt |
|
387 | 387 | |
|
388 | 388 | $ hg rm -v subrepo/large.txt |
|
389 | 389 | removing subrepo/large.txt (glob) |
|
390 | 390 | $ hg revert -R subrepo subrepo/large.txt |
|
391 | 391 | $ rm subrepo/large.txt |
|
392 | 392 | $ hg addremove -S |
|
393 | 393 | removing subrepo/large.txt |
|
394 | 394 | $ hg st -S |
|
395 | 395 | R subrepo/large.txt |
|
396 | 396 | |
|
397 | 397 | Test archiving a revision that references a subrepo that is not yet |
|
398 | 398 | cloned (see test-subrepo-recursion.t): |
|
399 | 399 | |
|
400 | 400 | $ hg clone -U . ../empty |
|
401 | 401 | $ cd ../empty |
|
402 | 402 | $ hg archive --subrepos -r tip ../archive.tar.gz |
|
403 | 403 | cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo |
|
404 | 404 | $ cd .. |
|
405 | 405 | |
|
406 | 406 | |
|
407 | 407 | |
|
408 | 408 | |
|
409 | 409 | |
|
410 | 410 | |
|
411 | 411 | Test addremove, forget and others |
|
412 | 412 | ============================================== |
|
413 | 413 | |
|
414 | 414 | Test that addremove picks up largefiles prior to the initial commit (issue3541) |
|
415 | 415 | |
|
416 | 416 | $ hg init addrm2 |
|
417 | 417 | $ cd addrm2 |
|
418 | 418 | $ touch large.dat |
|
419 | 419 | $ touch large2.dat |
|
420 | 420 | $ touch normal |
|
421 | 421 | $ hg add --large large.dat |
|
422 | 422 | $ hg addremove -v |
|
423 | 423 | adding large2.dat as a largefile |
|
424 | 424 | adding normal |
|
425 | 425 | |
|
426 | 426 | Test that forgetting all largefiles reverts to islfilesrepo() == False |
|
427 | 427 | (addremove will add *.dat as normal files now) |
|
428 | 428 | $ hg forget large.dat |
|
429 | 429 | $ hg forget large2.dat |
|
430 | 430 | $ hg addremove -v |
|
431 | 431 | adding large.dat |
|
432 | 432 | adding large2.dat |
|
433 | 433 | |
|
434 | 434 | Test commit's addremove option prior to the first commit |
|
435 | 435 | $ hg forget large.dat |
|
436 | 436 | $ hg forget large2.dat |
|
437 | 437 | $ hg add --large large.dat |
|
438 | 438 | $ hg ci -Am "commit" |
|
439 | 439 | adding large2.dat as a largefile |
|
440 | 440 | Invoking status precommit hook |
|
441 | 441 | A large.dat |
|
442 | 442 | A large2.dat |
|
443 | 443 | A normal |
|
444 | 444 | $ find .hglf | sort |
|
445 | 445 | .hglf |
|
446 | 446 | .hglf/large.dat |
|
447 | 447 | .hglf/large2.dat |
|
448 | 448 | |
|
449 | 449 | Test actions on largefiles using relative paths from subdir |
|
450 | 450 | |
|
451 | 451 | $ mkdir sub |
|
452 | 452 | $ cd sub |
|
453 | 453 | $ echo anotherlarge > anotherlarge |
|
454 | 454 | $ hg add --large anotherlarge |
|
455 | 455 | $ hg st |
|
456 | 456 | A sub/anotherlarge |
|
457 | 457 | $ hg st anotherlarge |
|
458 | 458 | A anotherlarge |
|
459 | 459 | $ hg commit -m anotherlarge anotherlarge |
|
460 | 460 | Invoking status precommit hook |
|
461 | 461 | A sub/anotherlarge |
|
462 | 462 | $ hg log anotherlarge |
|
463 | 463 | changeset: 1:9627a577c5e9 |
|
464 | 464 | tag: tip |
|
465 | 465 | user: test |
|
466 | 466 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
467 | 467 | summary: anotherlarge |
|
468 | 468 | |
|
469 | 469 | $ hg --debug log -T '{rev}: {desc}\n' ../sub/anotherlarge |
|
470 | 470 | updated patterns: ['../.hglf/sub/../sub/anotherlarge', '../sub/anotherlarge'] |
|
471 | 471 | 1: anotherlarge |
|
472 | 472 | |
|
473 | 473 | $ hg log -G anotherlarge |
|
474 | 474 | @ changeset: 1:9627a577c5e9 |
|
475 | 475 | | tag: tip |
|
476 | 476 | | user: test |
|
477 | 477 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
478 | 478 | | summary: anotherlarge |
|
479 | 479 | | |
|
480 | 480 | |
|
481 | 481 | $ hg log glob:another* |
|
482 | 482 | changeset: 1:9627a577c5e9 |
|
483 | 483 | tag: tip |
|
484 | 484 | user: test |
|
485 | 485 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
486 | 486 | summary: anotherlarge |
|
487 | 487 | |
|
488 | 488 | $ hg --debug log -T '{rev}: {desc}\n' -G glob:another* |
|
489 | 489 | updated patterns: ['glob:../.hglf/sub/another*', 'glob:another*'] |
|
490 | 490 | @ 1: anotherlarge |
|
491 | 491 | | |
|
492 | 492 | |
|
493 | 493 | #if no-msys |
|
494 | 494 | $ hg --debug log -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys |
|
495 | 495 | updated patterns: ['glob:../.hglf/sub/another*'] |
|
496 | 496 | 1: anotherlarge |
|
497 | 497 | |
|
498 | 498 | $ hg --debug log -G -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys |
|
499 | 499 | updated patterns: ['glob:../.hglf/sub/another*'] |
|
500 | 500 | @ 1: anotherlarge |
|
501 | 501 | | |
|
502 | 502 | #endif |
|
503 | 503 | |
|
504 | 504 | $ echo more >> anotherlarge |
|
505 | 505 | $ hg st . |
|
506 | 506 | M anotherlarge |
|
507 | 507 | $ hg cat anotherlarge |
|
508 | 508 | anotherlarge |
|
509 | 509 | $ hg revert anotherlarge |
|
510 | 510 | $ hg st |
|
511 | 511 | ? sub/anotherlarge.orig |
|
512 | 512 | $ cd .. |
|
513 | 513 | |
|
514 | 514 | Test glob logging from the root dir |
|
515 | 515 | $ hg log glob:**another* |
|
516 | 516 | changeset: 1:9627a577c5e9 |
|
517 | 517 | tag: tip |
|
518 | 518 | user: test |
|
519 | 519 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
520 | 520 | summary: anotherlarge |
|
521 | 521 | |
|
522 | 522 | $ hg log -G glob:**another* |
|
523 | 523 | @ changeset: 1:9627a577c5e9 |
|
524 | 524 | | tag: tip |
|
525 | 525 | | user: test |
|
526 | 526 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
527 | 527 | | summary: anotherlarge |
|
528 | 528 | | |
|
529 | 529 | |
|
530 | 530 | $ cd .. |
|
531 | 531 | |
|
532 | 532 | Log from outer space |
|
533 | 533 | $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/sub/anotherlarge' |
|
534 | 534 | updated patterns: ['addrm2/.hglf/sub/anotherlarge', 'addrm2/sub/anotherlarge'] |
|
535 | 535 | 1: anotherlarge |
|
536 | 536 | $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/.hglf/sub/anotherlarge' |
|
537 | 537 | updated patterns: ['addrm2/.hglf/sub/anotherlarge'] |
|
538 | 538 | 1: anotherlarge |
|
539 | 539 | |
|
540 | 540 | |
|
541 | 541 | Check error message while exchange |
|
542 | 542 | ========================================================= |
|
543 | 543 | |
|
544 | 544 | issue3651: summary/outgoing with largefiles shows "no remote repo" |
|
545 | 545 | unexpectedly |
|
546 | 546 | |
|
547 | 547 | $ mkdir issue3651 |
|
548 | 548 | $ cd issue3651 |
|
549 | 549 | |
|
550 | 550 | $ hg init src |
|
551 | 551 | $ echo a > src/a |
|
552 | 552 | $ hg -R src add --large src/a |
|
553 | 553 | $ hg -R src commit -m '#0' |
|
554 | 554 | Invoking status precommit hook |
|
555 | 555 | A a |
|
556 | 556 | |
|
557 | 557 | check messages when no remote repository is specified: |
|
558 | 558 | "no remote repo" route for "hg outgoing --large" is not tested here, |
|
559 | 559 | because it can't be reproduced easily. |
|
560 | 560 | |
|
561 | 561 | $ hg init clone1 |
|
562 | 562 | $ hg -R clone1 -q pull src |
|
563 | 563 | $ hg -R clone1 -q update |
|
564 | 564 | $ hg -R clone1 paths | grep default |
|
565 | 565 | [1] |
|
566 | 566 | |
|
567 | 567 | $ hg -R clone1 summary --large |
|
568 | 568 | parent: 0:fc0bd45326d3 tip |
|
569 | 569 | #0 |
|
570 | 570 | branch: default |
|
571 | 571 | commit: (clean) |
|
572 | 572 | update: (current) |
|
573 | 573 | phases: 1 draft |
|
574 | 574 | largefiles: (no remote repo) |
|
575 | 575 | |
|
576 | 576 | check messages when there is no files to upload: |
|
577 | 577 | |
|
578 | 578 | $ hg -q clone src clone2 |
|
579 | 579 | $ hg -R clone2 paths | grep default |
|
580 | 580 | default = $TESTTMP/issue3651/src (glob) |
|
581 | 581 | |
|
582 | 582 | $ hg -R clone2 summary --large |
|
583 | 583 | parent: 0:fc0bd45326d3 tip |
|
584 | 584 | #0 |
|
585 | 585 | branch: default |
|
586 | 586 | commit: (clean) |
|
587 | 587 | update: (current) |
|
588 | 588 | phases: 1 draft |
|
589 | 589 | largefiles: (no files to upload) |
|
590 | 590 | $ hg -R clone2 outgoing --large |
|
591 | 591 | comparing with $TESTTMP/issue3651/src (glob) |
|
592 | 592 | searching for changes |
|
593 | 593 | no changes found |
|
594 | 594 | largefiles: no files to upload |
|
595 | 595 | [1] |
|
596 | 596 | |
|
597 | 597 | $ hg -R clone2 outgoing --large --graph --template "{rev}" |
|
598 | 598 | comparing with $TESTTMP/issue3651/src (glob) |
|
599 | 599 | searching for changes |
|
600 | 600 | no changes found |
|
601 | 601 | largefiles: no files to upload |
|
602 | 602 | |
|
603 | 603 | check messages when there are files to upload: |
|
604 | 604 | |
|
605 | 605 | $ echo b > clone2/b |
|
606 | 606 | $ hg -R clone2 add --large clone2/b |
|
607 | 607 | $ hg -R clone2 commit -m '#1' |
|
608 | 608 | Invoking status precommit hook |
|
609 | 609 | A b |
|
610 | 610 | $ hg -R clone2 summary --large |
|
611 | 611 | parent: 1:1acbe71ce432 tip |
|
612 | 612 | #1 |
|
613 | 613 | branch: default |
|
614 | 614 | commit: (clean) |
|
615 | 615 | update: (current) |
|
616 | 616 | phases: 2 draft |
|
617 | 617 | largefiles: 1 entities for 1 files to upload |
|
618 | 618 | $ hg -R clone2 outgoing --large |
|
619 | 619 | comparing with $TESTTMP/issue3651/src (glob) |
|
620 | 620 | searching for changes |
|
621 | 621 | changeset: 1:1acbe71ce432 |
|
622 | 622 | tag: tip |
|
623 | 623 | user: test |
|
624 | 624 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
625 | 625 | summary: #1 |
|
626 | 626 | |
|
627 | 627 | largefiles to upload (1 entities): |
|
628 | 628 | b |
|
629 | 629 | |
|
630 | 630 | $ hg -R clone2 outgoing --large --graph --template "{rev}" |
|
631 | 631 | comparing with $TESTTMP/issue3651/src (glob) |
|
632 | 632 | searching for changes |
|
633 | 633 | @ 1 |
|
634 | 634 | |
|
635 | 635 | largefiles to upload (1 entities): |
|
636 | 636 | b |
|
637 | 637 | |
|
638 | 638 | |
|
639 | 639 | $ cp clone2/b clone2/b1 |
|
640 | 640 | $ cp clone2/b clone2/b2 |
|
641 | 641 | $ hg -R clone2 add --large clone2/b1 clone2/b2 |
|
642 | 642 | $ hg -R clone2 commit -m '#2: add largefiles referring same entity' |
|
643 | 643 | Invoking status precommit hook |
|
644 | 644 | A b1 |
|
645 | 645 | A b2 |
|
646 | 646 | $ hg -R clone2 summary --large |
|
647 | 647 | parent: 2:6095d0695d70 tip |
|
648 | 648 | #2: add largefiles referring same entity |
|
649 | 649 | branch: default |
|
650 | 650 | commit: (clean) |
|
651 | 651 | update: (current) |
|
652 | 652 | phases: 3 draft |
|
653 | 653 | largefiles: 1 entities for 3 files to upload |
|
654 | 654 | $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" |
|
655 | 655 | comparing with $TESTTMP/issue3651/src (glob) |
|
656 | 656 | searching for changes |
|
657 | 657 | 1:1acbe71ce432 |
|
658 | 658 | 2:6095d0695d70 |
|
659 | 659 | largefiles to upload (1 entities): |
|
660 | 660 | b |
|
661 | 661 | b1 |
|
662 | 662 | b2 |
|
663 | 663 | |
|
664 | 664 | $ hg -R clone2 cat -r 1 clone2/.hglf/b |
|
665 | 665 | 89e6c98d92887913cadf06b2adb97f26cde4849b |
|
666 | 666 | $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true |
|
667 | 667 | comparing with $TESTTMP/issue3651/src (glob) |
|
668 | 668 | query 1; heads |
|
669 | 669 | searching for changes |
|
670 | 670 | all remote heads known locally |
|
671 | 671 | 1:1acbe71ce432 |
|
672 | 672 | 2:6095d0695d70 |
|
673 | 673 | finding outgoing largefiles: 0/2 revision (0.00%) |
|
674 | 674 | finding outgoing largefiles: 1/2 revision (50.00%) |
|
675 | 675 | largefiles to upload (1 entities): |
|
676 | 676 | b |
|
677 | 677 | 89e6c98d92887913cadf06b2adb97f26cde4849b |
|
678 | 678 | b1 |
|
679 | 679 | 89e6c98d92887913cadf06b2adb97f26cde4849b |
|
680 | 680 | b2 |
|
681 | 681 | 89e6c98d92887913cadf06b2adb97f26cde4849b |
|
682 | 682 | |
|
683 | 683 | |
|
684 | 684 | $ echo bbb > clone2/b |
|
685 | 685 | $ hg -R clone2 commit -m '#3: add new largefile entity as existing file' |
|
686 | 686 | Invoking status precommit hook |
|
687 | 687 | M b |
|
688 | 688 | $ echo bbbb > clone2/b |
|
689 | 689 | $ hg -R clone2 commit -m '#4: add new largefile entity as existing file' |
|
690 | 690 | Invoking status precommit hook |
|
691 | 691 | M b |
|
692 | 692 | $ cp clone2/b1 clone2/b |
|
693 | 693 | $ hg -R clone2 commit -m '#5: refer existing largefile entity again' |
|
694 | 694 | Invoking status precommit hook |
|
695 | 695 | M b |
|
696 | 696 | $ hg -R clone2 summary --large |
|
697 | 697 | parent: 5:036794ea641c tip |
|
698 | 698 | #5: refer existing largefile entity again |
|
699 | 699 | branch: default |
|
700 | 700 | commit: (clean) |
|
701 | 701 | update: (current) |
|
702 | 702 | phases: 6 draft |
|
703 | 703 | largefiles: 3 entities for 3 files to upload |
|
704 | 704 | $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" |
|
705 | 705 | comparing with $TESTTMP/issue3651/src (glob) |
|
706 | 706 | searching for changes |
|
707 | 707 | 1:1acbe71ce432 |
|
708 | 708 | 2:6095d0695d70 |
|
709 | 709 | 3:7983dce246cc |
|
710 | 710 | 4:233f12ada4ae |
|
711 | 711 | 5:036794ea641c |
|
712 | 712 | largefiles to upload (3 entities): |
|
713 | 713 | b |
|
714 | 714 | b1 |
|
715 | 715 | b2 |
|
716 | 716 | |
|
717 | 717 | $ hg -R clone2 cat -r 3 clone2/.hglf/b |
|
718 | 718 | c801c9cfe94400963fcb683246217d5db77f9a9a |
|
719 | 719 | $ hg -R clone2 cat -r 4 clone2/.hglf/b |
|
720 | 720 | 13f9ed0898e315bf59dc2973fec52037b6f441a2 |
|
721 | 721 | $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true |
|
722 | 722 | comparing with $TESTTMP/issue3651/src (glob) |
|
723 | 723 | query 1; heads |
|
724 | 724 | searching for changes |
|
725 | 725 | all remote heads known locally |
|
726 | 726 | 1:1acbe71ce432 |
|
727 | 727 | 2:6095d0695d70 |
|
728 | 728 | 3:7983dce246cc |
|
729 | 729 | 4:233f12ada4ae |
|
730 | 730 | 5:036794ea641c |
|
731 | 731 | finding outgoing largefiles: 0/5 revision (0.00%) |
|
732 | 732 | finding outgoing largefiles: 1/5 revision (20.00%) |
|
733 | 733 | finding outgoing largefiles: 2/5 revision (40.00%) |
|
734 | 734 | finding outgoing largefiles: 3/5 revision (60.00%) |
|
735 | 735 | finding outgoing largefiles: 4/5 revision (80.00%) |
|
736 | 736 | largefiles to upload (3 entities): |
|
737 | 737 | b |
|
738 | 738 | 13f9ed0898e315bf59dc2973fec52037b6f441a2 |
|
739 | 739 | 89e6c98d92887913cadf06b2adb97f26cde4849b |
|
740 | 740 | c801c9cfe94400963fcb683246217d5db77f9a9a |
|
741 | 741 | b1 |
|
742 | 742 | 89e6c98d92887913cadf06b2adb97f26cde4849b |
|
743 | 743 | b2 |
|
744 | 744 | 89e6c98d92887913cadf06b2adb97f26cde4849b |
|
745 | 745 | |
|
746 | 746 | |
|
747 | 747 | Pushing revision #1 causes uploading entity 89e6c98d9288, which is |
|
748 | 748 | shared also by largefiles b1, b2 in revision #2 and b in revision #5. |
|
749 | 749 | |
|
750 | 750 | Then, entity 89e6c98d9288 is not treated as "outgoing entity" at "hg |
|
751 | 751 | summary" and "hg outgoing", even though files in outgoing revision #2 |
|
752 | 752 | and #5 refer it. |
|
753 | 753 | |
|
754 | 754 | $ hg -R clone2 push -r 1 -q |
|
755 | 755 | $ hg -R clone2 summary --large |
|
756 | 756 | parent: 5:036794ea641c tip |
|
757 | 757 | #5: refer existing largefile entity again |
|
758 | 758 | branch: default |
|
759 | 759 | commit: (clean) |
|
760 | 760 | update: (current) |
|
761 | 761 | phases: 6 draft |
|
762 | 762 | largefiles: 2 entities for 1 files to upload |
|
763 | 763 | $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" |
|
764 | 764 | comparing with $TESTTMP/issue3651/src (glob) |
|
765 | 765 | searching for changes |
|
766 | 766 | 2:6095d0695d70 |
|
767 | 767 | 3:7983dce246cc |
|
768 | 768 | 4:233f12ada4ae |
|
769 | 769 | 5:036794ea641c |
|
770 | 770 | largefiles to upload (2 entities): |
|
771 | 771 | b |
|
772 | 772 | |
|
773 | 773 | $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true |
|
774 | 774 | comparing with $TESTTMP/issue3651/src (glob) |
|
775 | 775 | query 1; heads |
|
776 | 776 | searching for changes |
|
777 | 777 | all remote heads known locally |
|
778 | 778 | 2:6095d0695d70 |
|
779 | 779 | 3:7983dce246cc |
|
780 | 780 | 4:233f12ada4ae |
|
781 | 781 | 5:036794ea641c |
|
782 | 782 | finding outgoing largefiles: 0/4 revision (0.00%) |
|
783 | 783 | finding outgoing largefiles: 1/4 revision (25.00%) |
|
784 | 784 | finding outgoing largefiles: 2/4 revision (50.00%) |
|
785 | 785 | finding outgoing largefiles: 3/4 revision (75.00%) |
|
786 | 786 | largefiles to upload (2 entities): |
|
787 | 787 | b |
|
788 | 788 | 13f9ed0898e315bf59dc2973fec52037b6f441a2 |
|
789 | 789 | c801c9cfe94400963fcb683246217d5db77f9a9a |
|
790 | 790 | |
|
791 | 791 | |
|
792 | 792 | $ cd .. |
|
793 | 793 | |
|
794 | 794 | merge action 'd' for 'local renamed directory to d2/g' which has no filename |
|
795 | 795 | ================================================================================== |
|
796 | 796 | |
|
797 | 797 | $ hg init merge-action |
|
798 | 798 | $ cd merge-action |
|
799 | 799 | $ touch l |
|
800 | 800 | $ hg add --large l |
|
801 | 801 | $ mkdir d1 |
|
802 | 802 | $ touch d1/f |
|
803 | 803 | $ hg ci -Aqm0 |
|
804 | 804 | Invoking status precommit hook |
|
805 | 805 | A d1/f |
|
806 | 806 | A l |
|
807 | 807 | $ echo > d1/f |
|
808 | 808 | $ touch d1/g |
|
809 | 809 | $ hg ci -Aqm1 |
|
810 | 810 | Invoking status precommit hook |
|
811 | 811 | M d1/f |
|
812 | 812 | A d1/g |
|
813 | 813 | $ hg up -qr0 |
|
814 | 814 | $ hg mv d1 d2 |
|
815 | 815 | moving d1/f to d2/f (glob) |
|
816 | 816 | $ hg ci -qm2 |
|
817 | 817 | Invoking status precommit hook |
|
818 | 818 | A d2/f |
|
819 | 819 | R d1/f |
|
820 | 820 | $ hg merge |
|
821 | 821 | merging d2/f and d1/f to d2/f |
|
822 | 822 | 1 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
823 | 823 | (branch merge, don't forget to commit) |
|
824 | 824 | $ cd .. |
|
825 | 825 | |
|
826 | 826 | |
|
827 | 827 | Merge conflicts: |
|
828 | 828 | ===================== |
|
829 | 829 | |
|
830 | 830 | $ hg init merge |
|
831 | 831 | $ cd merge |
|
832 | 832 | $ echo 0 > f-different |
|
833 | 833 | $ echo 0 > f-same |
|
834 | 834 | $ echo 0 > f-unchanged-1 |
|
835 | 835 | $ echo 0 > f-unchanged-2 |
|
836 | 836 | $ hg add --large * |
|
837 | 837 | $ hg ci -m0 |
|
838 | 838 | Invoking status precommit hook |
|
839 | 839 | A f-different |
|
840 | 840 | A f-same |
|
841 | 841 | A f-unchanged-1 |
|
842 | 842 | A f-unchanged-2 |
|
843 | 843 | $ echo tmp1 > f-unchanged-1 |
|
844 | 844 | $ echo tmp1 > f-unchanged-2 |
|
845 | 845 | $ echo tmp1 > f-same |
|
846 | 846 | $ hg ci -m1 |
|
847 | 847 | Invoking status precommit hook |
|
848 | 848 | M f-same |
|
849 | 849 | M f-unchanged-1 |
|
850 | 850 | M f-unchanged-2 |
|
851 | 851 | $ echo 2 > f-different |
|
852 | 852 | $ echo 0 > f-unchanged-1 |
|
853 | 853 | $ echo 1 > f-unchanged-2 |
|
854 | 854 | $ echo 1 > f-same |
|
855 | 855 | $ hg ci -m2 |
|
856 | 856 | Invoking status precommit hook |
|
857 | 857 | M f-different |
|
858 | 858 | M f-same |
|
859 | 859 | M f-unchanged-1 |
|
860 | 860 | M f-unchanged-2 |
|
861 | 861 | $ hg up -qr0 |
|
862 | 862 | $ echo tmp2 > f-unchanged-1 |
|
863 | 863 | $ echo tmp2 > f-unchanged-2 |
|
864 | 864 | $ echo tmp2 > f-same |
|
865 | 865 | $ hg ci -m3 |
|
866 | 866 | Invoking status precommit hook |
|
867 | 867 | M f-same |
|
868 | 868 | M f-unchanged-1 |
|
869 | 869 | M f-unchanged-2 |
|
870 | 870 | created new head |
|
871 | 871 | $ echo 1 > f-different |
|
872 | 872 | $ echo 1 > f-unchanged-1 |
|
873 | 873 | $ echo 0 > f-unchanged-2 |
|
874 | 874 | $ echo 1 > f-same |
|
875 | 875 | $ hg ci -m4 |
|
876 | 876 | Invoking status precommit hook |
|
877 | 877 | M f-different |
|
878 | 878 | M f-same |
|
879 | 879 | M f-unchanged-1 |
|
880 | 880 | M f-unchanged-2 |
|
881 | 881 | $ hg merge |
|
882 | 882 | largefile f-different has a merge conflict |
|
883 | 883 | ancestor was 09d2af8dd22201dd8d48e5dcfcaed281ff9422c7 |
|
884 | 884 | keep (l)ocal e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e or |
|
885 | 885 | take (o)ther 7448d8798a4380162d4b56f9b452e2f6f9e24e7a? l |
|
886 | 886 | getting changed largefiles |
|
887 | 887 | 1 largefiles updated, 0 removed |
|
888 | 888 | 0 files updated, 4 files merged, 0 files removed, 0 files unresolved |
|
889 | 889 | (branch merge, don't forget to commit) |
|
890 | 890 | $ cat f-different |
|
891 | 891 | 1 |
|
892 | 892 | $ cat f-same |
|
893 | 893 | 1 |
|
894 | 894 | $ cat f-unchanged-1 |
|
895 | 895 | 1 |
|
896 | 896 | $ cat f-unchanged-2 |
|
897 | 897 | 1 |
|
898 | 898 | $ cd .. |
|
899 | 899 | |
|
900 | 900 | Test largefile insulation (do not enabled a side effect |
|
901 | 901 | ======================================================== |
|
902 | 902 | |
|
903 | 903 | Check whether "largefiles" feature is supported only in repositories |
|
904 | 904 | enabling largefiles extension. |
|
905 | 905 | |
|
906 | 906 | $ mkdir individualenabling |
|
907 | 907 | $ cd individualenabling |
|
908 | 908 | |
|
909 | 909 | $ hg init enabledlocally |
|
910 | 910 | $ echo large > enabledlocally/large |
|
911 | 911 | $ hg -R enabledlocally add --large enabledlocally/large |
|
912 | 912 | $ hg -R enabledlocally commit -m '#0' |
|
913 | 913 | Invoking status precommit hook |
|
914 | 914 | A large |
|
915 | 915 | |
|
916 | 916 | $ hg init notenabledlocally |
|
917 | 917 | $ echo large > notenabledlocally/large |
|
918 | 918 | $ hg -R notenabledlocally add --large notenabledlocally/large |
|
919 | 919 | $ hg -R notenabledlocally commit -m '#0' |
|
920 | 920 | Invoking status precommit hook |
|
921 | 921 | A large |
|
922 | 922 | |
|
923 | 923 | $ cat >> $HGRCPATH <<EOF |
|
924 | 924 | > [extensions] |
|
925 | 925 | > # disable globally |
|
926 | 926 | > largefiles=! |
|
927 | 927 | > EOF |
|
928 | 928 | $ cat >> enabledlocally/.hg/hgrc <<EOF |
|
929 | 929 | > [extensions] |
|
930 | 930 | > # enable locally |
|
931 | 931 | > largefiles= |
|
932 | 932 | > EOF |
|
933 | 933 | $ hg -R enabledlocally root |
|
934 | 934 | $TESTTMP/individualenabling/enabledlocally (glob) |
|
935 | 935 | $ hg -R notenabledlocally root |
|
936 | 936 | abort: repository requires features unknown to this Mercurial: largefiles! |
|
937 | 937 | (see http://mercurial.selenic.com/wiki/MissingRequirement for more information) |
|
938 | 938 | [255] |
|
939 | 939 | |
|
940 | 940 | $ hg init push-dst |
|
941 | 941 | $ hg -R enabledlocally push push-dst |
|
942 | 942 | pushing to push-dst |
|
943 | 943 | abort: required features are not supported in the destination: largefiles |
|
944 | 944 | [255] |
|
945 | 945 | |
|
946 | 946 | $ hg init pull-src |
|
947 | 947 | $ hg -R pull-src pull enabledlocally |
|
948 | 948 | pulling from enabledlocally |
|
949 | 949 | abort: required features are not supported in the destination: largefiles |
|
950 | 950 | [255] |
|
951 | 951 | |
|
952 | 952 | $ hg clone enabledlocally clone-dst |
|
953 | 953 | abort: repository requires features unknown to this Mercurial: largefiles! |
|
954 | 954 | (see http://mercurial.selenic.com/wiki/MissingRequirement for more information) |
|
955 | 955 | [255] |
|
956 | 956 | $ test -d clone-dst |
|
957 | 957 | [1] |
|
958 | 958 | $ hg clone --pull enabledlocally clone-pull-dst |
|
959 | 959 | abort: required features are not supported in the destination: largefiles |
|
960 | 960 | [255] |
|
961 | 961 | $ test -d clone-pull-dst |
|
962 | 962 | [1] |
|
963 | 963 | |
|
964 | 964 | #if serve |
|
965 | 965 | |
|
966 | 966 | Test largefiles specific peer setup, when largefiles is enabled |
|
967 | 967 | locally (issue4109) |
|
968 | 968 | |
|
969 | 969 | $ hg showconfig extensions | grep largefiles |
|
970 | 970 | extensions.largefiles=! |
|
971 | 971 | $ mkdir -p $TESTTMP/individualenabling/usercache |
|
972 | 972 | |
|
973 | 973 | $ hg serve -R enabledlocally -d -p $HGPORT --pid-file hg.pid |
|
974 | 974 | $ cat hg.pid >> $DAEMON_PIDS |
|
975 | 975 | |
|
976 | 976 | $ hg init pull-dst |
|
977 | 977 | $ cat > pull-dst/.hg/hgrc <<EOF |
|
978 | 978 | > [extensions] |
|
979 | 979 | > # enable locally |
|
980 | 980 | > largefiles= |
|
981 | 981 | > [largefiles] |
|
982 | 982 | > # ignore system cache to force largefiles specific wire proto access |
|
983 | 983 | > usercache=$TESTTMP/individualenabling/usercache |
|
984 | 984 | > EOF |
|
985 | 985 | $ hg -R pull-dst -q pull -u http://localhost:$HGPORT |
|
986 | 986 | |
|
987 | 987 | $ killdaemons.py |
|
988 | 988 | #endif |
|
989 | 989 | |
|
990 | 990 | Test overridden functions work correctly even for repos disabling |
|
991 | 991 | largefiles (issue4547) |
|
992 | 992 | |
|
993 | 993 | $ hg showconfig extensions | grep largefiles |
|
994 | 994 | extensions.largefiles=! |
|
995 | 995 | |
|
996 | 996 | (test updating implied by clone) |
|
997 | 997 | |
|
998 | 998 | $ hg init enabled-but-no-largefiles |
|
999 | 999 | $ echo normal1 > enabled-but-no-largefiles/normal1 |
|
1000 | 1000 | $ hg -R enabled-but-no-largefiles add enabled-but-no-largefiles/normal1 |
|
1001 | 1001 | $ hg -R enabled-but-no-largefiles commit -m '#0@enabled-but-no-largefiles' |
|
1002 | 1002 | Invoking status precommit hook |
|
1003 | 1003 | A normal1 |
|
1004 | 1004 | $ cat >> enabled-but-no-largefiles/.hg/hgrc <<EOF |
|
1005 | 1005 | > [extensions] |
|
1006 | 1006 | > # enable locally |
|
1007 | 1007 | > largefiles= |
|
1008 | 1008 | > EOF |
|
1009 | 1009 | $ hg clone -q enabled-but-no-largefiles no-largefiles |
|
1010 | 1010 | |
|
1011 | (test rebasing implied by pull: precommit while rebasing unexpectedly | |
|
1012 | shows "normal3" as "?", because lfdirstate isn't yet written out at | |
|
1013 | that time) | |
|
1014 | ||
|
1015 | 1011 | $ echo normal2 > enabled-but-no-largefiles/normal2 |
|
1016 | 1012 | $ hg -R enabled-but-no-largefiles add enabled-but-no-largefiles/normal2 |
|
1017 | 1013 |
|
|
1018 | 1014 | Invoking status precommit hook |
|
1019 | 1015 | A normal2 |
|
1020 | 1016 | |
|
1021 | 1017 | $ echo normal3 > no-largefiles/normal3 |
|
1022 | 1018 | $ hg -R no-largefiles add no-largefiles/normal3 |
|
1023 | 1019 |
|
|
1024 | 1020 | Invoking status precommit hook |
|
1025 | 1021 | A normal3 |
|
1026 | 1022 | |
|
1027 | 1023 | $ hg -R no-largefiles -q pull --rebase |
|
1028 | 1024 | Invoking status precommit hook |
|
1029 |
|
|
|
1025 | A normal3 | |
|
1030 | 1026 | |
|
1031 | 1027 | (test reverting) |
|
1032 | 1028 | |
|
1033 | 1029 | $ hg init subrepo-root |
|
1034 | 1030 | $ cat >> subrepo-root/.hg/hgrc <<EOF |
|
1035 | 1031 | > [extensions] |
|
1036 | 1032 |
> # |
|
1037 | 1033 | > largefiles= |
|
1038 | 1034 | > EOF |
|
1039 | 1035 |
$ |
|
1040 | 1036 |
$ |
|
1041 | 1037 |
$ |
|
1042 | 1038 |
$ |
|
1043 | 1039 | > no-largefiles = no-largefiles |
|
1044 | 1040 | > EOF |
|
1045 | 1041 |
$ |
|
1046 | 1042 |
$ |
|
1047 | 1043 |
|
|
1048 | 1044 |
|
|
1049 | 1045 |
|
|
1050 | 1046 | ? .hgsubstate |
|
1051 | 1047 |
$ echo |
|
1052 | 1048 | $ echo dirty >> subrepo-root/no-largefiles/normal1 |
|
1053 | 1049 | $ hg -R subrepo-root status -S |
|
1054 | 1050 | M large |
|
1055 | 1051 | M no-largefiles/normal1 |
|
1056 | 1052 | $ hg -R subrepo-root revert --all |
|
1057 | 1053 | reverting subrepo-root/.hglf/large (glob) |
|
1058 | 1054 | reverting subrepo no-largefiles |
|
1059 | 1055 | reverting subrepo-root/no-largefiles/normal1 (glob) |
|
1060 | 1056 | |
|
1061 | 1057 | $ cd .. |
|
1062 | 1058 | |
|
1063 | 1059 | |
|
1064 | 1060 | Test "pull --rebase" when rebase is enabled before largefiles (issue3861) |
|
1065 | 1061 | ========================================================================= |
|
1066 | 1062 | |
|
1067 | 1063 | $ hg showconfig extensions | grep largefiles |
|
1068 | 1064 | extensions.largefiles=! |
|
1069 | 1065 | |
|
1070 | 1066 | $ mkdir issue3861 |
|
1071 | 1067 | $ cd issue3861 |
|
1072 | 1068 | $ hg init src |
|
1073 | 1069 | $ hg clone -q src dst |
|
1074 | 1070 | $ echo a > src/a |
|
1075 | 1071 | $ hg -R src commit -Aqm "#0" |
|
1076 | 1072 | Invoking status precommit hook |
|
1077 | 1073 | A a |
|
1078 | 1074 | |
|
1079 | 1075 | $ cat >> dst/.hg/hgrc <<EOF |
|
1080 | 1076 | > [extensions] |
|
1081 | 1077 | > largefiles= |
|
1082 | 1078 | > EOF |
|
1083 | 1079 |
$ |
|
1084 | 1080 |
|
|
1085 | 1081 |
|
|
1086 | 1082 |
|
|
1087 | 1083 |
|
|
1088 | 1084 |
|
|
1089 | 1085 |
|
|
1090 | 1086 |
|
|
1091 | 1087 |
|
|
1092 | 1088 | |
|
1093 | 1089 |
$ |
@@ -1,1003 +1,1030 b'' | |||
|
1 | 1 | test merge-tools configuration - mostly exercising filemerge.py |
|
2 | 2 | |
|
3 | 3 | $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test |
|
4 | 4 | $ hg init |
|
5 | 5 | |
|
6 | 6 | revision 0 |
|
7 | 7 | |
|
8 | 8 | $ echo "revision 0" > f |
|
9 | 9 | $ echo "space" >> f |
|
10 | 10 | $ hg commit -Am "revision 0" |
|
11 | 11 | adding f |
|
12 | 12 | |
|
13 | 13 | revision 1 |
|
14 | 14 | |
|
15 | 15 | $ echo "revision 1" > f |
|
16 | 16 | $ echo "space" >> f |
|
17 | 17 | $ hg commit -Am "revision 1" |
|
18 | 18 | $ hg update 0 > /dev/null |
|
19 | 19 | |
|
20 | 20 | revision 2 |
|
21 | 21 | |
|
22 | 22 | $ echo "revision 2" > f |
|
23 | 23 | $ echo "space" >> f |
|
24 | 24 | $ hg commit -Am "revision 2" |
|
25 | 25 | created new head |
|
26 | 26 | $ hg update 0 > /dev/null |
|
27 | 27 | |
|
28 | 28 | revision 3 - simple to merge |
|
29 | 29 | |
|
30 | 30 | $ echo "revision 3" >> f |
|
31 | 31 | $ hg commit -Am "revision 3" |
|
32 | 32 | created new head |
|
33 | 33 | |
|
34 | 34 | revision 4 - hard to merge |
|
35 | 35 | |
|
36 | 36 | $ hg update 0 > /dev/null |
|
37 | 37 | $ echo "revision 4" > f |
|
38 | 38 | $ hg commit -Am "revision 4" |
|
39 | 39 | created new head |
|
40 | 40 | |
|
41 | 41 | $ echo "[merge-tools]" > .hg/hgrc |
|
42 | 42 | |
|
43 | 43 | $ beforemerge() { |
|
44 | 44 | > cat .hg/hgrc |
|
45 | 45 | > echo "# hg update -C 1" |
|
46 | 46 | > hg update -C 1 > /dev/null |
|
47 | 47 | > } |
|
48 | 48 | $ aftermerge() { |
|
49 | 49 | > echo "# cat f" |
|
50 | 50 | > cat f |
|
51 | 51 | > echo "# hg stat" |
|
52 | 52 | > hg stat |
|
53 | 53 | > rm -f f.orig |
|
54 | 54 | > } |
|
55 | 55 | |
|
56 | 56 | Tool selection |
|
57 | 57 | |
|
58 | 58 | default is internal merge: |
|
59 | 59 | |
|
60 | 60 | $ beforemerge |
|
61 | 61 | [merge-tools] |
|
62 | 62 | # hg update -C 1 |
|
63 | 63 | |
|
64 | 64 | hg merge -r 2 |
|
65 | 65 | override $PATH to ensure hgmerge not visible; use $PYTHON in case we're |
|
66 | 66 | running from a devel copy, not a temp installation |
|
67 | 67 | |
|
68 | 68 | $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2 |
|
69 | 69 | merging f |
|
70 | 70 | warning: conflicts during merge. |
|
71 | 71 | merging f incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
72 | 72 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
73 | 73 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
74 | 74 | [1] |
|
75 | 75 | $ aftermerge |
|
76 | 76 | # cat f |
|
77 | 77 | <<<<<<< local: ef83787e2614 - test: revision 1 |
|
78 | 78 | revision 1 |
|
79 | 79 | ======= |
|
80 | 80 | revision 2 |
|
81 | 81 | >>>>>>> other: 0185f4e0cf02 - test: revision 2 |
|
82 | 82 | space |
|
83 | 83 | # hg stat |
|
84 | 84 | M f |
|
85 | 85 | ? f.orig |
|
86 | 86 | |
|
87 | 87 | simplest hgrc using false for merge: |
|
88 | 88 | |
|
89 | 89 | $ echo "false.whatever=" >> .hg/hgrc |
|
90 | 90 | $ beforemerge |
|
91 | 91 | [merge-tools] |
|
92 | 92 | false.whatever= |
|
93 | 93 | # hg update -C 1 |
|
94 | 94 | $ hg merge -r 2 |
|
95 | 95 | merging f |
|
96 | 96 | merging f failed! |
|
97 | 97 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
98 | 98 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
99 | 99 | [1] |
|
100 | 100 | $ aftermerge |
|
101 | 101 | # cat f |
|
102 | 102 | revision 1 |
|
103 | 103 | space |
|
104 | 104 | # hg stat |
|
105 | 105 | M f |
|
106 | 106 | ? f.orig |
|
107 | 107 | |
|
108 | 108 | #if unix-permissions |
|
109 | 109 | |
|
110 | 110 | unexecutable file in $PATH shouldn't be found: |
|
111 | 111 | |
|
112 | 112 | $ echo "echo fail" > false |
|
113 | 113 | $ hg up -qC 1 |
|
114 | 114 | $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2 |
|
115 | 115 | merging f |
|
116 | 116 | warning: conflicts during merge. |
|
117 | 117 | merging f incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
118 | 118 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
119 | 119 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
120 | 120 | [1] |
|
121 | 121 | $ rm false |
|
122 | 122 | |
|
123 | 123 | #endif |
|
124 | 124 | |
|
125 | 125 | executable directory in $PATH shouldn't be found: |
|
126 | 126 | |
|
127 | 127 | $ mkdir false |
|
128 | 128 | $ hg up -qC 1 |
|
129 | 129 | $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2 |
|
130 | 130 | merging f |
|
131 | 131 | warning: conflicts during merge. |
|
132 | 132 | merging f incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
133 | 133 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
134 | 134 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
135 | 135 | [1] |
|
136 | 136 | $ rmdir false |
|
137 | 137 | |
|
138 | 138 | true with higher .priority gets precedence: |
|
139 | 139 | |
|
140 | 140 | $ echo "true.priority=1" >> .hg/hgrc |
|
141 | 141 | $ beforemerge |
|
142 | 142 | [merge-tools] |
|
143 | 143 | false.whatever= |
|
144 | 144 | true.priority=1 |
|
145 | 145 | # hg update -C 1 |
|
146 | 146 | $ hg merge -r 2 |
|
147 | 147 | merging f |
|
148 | 148 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
149 | 149 | (branch merge, don't forget to commit) |
|
150 | 150 | $ aftermerge |
|
151 | 151 | # cat f |
|
152 | 152 | revision 1 |
|
153 | 153 | space |
|
154 | 154 | # hg stat |
|
155 | 155 | M f |
|
156 | 156 | |
|
157 | 157 | unless lowered on command line: |
|
158 | 158 | |
|
159 | 159 | $ beforemerge |
|
160 | 160 | [merge-tools] |
|
161 | 161 | false.whatever= |
|
162 | 162 | true.priority=1 |
|
163 | 163 | # hg update -C 1 |
|
164 | 164 | $ hg merge -r 2 --config merge-tools.true.priority=-7 |
|
165 | 165 | merging f |
|
166 | 166 | merging f failed! |
|
167 | 167 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
168 | 168 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
169 | 169 | [1] |
|
170 | 170 | $ aftermerge |
|
171 | 171 | # cat f |
|
172 | 172 | revision 1 |
|
173 | 173 | space |
|
174 | 174 | # hg stat |
|
175 | 175 | M f |
|
176 | 176 | ? f.orig |
|
177 | 177 | |
|
178 | 178 | or false set higher on command line: |
|
179 | 179 | |
|
180 | 180 | $ beforemerge |
|
181 | 181 | [merge-tools] |
|
182 | 182 | false.whatever= |
|
183 | 183 | true.priority=1 |
|
184 | 184 | # hg update -C 1 |
|
185 | 185 | $ hg merge -r 2 --config merge-tools.false.priority=117 |
|
186 | 186 | merging f |
|
187 | 187 | merging f failed! |
|
188 | 188 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
189 | 189 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
190 | 190 | [1] |
|
191 | 191 | $ aftermerge |
|
192 | 192 | # cat f |
|
193 | 193 | revision 1 |
|
194 | 194 | space |
|
195 | 195 | # hg stat |
|
196 | 196 | M f |
|
197 | 197 | ? f.orig |
|
198 | 198 | |
|
199 | 199 | or true.executable not found in PATH: |
|
200 | 200 | |
|
201 | 201 | $ beforemerge |
|
202 | 202 | [merge-tools] |
|
203 | 203 | false.whatever= |
|
204 | 204 | true.priority=1 |
|
205 | 205 | # hg update -C 1 |
|
206 | 206 | $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool |
|
207 | 207 | merging f |
|
208 | 208 | merging f failed! |
|
209 | 209 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
210 | 210 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
211 | 211 | [1] |
|
212 | 212 | $ aftermerge |
|
213 | 213 | # cat f |
|
214 | 214 | revision 1 |
|
215 | 215 | space |
|
216 | 216 | # hg stat |
|
217 | 217 | M f |
|
218 | 218 | ? f.orig |
|
219 | 219 | |
|
220 | 220 | or true.executable with bogus path: |
|
221 | 221 | |
|
222 | 222 | $ beforemerge |
|
223 | 223 | [merge-tools] |
|
224 | 224 | false.whatever= |
|
225 | 225 | true.priority=1 |
|
226 | 226 | # hg update -C 1 |
|
227 | 227 | $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool |
|
228 | 228 | merging f |
|
229 | 229 | merging f failed! |
|
230 | 230 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
231 | 231 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
232 | 232 | [1] |
|
233 | 233 | $ aftermerge |
|
234 | 234 | # cat f |
|
235 | 235 | revision 1 |
|
236 | 236 | space |
|
237 | 237 | # hg stat |
|
238 | 238 | M f |
|
239 | 239 | ? f.orig |
|
240 | 240 | |
|
241 | 241 | but true.executable set to cat found in PATH works: |
|
242 | 242 | |
|
243 | 243 | $ echo "true.executable=cat" >> .hg/hgrc |
|
244 | 244 | $ beforemerge |
|
245 | 245 | [merge-tools] |
|
246 | 246 | false.whatever= |
|
247 | 247 | true.priority=1 |
|
248 | 248 | true.executable=cat |
|
249 | 249 | # hg update -C 1 |
|
250 | 250 | $ hg merge -r 2 |
|
251 | 251 | merging f |
|
252 | 252 | revision 1 |
|
253 | 253 | space |
|
254 | 254 | revision 0 |
|
255 | 255 | space |
|
256 | 256 | revision 2 |
|
257 | 257 | space |
|
258 | 258 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
259 | 259 | (branch merge, don't forget to commit) |
|
260 | 260 | $ aftermerge |
|
261 | 261 | # cat f |
|
262 | 262 | revision 1 |
|
263 | 263 | space |
|
264 | 264 | # hg stat |
|
265 | 265 | M f |
|
266 | 266 | |
|
267 | 267 | and true.executable set to cat with path works: |
|
268 | 268 | |
|
269 | 269 | $ beforemerge |
|
270 | 270 | [merge-tools] |
|
271 | 271 | false.whatever= |
|
272 | 272 | true.priority=1 |
|
273 | 273 | true.executable=cat |
|
274 | 274 | # hg update -C 1 |
|
275 | 275 | $ hg merge -r 2 --config merge-tools.true.executable=cat |
|
276 | 276 | merging f |
|
277 | 277 | revision 1 |
|
278 | 278 | space |
|
279 | 279 | revision 0 |
|
280 | 280 | space |
|
281 | 281 | revision 2 |
|
282 | 282 | space |
|
283 | 283 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
284 | 284 | (branch merge, don't forget to commit) |
|
285 | 285 | $ aftermerge |
|
286 | 286 | # cat f |
|
287 | 287 | revision 1 |
|
288 | 288 | space |
|
289 | 289 | # hg stat |
|
290 | 290 | M f |
|
291 | 291 | |
|
292 | 292 | #if unix-permissions |
|
293 | 293 | |
|
294 | 294 | environment variables in true.executable are handled: |
|
295 | 295 | |
|
296 | 296 | $ echo 'echo "custom merge tool"' > .hg/merge.sh |
|
297 | 297 | $ beforemerge |
|
298 | 298 | [merge-tools] |
|
299 | 299 | false.whatever= |
|
300 | 300 | true.priority=1 |
|
301 | 301 | true.executable=cat |
|
302 | 302 | # hg update -C 1 |
|
303 | 303 | $ hg --config merge-tools.true.executable='sh' \ |
|
304 | 304 | > --config merge-tools.true.args=.hg/merge.sh \ |
|
305 | 305 | > merge -r 2 |
|
306 | 306 | merging f |
|
307 | 307 | custom merge tool |
|
308 | 308 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
309 | 309 | (branch merge, don't forget to commit) |
|
310 | 310 | $ aftermerge |
|
311 | 311 | # cat f |
|
312 | 312 | revision 1 |
|
313 | 313 | space |
|
314 | 314 | # hg stat |
|
315 | 315 | M f |
|
316 | 316 | |
|
317 | 317 | #endif |
|
318 | 318 | |
|
319 | 319 | Tool selection and merge-patterns |
|
320 | 320 | |
|
321 | 321 | merge-patterns specifies new tool false: |
|
322 | 322 | |
|
323 | 323 | $ beforemerge |
|
324 | 324 | [merge-tools] |
|
325 | 325 | false.whatever= |
|
326 | 326 | true.priority=1 |
|
327 | 327 | true.executable=cat |
|
328 | 328 | # hg update -C 1 |
|
329 | 329 | $ hg merge -r 2 --config merge-patterns.f=false |
|
330 | 330 | merging f |
|
331 | 331 | merging f failed! |
|
332 | 332 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
333 | 333 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
334 | 334 | [1] |
|
335 | 335 | $ aftermerge |
|
336 | 336 | # cat f |
|
337 | 337 | revision 1 |
|
338 | 338 | space |
|
339 | 339 | # hg stat |
|
340 | 340 | M f |
|
341 | 341 | ? f.orig |
|
342 | 342 | |
|
343 | 343 | merge-patterns specifies executable not found in PATH and gets warning: |
|
344 | 344 | |
|
345 | 345 | $ beforemerge |
|
346 | 346 | [merge-tools] |
|
347 | 347 | false.whatever= |
|
348 | 348 | true.priority=1 |
|
349 | 349 | true.executable=cat |
|
350 | 350 | # hg update -C 1 |
|
351 | 351 | $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool |
|
352 | 352 | couldn't find merge tool true specified for f |
|
353 | 353 | merging f |
|
354 | 354 | merging f failed! |
|
355 | 355 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
356 | 356 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
357 | 357 | [1] |
|
358 | 358 | $ aftermerge |
|
359 | 359 | # cat f |
|
360 | 360 | revision 1 |
|
361 | 361 | space |
|
362 | 362 | # hg stat |
|
363 | 363 | M f |
|
364 | 364 | ? f.orig |
|
365 | 365 | |
|
366 | 366 | merge-patterns specifies executable with bogus path and gets warning: |
|
367 | 367 | |
|
368 | 368 | $ beforemerge |
|
369 | 369 | [merge-tools] |
|
370 | 370 | false.whatever= |
|
371 | 371 | true.priority=1 |
|
372 | 372 | true.executable=cat |
|
373 | 373 | # hg update -C 1 |
|
374 | 374 | $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool |
|
375 | 375 | couldn't find merge tool true specified for f |
|
376 | 376 | merging f |
|
377 | 377 | merging f failed! |
|
378 | 378 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
379 | 379 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
380 | 380 | [1] |
|
381 | 381 | $ aftermerge |
|
382 | 382 | # cat f |
|
383 | 383 | revision 1 |
|
384 | 384 | space |
|
385 | 385 | # hg stat |
|
386 | 386 | M f |
|
387 | 387 | ? f.orig |
|
388 | 388 | |
|
389 | 389 | ui.merge overrules priority |
|
390 | 390 | |
|
391 | 391 | ui.merge specifies false: |
|
392 | 392 | |
|
393 | 393 | $ beforemerge |
|
394 | 394 | [merge-tools] |
|
395 | 395 | false.whatever= |
|
396 | 396 | true.priority=1 |
|
397 | 397 | true.executable=cat |
|
398 | 398 | # hg update -C 1 |
|
399 | 399 | $ hg merge -r 2 --config ui.merge=false |
|
400 | 400 | merging f |
|
401 | 401 | merging f failed! |
|
402 | 402 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
403 | 403 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
404 | 404 | [1] |
|
405 | 405 | $ aftermerge |
|
406 | 406 | # cat f |
|
407 | 407 | revision 1 |
|
408 | 408 | space |
|
409 | 409 | # hg stat |
|
410 | 410 | M f |
|
411 | 411 | ? f.orig |
|
412 | 412 | |
|
413 | 413 | ui.merge specifies internal:fail: |
|
414 | 414 | |
|
415 | 415 | $ beforemerge |
|
416 | 416 | [merge-tools] |
|
417 | 417 | false.whatever= |
|
418 | 418 | true.priority=1 |
|
419 | 419 | true.executable=cat |
|
420 | 420 | # hg update -C 1 |
|
421 | 421 | $ hg merge -r 2 --config ui.merge=internal:fail |
|
422 | 422 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
423 | 423 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
424 | 424 | [1] |
|
425 | 425 | $ aftermerge |
|
426 | 426 | # cat f |
|
427 | 427 | revision 1 |
|
428 | 428 | space |
|
429 | 429 | # hg stat |
|
430 | 430 | M f |
|
431 | 431 | |
|
432 | 432 | ui.merge specifies :local (without internal prefix): |
|
433 | 433 | |
|
434 | 434 | $ beforemerge |
|
435 | 435 | [merge-tools] |
|
436 | 436 | false.whatever= |
|
437 | 437 | true.priority=1 |
|
438 | 438 | true.executable=cat |
|
439 | 439 | # hg update -C 1 |
|
440 | 440 | $ hg merge -r 2 --config ui.merge=:local |
|
441 | 441 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
442 | 442 | (branch merge, don't forget to commit) |
|
443 | 443 | $ aftermerge |
|
444 | 444 | # cat f |
|
445 | 445 | revision 1 |
|
446 | 446 | space |
|
447 | 447 | # hg stat |
|
448 | 448 | M f |
|
449 | 449 | |
|
450 | 450 | ui.merge specifies internal:other: |
|
451 | 451 | |
|
452 | 452 | $ beforemerge |
|
453 | 453 | [merge-tools] |
|
454 | 454 | false.whatever= |
|
455 | 455 | true.priority=1 |
|
456 | 456 | true.executable=cat |
|
457 | 457 | # hg update -C 1 |
|
458 | 458 | $ hg merge -r 2 --config ui.merge=internal:other |
|
459 | 459 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
460 | 460 | (branch merge, don't forget to commit) |
|
461 | 461 | $ aftermerge |
|
462 | 462 | # cat f |
|
463 | 463 | revision 2 |
|
464 | 464 | space |
|
465 | 465 | # hg stat |
|
466 | 466 | M f |
|
467 | 467 | |
|
468 | 468 | ui.merge specifies internal:prompt: |
|
469 | 469 | |
|
470 | 470 | $ beforemerge |
|
471 | 471 | [merge-tools] |
|
472 | 472 | false.whatever= |
|
473 | 473 | true.priority=1 |
|
474 | 474 | true.executable=cat |
|
475 | 475 | # hg update -C 1 |
|
476 | 476 | $ hg merge -r 2 --config ui.merge=internal:prompt |
|
477 | 477 | no tool found to merge f |
|
478 | 478 | keep (l)ocal or take (o)ther? l |
|
479 | 479 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
480 | 480 | (branch merge, don't forget to commit) |
|
481 | 481 | $ aftermerge |
|
482 | 482 | # cat f |
|
483 | 483 | revision 1 |
|
484 | 484 | space |
|
485 | 485 | # hg stat |
|
486 | 486 | M f |
|
487 | 487 | |
|
488 | 488 | ui.merge specifies internal:dump: |
|
489 | 489 | |
|
490 | 490 | $ beforemerge |
|
491 | 491 | [merge-tools] |
|
492 | 492 | false.whatever= |
|
493 | 493 | true.priority=1 |
|
494 | 494 | true.executable=cat |
|
495 | 495 | # hg update -C 1 |
|
496 | 496 | $ hg merge -r 2 --config ui.merge=internal:dump |
|
497 | 497 | merging f |
|
498 | 498 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
499 | 499 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
500 | 500 | [1] |
|
501 | 501 | $ aftermerge |
|
502 | 502 | # cat f |
|
503 | 503 | revision 1 |
|
504 | 504 | space |
|
505 | 505 | # hg stat |
|
506 | 506 | M f |
|
507 | 507 | ? f.base |
|
508 | 508 | ? f.local |
|
509 | 509 | ? f.orig |
|
510 | 510 | ? f.other |
|
511 | 511 | |
|
512 | 512 | f.base: |
|
513 | 513 | |
|
514 | 514 | $ cat f.base |
|
515 | 515 | revision 0 |
|
516 | 516 | space |
|
517 | 517 | |
|
518 | 518 | f.local: |
|
519 | 519 | |
|
520 | 520 | $ cat f.local |
|
521 | 521 | revision 1 |
|
522 | 522 | space |
|
523 | 523 | |
|
524 | 524 | f.other: |
|
525 | 525 | |
|
526 | 526 | $ cat f.other |
|
527 | 527 | revision 2 |
|
528 | 528 | space |
|
529 | 529 | $ rm f.base f.local f.other |
|
530 | 530 | |
|
531 | 531 | ui.merge specifies internal:other but is overruled by pattern for false: |
|
532 | 532 | |
|
533 | 533 | $ beforemerge |
|
534 | 534 | [merge-tools] |
|
535 | 535 | false.whatever= |
|
536 | 536 | true.priority=1 |
|
537 | 537 | true.executable=cat |
|
538 | 538 | # hg update -C 1 |
|
539 | 539 | $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false |
|
540 | 540 | merging f |
|
541 | 541 | merging f failed! |
|
542 | 542 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
543 | 543 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
544 | 544 | [1] |
|
545 | 545 | $ aftermerge |
|
546 | 546 | # cat f |
|
547 | 547 | revision 1 |
|
548 | 548 | space |
|
549 | 549 | # hg stat |
|
550 | 550 | M f |
|
551 | 551 | ? f.orig |
|
552 | 552 | |
|
553 | 553 | Premerge |
|
554 | 554 | |
|
555 | 555 | ui.merge specifies internal:other but is overruled by --tool=false |
|
556 | 556 | |
|
557 | 557 | $ beforemerge |
|
558 | 558 | [merge-tools] |
|
559 | 559 | false.whatever= |
|
560 | 560 | true.priority=1 |
|
561 | 561 | true.executable=cat |
|
562 | 562 | # hg update -C 1 |
|
563 | 563 | $ hg merge -r 2 --config ui.merge=internal:other --tool=false |
|
564 | 564 | merging f |
|
565 | 565 | merging f failed! |
|
566 | 566 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
567 | 567 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
568 | 568 | [1] |
|
569 | 569 | $ aftermerge |
|
570 | 570 | # cat f |
|
571 | 571 | revision 1 |
|
572 | 572 | space |
|
573 | 573 | # hg stat |
|
574 | 574 | M f |
|
575 | 575 | ? f.orig |
|
576 | 576 | |
|
577 | 577 | HGMERGE specifies internal:other but is overruled by --tool=false |
|
578 | 578 | |
|
579 | 579 | $ HGMERGE=internal:other ; export HGMERGE |
|
580 | 580 | $ beforemerge |
|
581 | 581 | [merge-tools] |
|
582 | 582 | false.whatever= |
|
583 | 583 | true.priority=1 |
|
584 | 584 | true.executable=cat |
|
585 | 585 | # hg update -C 1 |
|
586 | 586 | $ hg merge -r 2 --tool=false |
|
587 | 587 | merging f |
|
588 | 588 | merging f failed! |
|
589 | 589 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
590 | 590 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
591 | 591 | [1] |
|
592 | 592 | $ aftermerge |
|
593 | 593 | # cat f |
|
594 | 594 | revision 1 |
|
595 | 595 | space |
|
596 | 596 | # hg stat |
|
597 | 597 | M f |
|
598 | 598 | ? f.orig |
|
599 | 599 | |
|
600 | 600 | $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests |
|
601 | 601 | |
|
602 | 602 | update is a merge ... |
|
603 | 603 | |
|
604 | (this also tests that files reverted with '--rev REV' are treated as | |
|
605 | "modified", even if none of mode, size and timestamp of them isn't | |
|
606 | changed on the filesystem (see also issue4583)) | |
|
607 | ||
|
608 | $ cat >> $HGRCPATH <<EOF | |
|
609 | > [fakedirstatewritetime] | |
|
610 | > # emulate invoking dirstate.write() via repo.status() | |
|
611 | > # at 2000-01-01 00:00 | |
|
612 | > fakenow = 200001010000 | |
|
613 | > EOF | |
|
614 | ||
|
604 | 615 | $ beforemerge |
|
605 | 616 | [merge-tools] |
|
606 | 617 | false.whatever= |
|
607 | 618 | true.priority=1 |
|
608 | 619 | true.executable=cat |
|
609 | 620 | # hg update -C 1 |
|
610 | 621 | $ hg update -q 0 |
|
611 | 622 | $ f -s f |
|
612 | 623 | f: size=17 |
|
613 | 624 | $ touch -t 200001010000 f |
|
614 | $ hg status f | |
|
625 | $ hg debugrebuildstate | |
|
626 | $ cat >> $HGRCPATH <<EOF | |
|
627 | > [extensions] | |
|
628 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
|
629 | > EOF | |
|
615 | 630 | $ hg revert -q -r 1 . |
|
631 | $ cat >> $HGRCPATH <<EOF | |
|
632 | > [extensions] | |
|
633 | > fakedirstatewritetime = ! | |
|
634 | > EOF | |
|
616 | 635 | $ f -s f |
|
617 | 636 | f: size=17 |
|
618 | 637 | $ touch -t 200001010000 f |
|
619 | 638 | $ hg status f |
|
620 | 639 | M f |
|
621 | 640 | $ hg update -r 2 |
|
622 | 641 | merging f |
|
623 | 642 | revision 1 |
|
624 | 643 | space |
|
625 | 644 | revision 0 |
|
626 | 645 | space |
|
627 | 646 | revision 2 |
|
628 | 647 | space |
|
629 | 648 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
630 | 649 | $ aftermerge |
|
631 | 650 | # cat f |
|
632 | 651 | revision 1 |
|
633 | 652 | space |
|
634 | 653 | # hg stat |
|
635 | 654 | M f |
|
636 | 655 | |
|
637 | 656 | update should also have --tool |
|
638 | 657 | |
|
639 | 658 | $ beforemerge |
|
640 | 659 | [merge-tools] |
|
641 | 660 | false.whatever= |
|
642 | 661 | true.priority=1 |
|
643 | 662 | true.executable=cat |
|
644 | 663 | # hg update -C 1 |
|
645 | 664 | $ hg update -q 0 |
|
646 | 665 | $ f -s f |
|
647 | 666 | f: size=17 |
|
648 | 667 | $ touch -t 200001010000 f |
|
649 | $ hg status f | |
|
668 | $ hg debugrebuildstate | |
|
669 | $ cat >> $HGRCPATH <<EOF | |
|
670 | > [extensions] | |
|
671 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
|
672 | > EOF | |
|
650 | 673 | $ hg revert -q -r 1 . |
|
674 | $ cat >> $HGRCPATH <<EOF | |
|
675 | > [extensions] | |
|
676 | > fakedirstatewritetime = ! | |
|
677 | > EOF | |
|
651 | 678 | $ f -s f |
|
652 | 679 | f: size=17 |
|
653 | 680 | $ touch -t 200001010000 f |
|
654 | 681 | $ hg status f |
|
655 | 682 | M f |
|
656 | 683 | $ hg update -r 2 --tool false |
|
657 | 684 | merging f |
|
658 | 685 | merging f failed! |
|
659 | 686 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
660 | 687 | use 'hg resolve' to retry unresolved file merges |
|
661 | 688 | [1] |
|
662 | 689 | $ aftermerge |
|
663 | 690 | # cat f |
|
664 | 691 | revision 1 |
|
665 | 692 | space |
|
666 | 693 | # hg stat |
|
667 | 694 | M f |
|
668 | 695 | ? f.orig |
|
669 | 696 | |
|
670 | 697 | Default is silent simplemerge: |
|
671 | 698 | |
|
672 | 699 | $ beforemerge |
|
673 | 700 | [merge-tools] |
|
674 | 701 | false.whatever= |
|
675 | 702 | true.priority=1 |
|
676 | 703 | true.executable=cat |
|
677 | 704 | # hg update -C 1 |
|
678 | 705 | $ hg merge -r 3 |
|
679 | 706 | merging f |
|
680 | 707 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
681 | 708 | (branch merge, don't forget to commit) |
|
682 | 709 | $ aftermerge |
|
683 | 710 | # cat f |
|
684 | 711 | revision 1 |
|
685 | 712 | space |
|
686 | 713 | revision 3 |
|
687 | 714 | # hg stat |
|
688 | 715 | M f |
|
689 | 716 | |
|
690 | 717 | .premerge=True is same: |
|
691 | 718 | |
|
692 | 719 | $ beforemerge |
|
693 | 720 | [merge-tools] |
|
694 | 721 | false.whatever= |
|
695 | 722 | true.priority=1 |
|
696 | 723 | true.executable=cat |
|
697 | 724 | # hg update -C 1 |
|
698 | 725 | $ hg merge -r 3 --config merge-tools.true.premerge=True |
|
699 | 726 | merging f |
|
700 | 727 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
701 | 728 | (branch merge, don't forget to commit) |
|
702 | 729 | $ aftermerge |
|
703 | 730 | # cat f |
|
704 | 731 | revision 1 |
|
705 | 732 | space |
|
706 | 733 | revision 3 |
|
707 | 734 | # hg stat |
|
708 | 735 | M f |
|
709 | 736 | |
|
710 | 737 | .premerge=False executes merge-tool: |
|
711 | 738 | |
|
712 | 739 | $ beforemerge |
|
713 | 740 | [merge-tools] |
|
714 | 741 | false.whatever= |
|
715 | 742 | true.priority=1 |
|
716 | 743 | true.executable=cat |
|
717 | 744 | # hg update -C 1 |
|
718 | 745 | $ hg merge -r 3 --config merge-tools.true.premerge=False |
|
719 | 746 | merging f |
|
720 | 747 | revision 1 |
|
721 | 748 | space |
|
722 | 749 | revision 0 |
|
723 | 750 | space |
|
724 | 751 | revision 0 |
|
725 | 752 | space |
|
726 | 753 | revision 3 |
|
727 | 754 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
728 | 755 | (branch merge, don't forget to commit) |
|
729 | 756 | $ aftermerge |
|
730 | 757 | # cat f |
|
731 | 758 | revision 1 |
|
732 | 759 | space |
|
733 | 760 | # hg stat |
|
734 | 761 | M f |
|
735 | 762 | |
|
736 | 763 | premerge=keep keeps conflict markers in: |
|
737 | 764 | |
|
738 | 765 | $ beforemerge |
|
739 | 766 | [merge-tools] |
|
740 | 767 | false.whatever= |
|
741 | 768 | true.priority=1 |
|
742 | 769 | true.executable=cat |
|
743 | 770 | # hg update -C 1 |
|
744 | 771 | $ hg merge -r 4 --config merge-tools.true.premerge=keep |
|
745 | 772 | merging f |
|
746 | 773 | <<<<<<< local: ef83787e2614 - test: revision 1 |
|
747 | 774 | revision 1 |
|
748 | 775 | space |
|
749 | 776 | ======= |
|
750 | 777 | revision 4 |
|
751 | 778 | >>>>>>> other: 81448d39c9a0 - test: revision 4 |
|
752 | 779 | revision 0 |
|
753 | 780 | space |
|
754 | 781 | revision 4 |
|
755 | 782 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
756 | 783 | (branch merge, don't forget to commit) |
|
757 | 784 | $ aftermerge |
|
758 | 785 | # cat f |
|
759 | 786 | <<<<<<< local: ef83787e2614 - test: revision 1 |
|
760 | 787 | revision 1 |
|
761 | 788 | space |
|
762 | 789 |
|
|
763 | 790 | revision 4 |
|
764 | 791 | >>>>>>> other: 81448d39c9a0 - test: revision 4 |
|
765 | 792 |
|
|
766 | 793 | M f |
|
767 | 794 | |
|
768 | 795 | premerge=keep-merge3 keeps conflict markers with base content: |
|
769 | 796 | |
|
770 | 797 | $ beforemerge |
|
771 | 798 | [merge-tools] |
|
772 | 799 | false.whatever= |
|
773 | 800 | true.priority=1 |
|
774 | 801 | true.executable=cat |
|
775 | 802 |
|
|
776 | 803 | $ hg merge -r 4 --config merge-tools.true.premerge=keep-merge3 |
|
777 | 804 | merging f |
|
778 | 805 |
|
|
779 | 806 | revision 1 |
|
780 | 807 | space |
|
781 | 808 | ||||||| base |
|
782 | 809 | revision 0 |
|
783 | 810 | space |
|
784 | 811 |
|
|
785 | 812 | revision 4 |
|
786 | 813 | >>>>>>> other: 81448d39c9a0 - test: revision 4 |
|
787 | 814 | revision 0 |
|
788 | 815 | space |
|
789 | 816 | revision 4 |
|
790 | 817 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
791 | 818 |
|
|
792 | 819 | $ aftermerge |
|
793 | 820 | # cat f |
|
794 | 821 |
<<<<<<< local: ef83787e2614 - test: |
|
795 | 822 |
|
|
796 | 823 |
|
|
797 | 824 | ||||||| base |
|
798 | 825 |
|
|
799 | 826 |
|
|
800 | 827 |
====== |
|
801 | 828 |
revision |
|
802 | 829 | >>>>>>> other: 81448d39c9a0 - test: revision 4 |
|
803 | 830 | # hg stat |
|
804 | 831 | M f |
|
805 | 832 | |
|
806 | 833 | |
|
807 | 834 | Tool execution |
|
808 | 835 | |
|
809 | 836 | set tools.args explicit to include $base $local $other $output: |
|
810 | 837 | |
|
811 | 838 | $ beforemerge |
|
812 | 839 | [merge-tools] |
|
813 | 840 | false.whatever= |
|
814 | 841 | true.priority=1 |
|
815 | 842 | true.executable=cat |
|
816 | 843 | # hg update -C 1 |
|
817 | 844 |
$ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$ |
|
818 | 845 |
> | sed ' |
|
819 | 846 | merging f |
|
820 | 847 |
==> ... <== |
|
821 | 848 | revision 0 |
|
822 | 849 | space |
|
823 | 850 | |
|
824 | 851 |
== |
|
825 | 852 | revision 1 |
|
826 | 853 | space |
|
827 | 854 | |
|
828 | 855 |
== |
|
829 | 856 | revision 2 |
|
830 | 857 | space |
|
831 | 858 | |
|
832 | 859 |
== |
|
833 | 860 | revision 1 |
|
834 | 861 | space |
|
835 | 862 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
836 | 863 | (branch merge, don't forget to commit) |
|
837 | 864 | $ aftermerge |
|
838 | 865 |
|
|
839 | 866 | revision 1 |
|
840 | 867 | space |
|
841 | 868 |
|
|
842 | 869 | M f |
|
843 | 870 | |
|
844 | 871 | Merge with "echo mergeresult > $local": |
|
845 | 872 | |
|
846 | 873 | $ beforemerge |
|
847 | 874 | [merge-tools] |
|
848 | 875 | false.whatever= |
|
849 | 876 | true.priority=1 |
|
850 | 877 | true.executable=cat |
|
851 | 878 |
|
|
852 | 879 |
$ |
|
853 | 880 |
|
|
854 | 881 |
|
|
855 | 882 |
(branch |
|
856 | 883 | $ aftermerge |
|
857 | 884 | # cat f |
|
858 | 885 | mergeresult |
|
859 | 886 | # hg stat |
|
860 | 887 | M f |
|
861 | 888 | |
|
862 | 889 | - and $local is the file f: |
|
863 | 890 | |
|
864 | 891 | $ beforemerge |
|
865 | 892 | [merge-tools] |
|
866 | 893 | false.whatever= |
|
867 | 894 | true.priority=1 |
|
868 | 895 | true.executable=cat |
|
869 | 896 | # hg update -C 1 |
|
870 | 897 |
$ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args=' |
|
871 | 898 | merging f |
|
872 | 899 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
873 | 900 |
(branch merge, don' |
|
874 | 901 |
|
|
875 | 902 | # cat f |
|
876 | 903 |
|
|
877 | 904 | # hg stat |
|
878 | 905 |
|
|
879 | 906 | |
|
880 | 907 |
|
|
881 | 908 | |
|
882 | 909 |
|
|
883 | 910 | [merge-tools] |
|
884 | 911 |
|
|
885 | 912 | true.priority=1 |
|
886 | 913 |
|
|
887 | 914 | # hg update -C 1 |
|
888 | 915 |
$ hg |
|
889 | 916 |
|
|
890 | 917 |
|
|
891 | 918 |
(branch |
|
892 | 919 | $ aftermerge |
|
893 | 920 | # cat f |
|
894 | 921 | mergeresult |
|
895 | 922 | # hg stat |
|
896 | 923 | M f |
|
897 | 924 | |
|
898 | 925 | Merge using tool with a path that must be quoted: |
|
899 | 926 | |
|
900 | 927 | $ beforemerge |
|
901 | 928 | [merge-tools] |
|
902 | 929 | false.whatever= |
|
903 | 930 | true.priority=1 |
|
904 | 931 | true.executable=cat |
|
905 | 932 | # hg update -C 1 |
|
906 | 933 | $ cat <<EOF > 'my merge tool' |
|
907 | 934 | > cat "\$1" "\$2" "\$3" > "\$4" |
|
908 | 935 | > EOF |
|
909 | 936 | $ hg --config merge-tools.true.executable='sh' \ |
|
910 | 937 | > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \ |
|
911 | 938 | > merge -r 2 |
|
912 | 939 | merging f |
|
913 | 940 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
914 | 941 | (branch merge, don't forget to commit) |
|
915 | 942 | $ rm -f 'my merge tool' |
|
916 | 943 | $ aftermerge |
|
917 | 944 | # cat f |
|
918 | 945 | revision 0 |
|
919 | 946 | space |
|
920 | 947 | revision 1 |
|
921 | 948 | space |
|
922 | 949 | revision 2 |
|
923 | 950 | space |
|
924 | 951 | # hg stat |
|
925 | 952 | M f |
|
926 | 953 | |
|
927 | 954 | Issue3581: Merging a filename that needs to be quoted |
|
928 | 955 | (This test doesn't work on Windows filesystems even on Linux, so check |
|
929 | 956 | for Unix-like permission) |
|
930 | 957 | |
|
931 | 958 | #if unix-permissions |
|
932 | 959 | $ beforemerge |
|
933 | 960 | [merge-tools] |
|
934 | 961 | false.whatever= |
|
935 | 962 | true.priority=1 |
|
936 | 963 | true.executable=cat |
|
937 | 964 | # hg update -C 1 |
|
938 | 965 | $ echo "revision 5" > '"; exit 1; echo "' |
|
939 | 966 | $ hg commit -Am "revision 5" |
|
940 | 967 | adding "; exit 1; echo " |
|
941 | 968 | warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "' |
|
942 | 969 | $ hg update -C 1 > /dev/null |
|
943 | 970 | $ echo "revision 6" > '"; exit 1; echo "' |
|
944 | 971 | $ hg commit -Am "revision 6" |
|
945 | 972 | adding "; exit 1; echo " |
|
946 | 973 | warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "' |
|
947 | 974 | created new head |
|
948 | 975 | $ hg merge --config merge-tools.true.executable="true" -r 5 |
|
949 | 976 | merging "; exit 1; echo " |
|
950 | 977 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
951 | 978 | (branch merge, don't forget to commit) |
|
952 | 979 | $ hg update -C 1 > /dev/null |
|
953 | 980 | #endif |
|
954 | 981 | |
|
955 | 982 | Merge post-processing |
|
956 | 983 | |
|
957 | 984 | cat is a bad merge-tool and doesn't change: |
|
958 | 985 | |
|
959 | 986 | $ beforemerge |
|
960 | 987 | [merge-tools] |
|
961 | 988 | false.whatever= |
|
962 | 989 | true.priority=1 |
|
963 | 990 | true.executable=cat |
|
964 | 991 | # hg update -C 1 |
|
965 | 992 | $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1 |
|
966 | 993 | merging f |
|
967 | 994 | revision 1 |
|
968 | 995 | space |
|
969 | 996 | revision 0 |
|
970 | 997 | space |
|
971 | 998 | revision 2 |
|
972 | 999 | space |
|
973 | 1000 | output file f appears unchanged |
|
974 | 1001 | was merge successful (yn)? n |
|
975 | 1002 | merging f failed! |
|
976 | 1003 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
977 | 1004 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
978 | 1005 | [1] |
|
979 | 1006 | $ aftermerge |
|
980 | 1007 | # cat f |
|
981 | 1008 | revision 1 |
|
982 | 1009 | space |
|
983 | 1010 | # hg stat |
|
984 | 1011 | M f |
|
985 | 1012 | ? f.orig |
|
986 | 1013 | |
|
987 | 1014 | #if symlink |
|
988 | 1015 | |
|
989 | 1016 | internal merge cannot handle symlinks and shouldn't try: |
|
990 | 1017 | |
|
991 | 1018 | $ hg update -q -C 1 |
|
992 | 1019 | $ rm f |
|
993 | 1020 | $ ln -s symlink f |
|
994 | 1021 | $ hg commit -qm 'f is symlink' |
|
995 | 1022 | $ hg merge -r 2 --tool internal:merge |
|
996 | 1023 | merging f |
|
997 | 1024 | warning: internal :merge cannot merge symlinks for f |
|
998 | 1025 | merging f incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
999 | 1026 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
1000 | 1027 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
1001 | 1028 | [1] |
|
1002 | 1029 | |
|
1003 | 1030 | #endif |
@@ -1,209 +1,296 b'' | |||
|
1 | 1 | $ cat <<EOF > merge |
|
2 | 2 | > import sys, os |
|
3 | 3 | > |
|
4 | 4 | > try: |
|
5 | 5 | > import msvcrt |
|
6 | 6 | > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
|
7 | 7 | > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) |
|
8 | 8 | > except ImportError: |
|
9 | 9 | > pass |
|
10 | 10 | > |
|
11 | 11 | > print "merging for", os.path.basename(sys.argv[1]) |
|
12 | 12 | > EOF |
|
13 | 13 | $ HGMERGE="python ../merge"; export HGMERGE |
|
14 | 14 | |
|
15 | 15 | $ hg init t |
|
16 | 16 | $ cd t |
|
17 | 17 | $ echo This is file a1 > a |
|
18 | 18 | $ hg add a |
|
19 | 19 | $ hg commit -m "commit #0" |
|
20 | 20 | $ echo This is file b1 > b |
|
21 | 21 | $ hg add b |
|
22 | 22 | $ hg commit -m "commit #1" |
|
23 | 23 | |
|
24 | 24 | $ hg update 0 |
|
25 | 25 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
26 | 26 | |
|
27 | 27 | Test interrupted updates by exploiting our non-handling of directory collisions |
|
28 | 28 | |
|
29 | 29 | $ mkdir b |
|
30 | 30 | $ hg up |
|
31 | 31 | abort: *: '$TESTTMP/t/b' (glob) |
|
32 | 32 | [255] |
|
33 | 33 | $ hg ci |
|
34 | 34 | abort: last update was interrupted |
|
35 | 35 | (use 'hg update' to get a consistent checkout) |
|
36 | 36 | [255] |
|
37 | 37 | $ hg sum |
|
38 | 38 | parent: 0:538afb845929 |
|
39 | 39 | commit #0 |
|
40 | 40 | branch: default |
|
41 | 41 | commit: (interrupted update) |
|
42 | 42 | update: 1 new changesets (update) |
|
43 | 43 | phases: 2 draft |
|
44 | 44 | $ rmdir b |
|
45 | 45 | $ hg up |
|
46 | 46 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
47 | 47 | $ hg sum |
|
48 | 48 | parent: 1:b8bb4a988f25 tip |
|
49 | 49 | commit #1 |
|
50 | 50 | branch: default |
|
51 | 51 | commit: (clean) |
|
52 | 52 | update: (current) |
|
53 | 53 | phases: 2 draft |
|
54 | 54 | |
|
55 | 55 | Prepare a basic merge |
|
56 | 56 | |
|
57 | 57 | $ hg up 0 |
|
58 | 58 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
59 | 59 | $ echo This is file c1 > c |
|
60 | 60 | $ hg add c |
|
61 | 61 | $ hg commit -m "commit #2" |
|
62 | 62 | created new head |
|
63 | 63 | $ echo This is file b1 > b |
|
64 | 64 | no merges expected |
|
65 | 65 | $ hg merge -P 1 |
|
66 | 66 | changeset: 1:b8bb4a988f25 |
|
67 | 67 | user: test |
|
68 | 68 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
69 | 69 | summary: commit #1 |
|
70 | 70 | |
|
71 | 71 | $ hg merge 1 |
|
72 | 72 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
73 | 73 | (branch merge, don't forget to commit) |
|
74 | 74 | $ hg diff --nodates |
|
75 | 75 | diff -r 49035e18a8e6 b |
|
76 | 76 | --- /dev/null |
|
77 | 77 | +++ b/b |
|
78 | 78 | @@ -0,0 +1,1 @@ |
|
79 | 79 | +This is file b1 |
|
80 | 80 | $ hg status |
|
81 | 81 | M b |
|
82 | 82 | $ cd ..; rm -r t |
|
83 | 83 | |
|
84 | 84 | $ hg init t |
|
85 | 85 | $ cd t |
|
86 | 86 | $ echo This is file a1 > a |
|
87 | 87 | $ hg add a |
|
88 | 88 | $ hg commit -m "commit #0" |
|
89 | 89 | $ echo This is file b1 > b |
|
90 | 90 | $ hg add b |
|
91 | 91 | $ hg commit -m "commit #1" |
|
92 | 92 | |
|
93 | 93 | $ hg update 0 |
|
94 | 94 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
95 | 95 | $ echo This is file c1 > c |
|
96 | 96 | $ hg add c |
|
97 | 97 | $ hg commit -m "commit #2" |
|
98 | 98 | created new head |
|
99 | 99 | $ echo This is file b2 > b |
|
100 | 100 | merge should fail |
|
101 | 101 | $ hg merge 1 |
|
102 | 102 | b: untracked file differs |
|
103 | 103 | abort: untracked files in working directory differ from files in requested revision |
|
104 | 104 | [255] |
|
105 | 105 | merge of b expected |
|
106 | 106 | $ hg merge -f 1 |
|
107 | 107 | merging b |
|
108 | 108 | merging for b |
|
109 | 109 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
110 | 110 | (branch merge, don't forget to commit) |
|
111 | 111 | $ hg diff --nodates |
|
112 | 112 | diff -r 49035e18a8e6 b |
|
113 | 113 | --- /dev/null |
|
114 | 114 | +++ b/b |
|
115 | 115 | @@ -0,0 +1,1 @@ |
|
116 | 116 | +This is file b2 |
|
117 | 117 | $ hg status |
|
118 | 118 | M b |
|
119 | 119 | $ cd ..; rm -r t |
|
120 | 120 | |
|
121 | 121 | $ hg init t |
|
122 | 122 | $ cd t |
|
123 | 123 | $ echo This is file a1 > a |
|
124 | 124 | $ hg add a |
|
125 | 125 | $ hg commit -m "commit #0" |
|
126 | 126 | $ echo This is file b1 > b |
|
127 | 127 | $ hg add b |
|
128 | 128 | $ hg commit -m "commit #1" |
|
129 | 129 | $ echo This is file b22 > b |
|
130 | 130 | $ hg commit -m "commit #2" |
|
131 | 131 | $ hg update 1 |
|
132 | 132 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
133 | 133 | $ echo This is file c1 > c |
|
134 | 134 | $ hg add c |
|
135 | 135 | $ hg commit -m "commit #3" |
|
136 | 136 | created new head |
|
137 | 137 | |
|
138 | 138 | Contents of b should be "this is file b1" |
|
139 | 139 | $ cat b |
|
140 | 140 | This is file b1 |
|
141 | 141 | |
|
142 | 142 | $ echo This is file b22 > b |
|
143 | 143 | merge fails |
|
144 | 144 | $ hg merge 2 |
|
145 | 145 | abort: uncommitted changes |
|
146 | 146 | (use 'hg status' to list changes) |
|
147 | 147 | [255] |
|
148 | 148 | merge expected! |
|
149 | 149 | $ hg merge -f 2 |
|
150 | 150 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
151 | 151 | (branch merge, don't forget to commit) |
|
152 | 152 | $ hg diff --nodates |
|
153 | 153 | diff -r 85de557015a8 b |
|
154 | 154 | --- a/b |
|
155 | 155 | +++ b/b |
|
156 | 156 | @@ -1,1 +1,1 @@ |
|
157 | 157 | -This is file b1 |
|
158 | 158 | +This is file b22 |
|
159 | 159 | $ hg status |
|
160 | 160 | M b |
|
161 | 161 | $ cd ..; rm -r t |
|
162 | 162 | |
|
163 | 163 | $ hg init t |
|
164 | 164 | $ cd t |
|
165 | 165 | $ echo This is file a1 > a |
|
166 | 166 | $ hg add a |
|
167 | 167 | $ hg commit -m "commit #0" |
|
168 | 168 | $ echo This is file b1 > b |
|
169 | 169 | $ hg add b |
|
170 | 170 | $ hg commit -m "commit #1" |
|
171 | 171 | $ echo This is file b22 > b |
|
172 | 172 | $ hg commit -m "commit #2" |
|
173 | 173 | $ hg update 1 |
|
174 | 174 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
175 | 175 | $ echo This is file c1 > c |
|
176 | 176 | $ hg add c |
|
177 | 177 | $ hg commit -m "commit #3" |
|
178 | 178 | created new head |
|
179 | 179 | $ echo This is file b33 > b |
|
180 | 180 | merge of b should fail |
|
181 | 181 | $ hg merge 2 |
|
182 | 182 | abort: uncommitted changes |
|
183 | 183 | (use 'hg status' to list changes) |
|
184 | 184 | [255] |
|
185 | 185 | merge of b expected |
|
186 | 186 | $ hg merge -f 2 |
|
187 | 187 | merging b |
|
188 | 188 | merging for b |
|
189 | 189 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
190 | 190 | (branch merge, don't forget to commit) |
|
191 | 191 | $ hg diff --nodates |
|
192 | 192 | diff -r 85de557015a8 b |
|
193 | 193 | --- a/b |
|
194 | 194 | +++ b/b |
|
195 | 195 | @@ -1,1 +1,1 @@ |
|
196 | 196 | -This is file b1 |
|
197 | 197 | +This is file b33 |
|
198 | 198 | $ hg status |
|
199 | 199 | M b |
|
200 | 200 | |
|
201 | 201 | Test for issue2364 |
|
202 | 202 | |
|
203 | 203 | $ hg up -qC . |
|
204 | 204 | $ hg rm b |
|
205 | 205 | $ hg ci -md |
|
206 | 206 | $ hg revert -r -2 b |
|
207 | 207 | $ hg up -q -- -2 |
|
208 | 208 | |
|
209 | Test that updated files are treated as "modified", when | |
|
210 | 'merge.update()' is aborted before 'merge.recordupdates()' (= parents | |
|
211 | aren't changed), even if none of mode, size and timestamp of them | |
|
212 | isn't changed on the filesystem (see also issue4583). | |
|
213 | ||
|
214 | $ cat > $TESTTMP/abort.py <<EOF | |
|
215 | > # emulate aborting before "recordupdates()". in this case, files | |
|
216 | > # are changed without updating dirstate | |
|
217 | > from mercurial import extensions, merge, util | |
|
218 | > def applyupdates(orig, *args, **kwargs): | |
|
219 | > orig(*args, **kwargs) | |
|
220 | > raise util.Abort('intentional aborting') | |
|
221 | > def extsetup(ui): | |
|
222 | > extensions.wrapfunction(merge, "applyupdates", applyupdates) | |
|
223 | > EOF | |
|
224 | ||
|
225 | $ cat >> .hg/hgrc <<EOF | |
|
226 | > [fakedirstatewritetime] | |
|
227 | > # emulate invoking dirstate.write() via repo.status() | |
|
228 | > # at 2000-01-01 00:00 | |
|
229 | > fakenow = 200001010000 | |
|
230 | > EOF | |
|
231 | ||
|
232 | (file gotten from other revision) | |
|
233 | ||
|
234 | $ hg update -q -C 2 | |
|
235 | $ echo 'THIS IS FILE B5' > b | |
|
236 | $ hg commit -m 'commit #5' | |
|
237 | ||
|
238 | $ hg update -q -C 3 | |
|
239 | $ cat b | |
|
240 | This is file b1 | |
|
241 | $ touch -t 200001010000 b | |
|
242 | $ hg debugrebuildstate | |
|
243 | ||
|
244 | $ cat >> .hg/hgrc <<EOF | |
|
245 | > [extensions] | |
|
246 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
|
247 | > abort = $TESTTMP/abort.py | |
|
248 | > EOF | |
|
249 | $ hg merge 5 | |
|
250 | abort: intentional aborting | |
|
251 | [255] | |
|
252 | $ cat >> .hg/hgrc <<EOF | |
|
253 | > [extensions] | |
|
254 | > fakedirstatewritetime = ! | |
|
255 | > abort = ! | |
|
256 | > EOF | |
|
257 | ||
|
258 | $ cat b | |
|
259 | THIS IS FILE B5 | |
|
260 | $ touch -t 200001010000 b | |
|
261 | $ hg status -A b | |
|
262 | M b | |
|
263 | ||
|
264 | (file merged from other revision) | |
|
265 | ||
|
266 | $ hg update -q -C 3 | |
|
267 | $ echo 'this is file b6' > b | |
|
268 | $ hg commit -m 'commit #6' | |
|
269 | created new head | |
|
270 | ||
|
271 | $ cat b | |
|
272 | this is file b6 | |
|
273 | $ touch -t 200001010000 b | |
|
274 | $ hg debugrebuildstate | |
|
275 | ||
|
276 | $ cat >> .hg/hgrc <<EOF | |
|
277 | > [extensions] | |
|
278 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
|
279 | > abort = $TESTTMP/abort.py | |
|
280 | > EOF | |
|
281 | $ hg merge --tool internal:other 5 | |
|
282 | abort: intentional aborting | |
|
283 | [255] | |
|
284 | $ cat >> .hg/hgrc <<EOF | |
|
285 | > [extensions] | |
|
286 | > fakedirstatewritetime = ! | |
|
287 | > abort = ! | |
|
288 | > EOF | |
|
289 | ||
|
290 | $ cat b | |
|
291 | THIS IS FILE B5 | |
|
292 | $ touch -t 200001010000 b | |
|
293 | $ hg status -A b | |
|
294 | M b | |
|
295 | ||
|
209 | 296 | $ cd .. |
@@ -1,1028 +1,1068 b'' | |||
|
1 | 1 | $ hg init repo |
|
2 | 2 | $ cd repo |
|
3 | 3 | $ echo 123 > a |
|
4 | 4 | $ echo 123 > c |
|
5 | 5 | $ echo 123 > e |
|
6 | 6 | $ hg add a c e |
|
7 | 7 | $ hg commit -m "first" a c e |
|
8 | 8 | |
|
9 | 9 | nothing changed |
|
10 | 10 | |
|
11 | 11 | $ hg revert |
|
12 | 12 | abort: no files or directories specified |
|
13 | 13 | (use --all to revert all files) |
|
14 | 14 | [255] |
|
15 | 15 | $ hg revert --all |
|
16 | 16 | |
|
17 | 17 | Introduce some changes and revert them |
|
18 | 18 | -------------------------------------- |
|
19 | 19 | |
|
20 | 20 | $ echo 123 > b |
|
21 | 21 | |
|
22 | 22 | $ hg status |
|
23 | 23 | ? b |
|
24 | 24 | $ echo 12 > c |
|
25 | 25 | |
|
26 | 26 | $ hg status |
|
27 | 27 | M c |
|
28 | 28 | ? b |
|
29 | 29 | $ hg add b |
|
30 | 30 | |
|
31 | 31 | $ hg status |
|
32 | 32 | M c |
|
33 | 33 | A b |
|
34 | 34 | $ hg rm a |
|
35 | 35 | |
|
36 | 36 | $ hg status |
|
37 | 37 | M c |
|
38 | 38 | A b |
|
39 | 39 | R a |
|
40 | 40 | |
|
41 | 41 | revert removal of a file |
|
42 | 42 | |
|
43 | 43 | $ hg revert a |
|
44 | 44 | $ hg status |
|
45 | 45 | M c |
|
46 | 46 | A b |
|
47 | 47 | |
|
48 | 48 | revert addition of a file |
|
49 | 49 | |
|
50 | 50 | $ hg revert b |
|
51 | 51 | $ hg status |
|
52 | 52 | M c |
|
53 | 53 | ? b |
|
54 | 54 | |
|
55 | 55 | revert modification of a file (--no-backup) |
|
56 | 56 | |
|
57 | 57 | $ hg revert --no-backup c |
|
58 | 58 | $ hg status |
|
59 | 59 | ? b |
|
60 | 60 | |
|
61 | 61 | revert deletion (! status) of a added file |
|
62 | 62 | ------------------------------------------ |
|
63 | 63 | |
|
64 | 64 | $ hg add b |
|
65 | 65 | |
|
66 | 66 | $ hg status b |
|
67 | 67 | A b |
|
68 | 68 | $ rm b |
|
69 | 69 | $ hg status b |
|
70 | 70 | ! b |
|
71 | 71 | $ hg revert -v b |
|
72 | 72 | forgetting b |
|
73 | 73 | $ hg status b |
|
74 | 74 | b: * (glob) |
|
75 | 75 | |
|
76 | 76 | $ ls |
|
77 | 77 | a |
|
78 | 78 | c |
|
79 | 79 | e |
|
80 | 80 | |
|
81 | 81 | Test creation of backup (.orig) files |
|
82 | 82 | ------------------------------------- |
|
83 | 83 | |
|
84 | 84 | $ echo z > e |
|
85 | 85 | $ hg revert --all -v |
|
86 | 86 | saving current version of e as e.orig |
|
87 | 87 | reverting e |
|
88 | 88 | |
|
89 | 89 | revert on clean file (no change) |
|
90 | 90 | -------------------------------- |
|
91 | 91 | |
|
92 | 92 | $ hg revert a |
|
93 | 93 | no changes needed to a |
|
94 | 94 | |
|
95 | 95 | revert on an untracked file |
|
96 | 96 | --------------------------- |
|
97 | 97 | |
|
98 | 98 | $ echo q > q |
|
99 | 99 | $ hg revert q |
|
100 | 100 | file not managed: q |
|
101 | 101 | $ rm q |
|
102 | 102 | |
|
103 | 103 | revert on file that does not exists |
|
104 | 104 | ----------------------------------- |
|
105 | 105 | |
|
106 | 106 | $ hg revert notfound |
|
107 | 107 | notfound: no such file in rev 334a9e57682c |
|
108 | 108 | $ touch d |
|
109 | 109 | $ hg add d |
|
110 | 110 | $ hg rm a |
|
111 | 111 | $ hg commit -m "second" |
|
112 | 112 | $ echo z > z |
|
113 | 113 | $ hg add z |
|
114 | 114 | $ hg st |
|
115 | 115 | A z |
|
116 | 116 | ? e.orig |
|
117 | 117 | |
|
118 | 118 | revert to another revision (--rev) |
|
119 | 119 | ---------------------------------- |
|
120 | 120 | |
|
121 | 121 | $ hg revert --all -r0 |
|
122 | 122 | adding a |
|
123 | 123 | removing d |
|
124 | 124 | forgetting z |
|
125 | 125 | |
|
126 | 126 | revert explicitly to parent (--rev) |
|
127 | 127 | ----------------------------------- |
|
128 | 128 | |
|
129 | 129 | $ hg revert --all -rtip |
|
130 | 130 | forgetting a |
|
131 | 131 | undeleting d |
|
132 | 132 | $ rm a *.orig |
|
133 | 133 | |
|
134 | 134 | revert to another revision (--rev) and exact match |
|
135 | 135 | -------------------------------------------------- |
|
136 | 136 | |
|
137 | 137 | exact match are more silent |
|
138 | 138 | |
|
139 | 139 | $ hg revert -r0 a |
|
140 | 140 | $ hg st a |
|
141 | 141 | A a |
|
142 | 142 | $ hg rm d |
|
143 | 143 | $ hg st d |
|
144 | 144 | R d |
|
145 | 145 | |
|
146 | 146 | should keep d removed |
|
147 | 147 | |
|
148 | 148 | $ hg revert -r0 d |
|
149 | 149 | no changes needed to d |
|
150 | 150 | $ hg st d |
|
151 | 151 | R d |
|
152 | 152 | |
|
153 | 153 | $ hg update -C |
|
154 | 154 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
155 | 155 | |
|
156 | 156 | revert of exec bit |
|
157 | 157 | ------------------ |
|
158 | 158 | |
|
159 | 159 | #if execbit |
|
160 | 160 | $ chmod +x c |
|
161 | 161 | $ hg revert --all |
|
162 | 162 | reverting c |
|
163 | 163 | |
|
164 | 164 | $ test -x c || echo non-executable |
|
165 | 165 | non-executable |
|
166 | 166 | |
|
167 | 167 | $ chmod +x c |
|
168 | 168 | $ hg commit -m exe |
|
169 | 169 | |
|
170 | 170 | $ chmod -x c |
|
171 | 171 | $ hg revert --all |
|
172 | 172 | reverting c |
|
173 | 173 | |
|
174 | 174 | $ test -x c && echo executable |
|
175 | 175 | executable |
|
176 | 176 | #endif |
|
177 | 177 | |
|
178 | Test that files reverted to other than the parent are treated as | |
|
179 | "modified", even if none of mode, size and timestamp of it isn't | |
|
180 | changed on the filesystem (see also issue4583). | |
|
181 | ||
|
182 | $ echo 321 > e | |
|
183 | $ hg diff --git | |
|
184 | diff --git a/e b/e | |
|
185 | --- a/e | |
|
186 | +++ b/e | |
|
187 | @@ -1,1 +1,1 @@ | |
|
188 | -123 | |
|
189 | +321 | |
|
190 | $ hg commit -m 'ambiguity from size' | |
|
191 | ||
|
192 | $ cat e | |
|
193 | 321 | |
|
194 | $ touch -t 200001010000 e | |
|
195 | $ hg debugrebuildstate | |
|
196 | ||
|
197 | $ cat >> .hg/hgrc <<EOF | |
|
198 | > [fakedirstatewritetime] | |
|
199 | > # emulate invoking dirstate.write() via repo.status() | |
|
200 | > # at 2000-01-01 00:00 | |
|
201 | > fakenow = 200001010000 | |
|
202 | > | |
|
203 | > [extensions] | |
|
204 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
|
205 | > EOF | |
|
206 | $ hg revert -r 0 e | |
|
207 | $ cat >> .hg/hgrc <<EOF | |
|
208 | > [extensions] | |
|
209 | > fakedirstatewritetime = ! | |
|
210 | > EOF | |
|
211 | ||
|
212 | $ cat e | |
|
213 | 123 | |
|
214 | $ touch -t 200001010000 e | |
|
215 | $ hg status -A e | |
|
216 | M e | |
|
217 | ||
|
178 | 218 | $ cd .. |
|
179 | 219 | |
|
180 | 220 | |
|
181 | 221 | Issue241: update and revert produces inconsistent repositories |
|
182 | 222 | -------------------------------------------------------------- |
|
183 | 223 | |
|
184 | 224 | $ hg init a |
|
185 | 225 | $ cd a |
|
186 | 226 | $ echo a >> a |
|
187 | 227 |
$ |
|
188 | 228 | adding a |
|
189 | 229 | $ echo a >> a |
|
190 | 230 |
$ |
|
191 | 231 | $ hg update 0 |
|
192 | 232 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
193 | 233 | $ mkdir b |
|
194 | 234 | $ echo b > b/b |
|
195 | 235 | |
|
196 | 236 | call `hg revert` with no file specified |
|
197 | 237 | --------------------------------------- |
|
198 | 238 | |
|
199 | 239 | $ hg revert -rtip |
|
200 | 240 | abort: no files or directories specified |
|
201 | 241 |
(use --all to revert all files, or 'hg |
|
202 | 242 | [255] |
|
203 | 243 | |
|
204 | 244 | call `hg revert` with -I |
|
205 | 245 | --------------------------- |
|
206 | 246 | |
|
207 | 247 | $ echo a >> a |
|
208 | 248 | $ hg revert -I a |
|
209 | 249 | reverting a |
|
210 | 250 | |
|
211 | 251 | call `hg revert` with -X |
|
212 | 252 | --------------------------- |
|
213 | 253 | |
|
214 | 254 | $ echo a >> a |
|
215 | 255 | $ hg revert -X d |
|
216 | 256 | reverting a |
|
217 | 257 | |
|
218 | 258 | call `hg revert` with --all |
|
219 | 259 | --------------------------- |
|
220 | 260 | |
|
221 | 261 | $ hg revert --all -rtip |
|
222 | 262 | reverting a |
|
223 | 263 | $ rm *.orig |
|
224 | 264 | |
|
225 | 265 | Issue332: confusing message when reverting directory |
|
226 | 266 | ---------------------------------------------------- |
|
227 | 267 | |
|
228 | 268 | $ hg ci -A -m b |
|
229 | 269 | adding b/b |
|
230 | 270 | created new head |
|
231 | 271 | $ echo foobar > b/b |
|
232 | 272 | $ mkdir newdir |
|
233 | 273 | $ echo foo > newdir/newfile |
|
234 | 274 | $ hg add newdir/newfile |
|
235 | 275 | $ hg revert b newdir |
|
236 | 276 | reverting b/b (glob) |
|
237 | 277 | forgetting newdir/newfile (glob) |
|
238 | 278 | $ echo foobar > b/b |
|
239 | 279 | $ hg revert . |
|
240 | 280 | reverting b/b (glob) |
|
241 | 281 | |
|
242 | 282 | |
|
243 | 283 | reverting a rename target should revert the source |
|
244 | 284 | -------------------------------------------------- |
|
245 | 285 | |
|
246 | 286 | $ hg mv a newa |
|
247 | 287 | $ hg revert newa |
|
248 | 288 | $ hg st a newa |
|
249 | 289 | ? newa |
|
250 | 290 | |
|
251 | 291 | Also true for move overwriting an existing file |
|
252 | 292 | |
|
253 | 293 | $ hg mv --force a b/b |
|
254 | 294 | $ hg revert b/b |
|
255 | 295 | $ hg status a b/b |
|
256 | 296 | |
|
257 | 297 | $ cd .. |
|
258 | 298 | |
|
259 | 299 | $ hg init ignored |
|
260 | 300 | $ cd ignored |
|
261 | 301 |
|
|
262 | 302 |
|
|
263 | 303 |
|
|
264 | 304 | |
|
265 | 305 | $ mkdir ignoreddir |
|
266 | 306 | $ touch ignoreddir/file |
|
267 | 307 | $ touch ignoreddir/removed |
|
268 | 308 | $ touch ignored |
|
269 | 309 | $ touch removed |
|
270 | 310 | |
|
271 | 311 | 4 ignored files (we will add/commit everything) |
|
272 | 312 | |
|
273 | 313 | $ hg st -A -X .hgignore |
|
274 | 314 | I ignored |
|
275 | 315 | I ignoreddir/file |
|
276 | 316 | I ignoreddir/removed |
|
277 | 317 | I removed |
|
278 | 318 |
|
|
279 | 319 | |
|
280 | 320 | $ echo >> ignored |
|
281 | 321 | $ echo >> ignoreddir/file |
|
282 | 322 | $ hg rm removed ignoreddir/removed |
|
283 | 323 | |
|
284 | 324 | should revert ignored* and undelete *removed |
|
285 | 325 | -------------------------------------------- |
|
286 | 326 | |
|
287 | 327 | $ hg revert -a --no-backup |
|
288 | 328 | reverting ignored |
|
289 | 329 | reverting ignoreddir/file (glob) |
|
290 | 330 | undeleting ignoreddir/removed (glob) |
|
291 | 331 | undeleting removed |
|
292 | 332 | $ hg st -mardi |
|
293 | 333 | |
|
294 | 334 | $ hg up -qC |
|
295 | 335 | $ echo >> ignored |
|
296 | 336 | $ hg rm removed |
|
297 | 337 | |
|
298 | 338 | should silently revert the named files |
|
299 | 339 | -------------------------------------- |
|
300 | 340 | |
|
301 | 341 | $ hg revert --no-backup ignored removed |
|
302 | 342 | $ hg st -mardi |
|
303 | 343 | |
|
304 | 344 | Reverting copy (issue3920) |
|
305 | 345 | -------------------------- |
|
306 | 346 | |
|
307 | 347 | someone set up us the copies |
|
308 | 348 | |
|
309 | 349 | $ rm .hgignore |
|
310 | 350 | $ hg update -C |
|
311 | 351 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
312 | 352 | $ hg mv ignored allyour |
|
313 | 353 | $ hg copy removed base |
|
314 | 354 | $ hg commit -m rename |
|
315 | 355 | |
|
316 | 356 | copies and renames, you have no chance to survive make your time (issue3920) |
|
317 | 357 | |
|
318 | 358 | $ hg update '.^' |
|
319 | 359 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
320 | 360 | $ hg revert -rtip -a |
|
321 | 361 | adding allyour |
|
322 | 362 | adding base |
|
323 | 363 | removing ignored |
|
324 | 364 | $ hg status -C |
|
325 | 365 | A allyour |
|
326 | 366 | ignored |
|
327 | 367 | A base |
|
328 | 368 | removed |
|
329 | 369 | R ignored |
|
330 | 370 | |
|
331 | 371 | Test revert of a file added by one side of the merge |
|
332 | 372 | ==================================================== |
|
333 | 373 | |
|
334 | 374 | remove any pending change |
|
335 | 375 | |
|
336 | 376 | $ hg revert --all |
|
337 | 377 | forgetting allyour |
|
338 | 378 | forgetting base |
|
339 | 379 | undeleting ignored |
|
340 | 380 | $ hg purge --all --config extensions.purge= |
|
341 | 381 | |
|
342 | 382 | Adds a new commit |
|
343 | 383 | |
|
344 | 384 | $ echo foo > newadd |
|
345 | 385 | $ hg add newadd |
|
346 | 386 |
$ |
|
347 | 387 | created new head |
|
348 | 388 | |
|
349 | 389 | |
|
350 | 390 | merge it with the other head |
|
351 | 391 | |
|
352 | 392 | $ hg merge # merge 1 into 2 |
|
353 | 393 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
354 | 394 |
|
|
355 | 395 | $ hg summary |
|
356 | 396 | parent: 2:b8ec310b2d4e tip |
|
357 | 397 | other adds |
|
358 | 398 | parent: 1:f6180deb8fbe |
|
359 | 399 | rename |
|
360 | 400 | branch: default |
|
361 | 401 | commit: 2 modified, 1 removed (merge) |
|
362 | 402 | update: (current) |
|
363 | 403 | phases: 3 draft |
|
364 | 404 | |
|
365 | 405 | clarifies who added what |
|
366 | 406 | |
|
367 | 407 | $ hg status |
|
368 | 408 | M allyour |
|
369 | 409 | M base |
|
370 | 410 | R ignored |
|
371 | 411 | $ hg status --change 'p1()' |
|
372 | 412 | A newadd |
|
373 | 413 | $ hg status --change 'p2()' |
|
374 | 414 | A allyour |
|
375 | 415 | A base |
|
376 | 416 | R ignored |
|
377 | 417 | |
|
378 | 418 | revert file added by p1() to p1() state |
|
379 | 419 | ----------------------------------------- |
|
380 | 420 | |
|
381 | 421 | $ hg revert -r 'p1()' 'glob:newad?' |
|
382 | 422 | $ hg status |
|
383 | 423 | M allyour |
|
384 | 424 | M base |
|
385 | 425 | R ignored |
|
386 | 426 | |
|
387 | 427 | revert file added by p1() to p2() state |
|
388 | 428 | ------------------------------------------ |
|
389 | 429 | |
|
390 | 430 | $ hg revert -r 'p2()' 'glob:newad?' |
|
391 | 431 | removing newadd |
|
392 | 432 | $ hg status |
|
393 | 433 | M allyour |
|
394 | 434 | M base |
|
395 | 435 | R ignored |
|
396 | 436 | R newadd |
|
397 | 437 | |
|
398 | 438 | revert file added by p2() to p2() state |
|
399 | 439 | ------------------------------------------ |
|
400 | 440 | |
|
401 | 441 | $ hg revert -r 'p2()' 'glob:allyou?' |
|
402 | 442 | $ hg status |
|
403 | 443 | M allyour |
|
404 | 444 | M base |
|
405 | 445 | R ignored |
|
406 | 446 | R newadd |
|
407 | 447 | |
|
408 | 448 | revert file added by p2() to p1() state |
|
409 | 449 | ------------------------------------------ |
|
410 | 450 | |
|
411 | 451 | $ hg revert -r 'p1()' 'glob:allyou?' |
|
412 | 452 | removing allyour |
|
413 | 453 | $ hg status |
|
414 | 454 | M base |
|
415 | 455 | R allyour |
|
416 | 456 | R ignored |
|
417 | 457 | R newadd |
|
418 | 458 | |
|
419 | 459 | Systematic behavior validation of most possible cases |
|
420 | 460 | ===================================================== |
|
421 | 461 | |
|
422 | 462 | This section tests most of the possible combinations of revision states and |
|
423 | 463 | working directory states. The number of possible cases is significant but they |
|
424 | 464 | but they all have a slightly different handling. So this section commits to |
|
425 | 465 | and testing all of them to allow safe refactoring of the revert code. |
|
426 | 466 | |
|
427 | 467 | A python script is used to generate a file history for each combination of |
|
428 | 468 | states, on one side the content (or lack thereof) in two revisions, and |
|
429 | 469 | on the other side, the content and "tracked-ness" of the working directory. The |
|
430 | 470 | three states generated are: |
|
431 | 471 | |
|
432 | 472 | - a "base" revision |
|
433 | 473 | - a "parent" revision |
|
434 | 474 | - the working directory (based on "parent") |
|
435 | 475 | |
|
436 | 476 | The files generated have names of the form: |
|
437 | 477 | |
|
438 | 478 | <rev1-content>_<rev2-content>_<working-copy-content>-<tracked-ness> |
|
439 | 479 | |
|
440 | 480 | All known states are not tested yet. See inline documentation for details. |
|
441 | 481 | Special cases from merge and rename are not tested by this section. |
|
442 | 482 | |
|
443 | 483 | Write the python script to disk |
|
444 | 484 | ------------------------------- |
|
445 | 485 | |
|
446 | 486 | check list of planned files |
|
447 | 487 | |
|
448 | 488 | $ python $TESTDIR/generate-working-copy-states.py filelist 2 |
|
449 | 489 | content1_content1_content1-tracked |
|
450 | 490 | content1_content1_content1-untracked |
|
451 | 491 | content1_content1_content3-tracked |
|
452 | 492 | content1_content1_content3-untracked |
|
453 | 493 | content1_content1_missing-tracked |
|
454 | 494 | content1_content1_missing-untracked |
|
455 | 495 | content1_content2_content1-tracked |
|
456 | 496 | content1_content2_content1-untracked |
|
457 | 497 | content1_content2_content2-tracked |
|
458 | 498 | content1_content2_content2-untracked |
|
459 | 499 | content1_content2_content3-tracked |
|
460 | 500 | content1_content2_content3-untracked |
|
461 | 501 | content1_content2_missing-tracked |
|
462 | 502 | content1_content2_missing-untracked |
|
463 | 503 | content1_missing_content1-tracked |
|
464 | 504 | content1_missing_content1-untracked |
|
465 | 505 | content1_missing_content3-tracked |
|
466 | 506 | content1_missing_content3-untracked |
|
467 | 507 | content1_missing_missing-tracked |
|
468 | 508 | content1_missing_missing-untracked |
|
469 | 509 | missing_content2_content2-tracked |
|
470 | 510 | missing_content2_content2-untracked |
|
471 | 511 | missing_content2_content3-tracked |
|
472 | 512 | missing_content2_content3-untracked |
|
473 | 513 | missing_content2_missing-tracked |
|
474 | 514 | missing_content2_missing-untracked |
|
475 | 515 | missing_missing_content3-tracked |
|
476 | 516 | missing_missing_content3-untracked |
|
477 | 517 | missing_missing_missing-tracked |
|
478 | 518 | missing_missing_missing-untracked |
|
479 | 519 | |
|
480 | 520 | Script to make a simple text version of the content |
|
481 | 521 | --------------------------------------------------- |
|
482 | 522 | |
|
483 | 523 | $ cat << EOF >> dircontent.py |
|
484 | 524 | > # generate a simple text view of the directory for easy comparison |
|
485 | 525 | > import os |
|
486 | 526 |
> files = os.listdir(' |
|
487 | 527 | > files.sort() |
|
488 | 528 | > for filename in files: |
|
489 | 529 | > if os.path.isdir(filename): |
|
490 | 530 | > continue |
|
491 | 531 | > content = open(filename).read() |
|
492 | 532 |
> print '%-6s % |
|
493 | 533 | > EOF |
|
494 | 534 | |
|
495 | 535 | Generate appropriate repo state |
|
496 | 536 | ------------------------------- |
|
497 | 537 | |
|
498 | 538 | $ hg init revert-ref |
|
499 | 539 | $ cd revert-ref |
|
500 | 540 | |
|
501 | 541 | Generate base changeset |
|
502 | 542 | |
|
503 | 543 | $ python $TESTDIR/generate-working-copy-states.py state 2 1 |
|
504 | 544 | $ hg addremove --similarity 0 |
|
505 | 545 | adding content1_content1_content1-tracked |
|
506 | 546 | adding content1_content1_content1-untracked |
|
507 | 547 | adding content1_content1_content3-tracked |
|
508 | 548 | adding content1_content1_content3-untracked |
|
509 | 549 | adding content1_content1_missing-tracked |
|
510 | 550 | adding content1_content1_missing-untracked |
|
511 | 551 | adding content1_content2_content1-tracked |
|
512 | 552 | adding content1_content2_content1-untracked |
|
513 | 553 | adding content1_content2_content2-tracked |
|
514 | 554 | adding content1_content2_content2-untracked |
|
515 | 555 | adding content1_content2_content3-tracked |
|
516 | 556 | adding content1_content2_content3-untracked |
|
517 | 557 | adding content1_content2_missing-tracked |
|
518 | 558 | adding content1_content2_missing-untracked |
|
519 | 559 | adding content1_missing_content1-tracked |
|
520 | 560 | adding content1_missing_content1-untracked |
|
521 | 561 | adding content1_missing_content3-tracked |
|
522 | 562 | adding content1_missing_content3-untracked |
|
523 | 563 | adding content1_missing_missing-tracked |
|
524 | 564 | adding content1_missing_missing-untracked |
|
525 | 565 | $ hg status |
|
526 | 566 | A content1_content1_content1-tracked |
|
527 | 567 | A content1_content1_content1-untracked |
|
528 | 568 | A content1_content1_content3-tracked |
|
529 | 569 | A content1_content1_content3-untracked |
|
530 | 570 | A content1_content1_missing-tracked |
|
531 | 571 | A content1_content1_missing-untracked |
|
532 | 572 | A content1_content2_content1-tracked |
|
533 | 573 | A content1_content2_content1-untracked |
|
534 | 574 | A content1_content2_content2-tracked |
|
535 | 575 | A content1_content2_content2-untracked |
|
536 | 576 | A content1_content2_content3-tracked |
|
537 | 577 | A content1_content2_content3-untracked |
|
538 | 578 | A content1_content2_missing-tracked |
|
539 | 579 | A content1_content2_missing-untracked |
|
540 | 580 | A content1_missing_content1-tracked |
|
541 | 581 | A content1_missing_content1-untracked |
|
542 | 582 | A content1_missing_content3-tracked |
|
543 | 583 | A content1_missing_content3-untracked |
|
544 | 584 | A content1_missing_missing-tracked |
|
545 | 585 | A content1_missing_missing-untracked |
|
546 | 586 | $ hg commit -m 'base' |
|
547 | 587 | |
|
548 | 588 | (create a simple text version of the content) |
|
549 | 589 | |
|
550 | 590 | $ python ../dircontent.py > ../content-base.txt |
|
551 | 591 | $ cat ../content-base.txt |
|
552 | 592 | content1 content1_content1_content1-tracked |
|
553 | 593 | content1 content1_content1_content1-untracked |
|
554 | 594 | content1 content1_content1_content3-tracked |
|
555 | 595 | content1 content1_content1_content3-untracked |
|
556 | 596 | content1 content1_content1_missing-tracked |
|
557 | 597 | content1 content1_content1_missing-untracked |
|
558 | 598 | content1 content1_content2_content1-tracked |
|
559 | 599 | content1 content1_content2_content1-untracked |
|
560 | 600 | content1 content1_content2_content2-tracked |
|
561 | 601 | content1 content1_content2_content2-untracked |
|
562 | 602 | content1 content1_content2_content3-tracked |
|
563 | 603 | content1 content1_content2_content3-untracked |
|
564 | 604 | content1 content1_content2_missing-tracked |
|
565 | 605 | content1 content1_content2_missing-untracked |
|
566 | 606 | content1 content1_missing_content1-tracked |
|
567 | 607 | content1 content1_missing_content1-untracked |
|
568 | 608 | content1 content1_missing_content3-tracked |
|
569 | 609 | content1 content1_missing_content3-untracked |
|
570 | 610 | content1 content1_missing_missing-tracked |
|
571 | 611 | content1 content1_missing_missing-untracked |
|
572 | 612 | |
|
573 | 613 | Create parent changeset |
|
574 | 614 | |
|
575 | 615 | $ python $TESTDIR/generate-working-copy-states.py state 2 2 |
|
576 | 616 | $ hg addremove --similarity 0 |
|
577 | 617 | removing content1_missing_content1-tracked |
|
578 | 618 | removing content1_missing_content1-untracked |
|
579 | 619 | removing content1_missing_content3-tracked |
|
580 | 620 | removing content1_missing_content3-untracked |
|
581 | 621 | removing content1_missing_missing-tracked |
|
582 | 622 | removing content1_missing_missing-untracked |
|
583 | 623 | adding missing_content2_content2-tracked |
|
584 | 624 | adding missing_content2_content2-untracked |
|
585 | 625 | adding missing_content2_content3-tracked |
|
586 | 626 | adding missing_content2_content3-untracked |
|
587 | 627 | adding missing_content2_missing-tracked |
|
588 | 628 | adding missing_content2_missing-untracked |
|
589 | 629 | $ hg status |
|
590 | 630 | M content1_content2_content1-tracked |
|
591 | 631 | M content1_content2_content1-untracked |
|
592 | 632 | M content1_content2_content2-tracked |
|
593 | 633 | M content1_content2_content2-untracked |
|
594 | 634 | M content1_content2_content3-tracked |
|
595 | 635 | M content1_content2_content3-untracked |
|
596 | 636 | M content1_content2_missing-tracked |
|
597 | 637 | M content1_content2_missing-untracked |
|
598 | 638 | A missing_content2_content2-tracked |
|
599 | 639 | A missing_content2_content2-untracked |
|
600 | 640 | A missing_content2_content3-tracked |
|
601 | 641 | A missing_content2_content3-untracked |
|
602 | 642 | A missing_content2_missing-tracked |
|
603 | 643 | A missing_content2_missing-untracked |
|
604 | 644 | R content1_missing_content1-tracked |
|
605 | 645 | R content1_missing_content1-untracked |
|
606 | 646 | R content1_missing_content3-tracked |
|
607 | 647 | R content1_missing_content3-untracked |
|
608 | 648 | R content1_missing_missing-tracked |
|
609 | 649 | R content1_missing_missing-untracked |
|
610 | 650 | $ hg commit -m 'parent' |
|
611 | 651 | |
|
612 | 652 | (create a simple text version of the content) |
|
613 | 653 | |
|
614 | 654 | $ python ../dircontent.py > ../content-parent.txt |
|
615 | 655 | $ cat ../content-parent.txt |
|
616 | 656 | content1 content1_content1_content1-tracked |
|
617 | 657 | content1 content1_content1_content1-untracked |
|
618 | 658 | content1 content1_content1_content3-tracked |
|
619 | 659 | content1 content1_content1_content3-untracked |
|
620 | 660 | content1 content1_content1_missing-tracked |
|
621 | 661 | content1 content1_content1_missing-untracked |
|
622 | 662 | content2 content1_content2_content1-tracked |
|
623 | 663 | content2 content1_content2_content1-untracked |
|
624 | 664 | content2 content1_content2_content2-tracked |
|
625 | 665 | content2 content1_content2_content2-untracked |
|
626 | 666 | content2 content1_content2_content3-tracked |
|
627 | 667 | content2 content1_content2_content3-untracked |
|
628 | 668 | content2 content1_content2_missing-tracked |
|
629 | 669 | content2 content1_content2_missing-untracked |
|
630 | 670 | content2 missing_content2_content2-tracked |
|
631 | 671 | content2 missing_content2_content2-untracked |
|
632 | 672 | content2 missing_content2_content3-tracked |
|
633 | 673 | content2 missing_content2_content3-untracked |
|
634 | 674 | content2 missing_content2_missing-tracked |
|
635 | 675 | content2 missing_content2_missing-untracked |
|
636 | 676 | |
|
637 | 677 | Setup working directory |
|
638 | 678 | |
|
639 | 679 | $ python $TESTDIR/generate-working-copy-states.py state 2 wc |
|
640 | 680 | $ hg addremove --similarity 0 |
|
641 | 681 | adding content1_missing_content1-tracked |
|
642 | 682 | adding content1_missing_content1-untracked |
|
643 | 683 | adding content1_missing_content3-tracked |
|
644 | 684 | adding content1_missing_content3-untracked |
|
645 | 685 | adding content1_missing_missing-tracked |
|
646 | 686 | adding content1_missing_missing-untracked |
|
647 | 687 | adding missing_missing_content3-tracked |
|
648 | 688 | adding missing_missing_content3-untracked |
|
649 | 689 | adding missing_missing_missing-tracked |
|
650 | 690 | adding missing_missing_missing-untracked |
|
651 | 691 | $ hg forget *_*_*-untracked |
|
652 | 692 | $ rm *_*_missing-* |
|
653 | 693 | $ hg status |
|
654 | 694 | M content1_content1_content3-tracked |
|
655 | 695 | M content1_content2_content1-tracked |
|
656 | 696 | M content1_content2_content3-tracked |
|
657 | 697 | M missing_content2_content3-tracked |
|
658 | 698 | A content1_missing_content1-tracked |
|
659 | 699 | A content1_missing_content3-tracked |
|
660 | 700 | A missing_missing_content3-tracked |
|
661 | 701 | R content1_content1_content1-untracked |
|
662 | 702 | R content1_content1_content3-untracked |
|
663 | 703 | R content1_content1_missing-untracked |
|
664 | 704 | R content1_content2_content1-untracked |
|
665 | 705 | R content1_content2_content2-untracked |
|
666 | 706 | R content1_content2_content3-untracked |
|
667 | 707 | R content1_content2_missing-untracked |
|
668 | 708 | R missing_content2_content2-untracked |
|
669 | 709 | R missing_content2_content3-untracked |
|
670 | 710 | R missing_content2_missing-untracked |
|
671 | 711 | ! content1_content1_missing-tracked |
|
672 | 712 | ! content1_content2_missing-tracked |
|
673 | 713 | ! content1_missing_missing-tracked |
|
674 | 714 | ! missing_content2_missing-tracked |
|
675 | 715 | ! missing_missing_missing-tracked |
|
676 | 716 | ? content1_missing_content1-untracked |
|
677 | 717 | ? content1_missing_content3-untracked |
|
678 | 718 | ? missing_missing_content3-untracked |
|
679 | 719 | |
|
680 | 720 | $ hg status --rev 'desc("base")' |
|
681 | 721 | M content1_content1_content3-tracked |
|
682 | 722 | M content1_content2_content2-tracked |
|
683 | 723 | M content1_content2_content3-tracked |
|
684 | 724 | M content1_missing_content3-tracked |
|
685 | 725 | A missing_content2_content2-tracked |
|
686 | 726 | A missing_content2_content3-tracked |
|
687 | 727 | A missing_missing_content3-tracked |
|
688 | 728 | R content1_content1_content1-untracked |
|
689 | 729 | R content1_content1_content3-untracked |
|
690 | 730 | R content1_content1_missing-untracked |
|
691 | 731 | R content1_content2_content1-untracked |
|
692 | 732 | R content1_content2_content2-untracked |
|
693 | 733 | R content1_content2_content3-untracked |
|
694 | 734 | R content1_content2_missing-untracked |
|
695 | 735 | R content1_missing_content1-untracked |
|
696 | 736 | R content1_missing_content3-untracked |
|
697 | 737 | R content1_missing_missing-untracked |
|
698 | 738 | ! content1_content1_missing-tracked |
|
699 | 739 | ! content1_content2_missing-tracked |
|
700 | 740 | ! content1_missing_missing-tracked |
|
701 | 741 | ! missing_content2_missing-tracked |
|
702 | 742 | ! missing_missing_missing-tracked |
|
703 | 743 | ? missing_missing_content3-untracked |
|
704 | 744 | |
|
705 | 745 | (create a simple text version of the content) |
|
706 | 746 | |
|
707 | 747 | $ python ../dircontent.py > ../content-wc.txt |
|
708 | 748 | $ cat ../content-wc.txt |
|
709 | 749 | content1 content1_content1_content1-tracked |
|
710 | 750 | content1 content1_content1_content1-untracked |
|
711 | 751 | content3 content1_content1_content3-tracked |
|
712 | 752 | content3 content1_content1_content3-untracked |
|
713 | 753 | content1 content1_content2_content1-tracked |
|
714 | 754 | content1 content1_content2_content1-untracked |
|
715 | 755 | content2 content1_content2_content2-tracked |
|
716 | 756 | content2 content1_content2_content2-untracked |
|
717 | 757 | content3 content1_content2_content3-tracked |
|
718 | 758 | content3 content1_content2_content3-untracked |
|
719 | 759 | content1 content1_missing_content1-tracked |
|
720 | 760 | content1 content1_missing_content1-untracked |
|
721 | 761 | content3 content1_missing_content3-tracked |
|
722 | 762 | content3 content1_missing_content3-untracked |
|
723 | 763 | content2 missing_content2_content2-tracked |
|
724 | 764 | content2 missing_content2_content2-untracked |
|
725 | 765 | content3 missing_content2_content3-tracked |
|
726 | 766 | content3 missing_content2_content3-untracked |
|
727 | 767 | content3 missing_missing_content3-tracked |
|
728 | 768 | content3 missing_missing_content3-untracked |
|
729 | 769 | |
|
730 | 770 | $ cd .. |
|
731 | 771 | |
|
732 | 772 | Test revert --all to parent content |
|
733 | 773 | ----------------------------------- |
|
734 | 774 | |
|
735 | 775 | (setup from reference repo) |
|
736 | 776 | |
|
737 | 777 | $ cp -r revert-ref revert-parent-all |
|
738 | 778 | $ cd revert-parent-all |
|
739 | 779 | |
|
740 | 780 | check revert output |
|
741 | 781 | |
|
742 | 782 | $ hg revert --all |
|
743 | 783 | undeleting content1_content1_content1-untracked |
|
744 | 784 | reverting content1_content1_content3-tracked |
|
745 | 785 | undeleting content1_content1_content3-untracked |
|
746 | 786 | reverting content1_content1_missing-tracked |
|
747 | 787 | undeleting content1_content1_missing-untracked |
|
748 | 788 | reverting content1_content2_content1-tracked |
|
749 | 789 | undeleting content1_content2_content1-untracked |
|
750 | 790 | undeleting content1_content2_content2-untracked |
|
751 | 791 | reverting content1_content2_content3-tracked |
|
752 | 792 | undeleting content1_content2_content3-untracked |
|
753 | 793 | reverting content1_content2_missing-tracked |
|
754 | 794 | undeleting content1_content2_missing-untracked |
|
755 | 795 | forgetting content1_missing_content1-tracked |
|
756 | 796 | forgetting content1_missing_content3-tracked |
|
757 | 797 | forgetting content1_missing_missing-tracked |
|
758 | 798 | undeleting missing_content2_content2-untracked |
|
759 | 799 | reverting missing_content2_content3-tracked |
|
760 | 800 | undeleting missing_content2_content3-untracked |
|
761 | 801 | reverting missing_content2_missing-tracked |
|
762 | 802 | undeleting missing_content2_missing-untracked |
|
763 | 803 | forgetting missing_missing_content3-tracked |
|
764 | 804 | forgetting missing_missing_missing-tracked |
|
765 | 805 | |
|
766 | 806 | Compare resulting directory with revert target. |
|
767 | 807 | |
|
768 | 808 | The diff is filtered to include change only. The only difference should be |
|
769 | 809 | additional `.orig` backup file when applicable. |
|
770 | 810 | |
|
771 | 811 | $ python ../dircontent.py > ../content-parent-all.txt |
|
772 | 812 | $ cd .. |
|
773 | 813 | $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _ |
|
774 | 814 | +content3 content1_content1_content3-tracked.orig |
|
775 | 815 | +content3 content1_content1_content3-untracked.orig |
|
776 | 816 | +content1 content1_content2_content1-tracked.orig |
|
777 | 817 | +content1 content1_content2_content1-untracked.orig |
|
778 | 818 | +content3 content1_content2_content3-tracked.orig |
|
779 | 819 | +content3 content1_content2_content3-untracked.orig |
|
780 | 820 | +content1 content1_missing_content1-tracked |
|
781 | 821 | +content1 content1_missing_content1-untracked |
|
782 | 822 | +content3 content1_missing_content3-tracked |
|
783 | 823 | +content3 content1_missing_content3-untracked |
|
784 | 824 | +content3 missing_content2_content3-tracked.orig |
|
785 | 825 | +content3 missing_content2_content3-untracked.orig |
|
786 | 826 | +content3 missing_missing_content3-tracked |
|
787 | 827 | +content3 missing_missing_content3-untracked |
|
788 | 828 | |
|
789 | 829 | Test revert --all to "base" content |
|
790 | 830 | ----------------------------------- |
|
791 | 831 | |
|
792 | 832 | (setup from reference repo) |
|
793 | 833 | |
|
794 | 834 | $ cp -r revert-ref revert-base-all |
|
795 | 835 | $ cd revert-base-all |
|
796 | 836 | |
|
797 | 837 | check revert output |
|
798 | 838 | |
|
799 | 839 | $ hg revert --all --rev 'desc(base)' |
|
800 | 840 | undeleting content1_content1_content1-untracked |
|
801 | 841 | reverting content1_content1_content3-tracked |
|
802 | 842 | undeleting content1_content1_content3-untracked |
|
803 | 843 | reverting content1_content1_missing-tracked |
|
804 | 844 | undeleting content1_content1_missing-untracked |
|
805 | 845 | undeleting content1_content2_content1-untracked |
|
806 | 846 | reverting content1_content2_content2-tracked |
|
807 | 847 | undeleting content1_content2_content2-untracked |
|
808 | 848 | reverting content1_content2_content3-tracked |
|
809 | 849 | undeleting content1_content2_content3-untracked |
|
810 | 850 | reverting content1_content2_missing-tracked |
|
811 | 851 | undeleting content1_content2_missing-untracked |
|
812 | 852 | adding content1_missing_content1-untracked |
|
813 | 853 | reverting content1_missing_content3-tracked |
|
814 | 854 | adding content1_missing_content3-untracked |
|
815 | 855 | reverting content1_missing_missing-tracked |
|
816 | 856 | adding content1_missing_missing-untracked |
|
817 | 857 | removing missing_content2_content2-tracked |
|
818 | 858 | removing missing_content2_content3-tracked |
|
819 | 859 | removing missing_content2_missing-tracked |
|
820 | 860 | forgetting missing_missing_content3-tracked |
|
821 | 861 | forgetting missing_missing_missing-tracked |
|
822 | 862 | |
|
823 | 863 | Compare resulting directory with revert target. |
|
824 | 864 | |
|
825 | 865 | The diff is filtered to include change only. The only difference should be |
|
826 | 866 | additional `.orig` backup file when applicable. |
|
827 | 867 | |
|
828 | 868 | $ python ../dircontent.py > ../content-base-all.txt |
|
829 | 869 | $ cd .. |
|
830 | 870 | $ diff -U 0 -- content-base.txt content-base-all.txt | grep _ |
|
831 | 871 | +content3 content1_content1_content3-tracked.orig |
|
832 | 872 | +content3 content1_content1_content3-untracked.orig |
|
833 | 873 | +content2 content1_content2_content2-untracked.orig |
|
834 | 874 | +content3 content1_content2_content3-tracked.orig |
|
835 | 875 | +content3 content1_content2_content3-untracked.orig |
|
836 | 876 | +content3 content1_missing_content3-tracked.orig |
|
837 | 877 | +content3 content1_missing_content3-untracked.orig |
|
838 | 878 | +content2 missing_content2_content2-untracked |
|
839 | 879 | +content3 missing_content2_content3-tracked.orig |
|
840 | 880 | +content3 missing_content2_content3-untracked |
|
841 | 881 | +content3 missing_missing_content3-tracked |
|
842 | 882 | +content3 missing_missing_content3-untracked |
|
843 | 883 | |
|
844 | 884 | Test revert to parent content with explicit file name |
|
845 | 885 | ----------------------------------------------------- |
|
846 | 886 | |
|
847 | 887 | (setup from reference repo) |
|
848 | 888 | |
|
849 | 889 | $ cp -r revert-ref revert-parent-explicit |
|
850 | 890 | $ cd revert-parent-explicit |
|
851 | 891 | |
|
852 | 892 | revert all files individually and check the output |
|
853 | 893 | (output is expected to be different than in the --all case) |
|
854 | 894 | |
|
855 | 895 | $ for file in `python $TESTDIR/generate-working-copy-states.py filelist 2`; do |
|
856 | 896 |
> echo |
|
857 | 897 | > hg revert $file; |
|
858 | 898 | > echo |
|
859 | 899 | > done |
|
860 | 900 | ### revert for: content1_content1_content1-tracked |
|
861 | 901 | no changes needed to content1_content1_content1-tracked |
|
862 | 902 | |
|
863 | 903 | ### revert for: content1_content1_content1-untracked |
|
864 | 904 | |
|
865 | 905 | ### revert for: content1_content1_content3-tracked |
|
866 | 906 | |
|
867 | 907 | ### revert for: content1_content1_content3-untracked |
|
868 | 908 | |
|
869 | 909 | ### revert for: content1_content1_missing-tracked |
|
870 | 910 | |
|
871 | 911 | ### revert for: content1_content1_missing-untracked |
|
872 | 912 | |
|
873 | 913 | ### revert for: content1_content2_content1-tracked |
|
874 | 914 | |
|
875 | 915 | ### revert for: content1_content2_content1-untracked |
|
876 | 916 | |
|
877 | 917 | ### revert for: content1_content2_content2-tracked |
|
878 | 918 | no changes needed to content1_content2_content2-tracked |
|
879 | 919 | |
|
880 | 920 | ### revert for: content1_content2_content2-untracked |
|
881 | 921 | |
|
882 | 922 | ### revert for: content1_content2_content3-tracked |
|
883 | 923 | |
|
884 | 924 | ### revert for: content1_content2_content3-untracked |
|
885 | 925 | |
|
886 | 926 | ### revert for: content1_content2_missing-tracked |
|
887 | 927 | |
|
888 | 928 | ### revert for: content1_content2_missing-untracked |
|
889 | 929 | |
|
890 | 930 | ### revert for: content1_missing_content1-tracked |
|
891 | 931 | |
|
892 | 932 | ### revert for: content1_missing_content1-untracked |
|
893 | 933 | file not managed: content1_missing_content1-untracked |
|
894 | 934 | |
|
895 | 935 | ### revert for: content1_missing_content3-tracked |
|
896 | 936 | |
|
897 | 937 | ### revert for: content1_missing_content3-untracked |
|
898 | 938 | file not managed: content1_missing_content3-untracked |
|
899 | 939 | |
|
900 | 940 | ### revert for: content1_missing_missing-tracked |
|
901 | 941 | |
|
902 | 942 | ### revert for: content1_missing_missing-untracked |
|
903 | 943 | content1_missing_missing-untracked: no such file in rev * (glob) |
|
904 | 944 | |
|
905 | 945 | ### revert for: missing_content2_content2-tracked |
|
906 | 946 | no changes needed to missing_content2_content2-tracked |
|
907 | 947 | |
|
908 | 948 | ### revert for: missing_content2_content2-untracked |
|
909 | 949 | |
|
910 | 950 | ### revert for: missing_content2_content3-tracked |
|
911 | 951 | |
|
912 | 952 | ### revert for: missing_content2_content3-untracked |
|
913 | 953 | |
|
914 | 954 | ### revert for: missing_content2_missing-tracked |
|
915 | 955 | |
|
916 | 956 | ### revert for: missing_content2_missing-untracked |
|
917 | 957 | |
|
918 | 958 | ### revert for: missing_missing_content3-tracked |
|
919 | 959 | |
|
920 | 960 | ### revert for: missing_missing_content3-untracked |
|
921 | 961 | file not managed: missing_missing_content3-untracked |
|
922 | 962 | |
|
923 | 963 | ### revert for: missing_missing_missing-tracked |
|
924 | 964 | |
|
925 | 965 | ### revert for: missing_missing_missing-untracked |
|
926 | 966 | missing_missing_missing-untracked: no such file in rev * (glob) |
|
927 | 967 | |
|
928 | 968 | |
|
929 | 969 | check resulting directory against the --all run |
|
930 | 970 | (There should be no difference) |
|
931 | 971 | |
|
932 | 972 | $ python ../dircontent.py > ../content-parent-explicit.txt |
|
933 | 973 | $ cd .. |
|
934 | 974 | $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _ |
|
935 | 975 | [1] |
|
936 | 976 | |
|
937 | 977 | Test revert to "base" content with explicit file name |
|
938 | 978 | ----------------------------------------------------- |
|
939 | 979 | |
|
940 | 980 | (setup from reference repo) |
|
941 | 981 | |
|
942 | 982 | $ cp -r revert-ref revert-base-explicit |
|
943 | 983 | $ cd revert-base-explicit |
|
944 | 984 | |
|
945 | 985 | revert all files individually and check the output |
|
946 | 986 | (output is expected to be different than in the --all case) |
|
947 | 987 | |
|
948 | 988 | $ for file in `python $TESTDIR/generate-working-copy-states.py filelist 2`; do |
|
949 | 989 |
> echo |
|
950 | 990 | > hg revert $file --rev 'desc(base)'; |
|
951 | 991 | > echo |
|
952 | 992 | > done |
|
953 | 993 | ### revert for: content1_content1_content1-tracked |
|
954 | 994 | no changes needed to content1_content1_content1-tracked |
|
955 | 995 | |
|
956 | 996 | ### revert for: content1_content1_content1-untracked |
|
957 | 997 | |
|
958 | 998 | ### revert for: content1_content1_content3-tracked |
|
959 | 999 | |
|
960 | 1000 | ### revert for: content1_content1_content3-untracked |
|
961 | 1001 | |
|
962 | 1002 | ### revert for: content1_content1_missing-tracked |
|
963 | 1003 | |
|
964 | 1004 | ### revert for: content1_content1_missing-untracked |
|
965 | 1005 | |
|
966 | 1006 | ### revert for: content1_content2_content1-tracked |
|
967 | 1007 | no changes needed to content1_content2_content1-tracked |
|
968 | 1008 | |
|
969 | 1009 | ### revert for: content1_content2_content1-untracked |
|
970 | 1010 | |
|
971 | 1011 | ### revert for: content1_content2_content2-tracked |
|
972 | 1012 | |
|
973 | 1013 | ### revert for: content1_content2_content2-untracked |
|
974 | 1014 | |
|
975 | 1015 | ### revert for: content1_content2_content3-tracked |
|
976 | 1016 | |
|
977 | 1017 | ### revert for: content1_content2_content3-untracked |
|
978 | 1018 | |
|
979 | 1019 | ### revert for: content1_content2_missing-tracked |
|
980 | 1020 | |
|
981 | 1021 | ### revert for: content1_content2_missing-untracked |
|
982 | 1022 | |
|
983 | 1023 | ### revert for: content1_missing_content1-tracked |
|
984 | 1024 | no changes needed to content1_missing_content1-tracked |
|
985 | 1025 | |
|
986 | 1026 | ### revert for: content1_missing_content1-untracked |
|
987 | 1027 | |
|
988 | 1028 | ### revert for: content1_missing_content3-tracked |
|
989 | 1029 | |
|
990 | 1030 | ### revert for: content1_missing_content3-untracked |
|
991 | 1031 | |
|
992 | 1032 | ### revert for: content1_missing_missing-tracked |
|
993 | 1033 | |
|
994 | 1034 | ### revert for: content1_missing_missing-untracked |
|
995 | 1035 | |
|
996 | 1036 | ### revert for: missing_content2_content2-tracked |
|
997 | 1037 | |
|
998 | 1038 | ### revert for: missing_content2_content2-untracked |
|
999 | 1039 | no changes needed to missing_content2_content2-untracked |
|
1000 | 1040 | |
|
1001 | 1041 | ### revert for: missing_content2_content3-tracked |
|
1002 | 1042 | |
|
1003 | 1043 | ### revert for: missing_content2_content3-untracked |
|
1004 | 1044 | no changes needed to missing_content2_content3-untracked |
|
1005 | 1045 | |
|
1006 | 1046 | ### revert for: missing_content2_missing-tracked |
|
1007 | 1047 | |
|
1008 | 1048 | ### revert for: missing_content2_missing-untracked |
|
1009 | 1049 | no changes needed to missing_content2_missing-untracked |
|
1010 | 1050 | |
|
1011 | 1051 | ### revert for: missing_missing_content3-tracked |
|
1012 | 1052 | |
|
1013 | 1053 | ### revert for: missing_missing_content3-untracked |
|
1014 | 1054 | file not managed: missing_missing_content3-untracked |
|
1015 | 1055 | |
|
1016 | 1056 | ### revert for: missing_missing_missing-tracked |
|
1017 | 1057 | |
|
1018 | 1058 | ### revert for: missing_missing_missing-untracked |
|
1019 | 1059 | missing_missing_missing-untracked: no such file in rev * (glob) |
|
1020 | 1060 | |
|
1021 | 1061 | |
|
1022 | 1062 | check resulting directory against the --all run |
|
1023 | 1063 | (There should be no difference) |
|
1024 | 1064 | |
|
1025 | 1065 | $ python ../dircontent.py > ../content-base-explicit.txt |
|
1026 | 1066 | $ cd .. |
|
1027 | 1067 | $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _ |
|
1028 | 1068 | [1] |
@@ -1,1739 +1,1757 b'' | |||
|
1 | 1 | Let commit recurse into subrepos by default to match pre-2.0 behavior: |
|
2 | 2 | |
|
3 | 3 | $ echo "[ui]" >> $HGRCPATH |
|
4 | 4 | $ echo "commitsubrepos = Yes" >> $HGRCPATH |
|
5 | 5 | |
|
6 | 6 | $ hg init t |
|
7 | 7 | $ cd t |
|
8 | 8 | |
|
9 | 9 | first revision, no sub |
|
10 | 10 | |
|
11 | 11 | $ echo a > a |
|
12 | 12 | $ hg ci -Am0 |
|
13 | 13 | adding a |
|
14 | 14 | |
|
15 | 15 | add first sub |
|
16 | 16 | |
|
17 | 17 | $ echo s = s > .hgsub |
|
18 | 18 | $ hg add .hgsub |
|
19 | 19 | $ hg init s |
|
20 | 20 | $ echo a > s/a |
|
21 | 21 | |
|
22 | 22 | Issue2232: committing a subrepo without .hgsub |
|
23 | 23 | |
|
24 | 24 | $ hg ci -mbad s |
|
25 | 25 | abort: can't commit subrepos without .hgsub |
|
26 | 26 | [255] |
|
27 | 27 | |
|
28 | 28 | $ hg -R s add s/a |
|
29 | 29 | $ hg files -S |
|
30 | 30 | .hgsub |
|
31 | 31 | a |
|
32 | 32 | s/a (glob) |
|
33 | 33 | |
|
34 | 34 | $ hg -R s ci -Ams0 |
|
35 | 35 | $ hg sum |
|
36 | 36 | parent: 0:f7b1eb17ad24 tip |
|
37 | 37 | 0 |
|
38 | 38 | branch: default |
|
39 | 39 | commit: 1 added, 1 subrepos |
|
40 | 40 | update: (current) |
|
41 | 41 | phases: 1 draft |
|
42 | 42 | $ hg ci -m1 |
|
43 | 43 | |
|
44 | 44 | test handling .hgsubstate "added" explicitly. |
|
45 | 45 | |
|
46 | 46 | $ hg parents --template '{node}\n{files}\n' |
|
47 | 47 | 7cf8cfea66e410e8e3336508dfeec07b3192de51 |
|
48 | 48 | .hgsub .hgsubstate |
|
49 | 49 | $ hg rollback -q |
|
50 | 50 | $ hg add .hgsubstate |
|
51 | 51 | $ hg ci -m1 |
|
52 | 52 | $ hg parents --template '{node}\n{files}\n' |
|
53 | 53 | 7cf8cfea66e410e8e3336508dfeec07b3192de51 |
|
54 | 54 | .hgsub .hgsubstate |
|
55 | 55 | |
|
56 | 56 | Revert subrepo and test subrepo fileset keyword: |
|
57 | 57 | |
|
58 | 58 | $ echo b > s/a |
|
59 | 59 | $ hg revert --dry-run "set:subrepo('glob:s*')" |
|
60 | 60 | reverting subrepo s |
|
61 | 61 | reverting s/a (glob) |
|
62 | 62 | $ cat s/a |
|
63 | 63 | b |
|
64 | 64 | $ hg revert "set:subrepo('glob:s*')" |
|
65 | 65 | reverting subrepo s |
|
66 | 66 | reverting s/a (glob) |
|
67 | 67 | $ cat s/a |
|
68 | 68 | a |
|
69 | 69 | $ rm s/a.orig |
|
70 | 70 | |
|
71 | 71 | Revert subrepo with no backup. The "reverting s/a" line is gone since |
|
72 | 72 | we're really running 'hg update' in the subrepo: |
|
73 | 73 | |
|
74 | 74 | $ echo b > s/a |
|
75 | 75 | $ hg revert --no-backup s |
|
76 | 76 | reverting subrepo s |
|
77 | 77 | |
|
78 | 78 | Issue2022: update -C |
|
79 | 79 | |
|
80 | 80 | $ echo b > s/a |
|
81 | 81 | $ hg sum |
|
82 | 82 | parent: 1:7cf8cfea66e4 tip |
|
83 | 83 | 1 |
|
84 | 84 | branch: default |
|
85 | 85 | commit: 1 subrepos |
|
86 | 86 | update: (current) |
|
87 | 87 | phases: 2 draft |
|
88 | 88 | $ hg co -C 1 |
|
89 | 89 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
90 | 90 | $ hg sum |
|
91 | 91 | parent: 1:7cf8cfea66e4 tip |
|
92 | 92 | 1 |
|
93 | 93 | branch: default |
|
94 | 94 | commit: (clean) |
|
95 | 95 | update: (current) |
|
96 | 96 | phases: 2 draft |
|
97 | 97 | |
|
98 | 98 | commands that require a clean repo should respect subrepos |
|
99 | 99 | |
|
100 | 100 | $ echo b >> s/a |
|
101 | 101 | $ hg backout tip |
|
102 | 102 | abort: uncommitted changes in subrepository 's' |
|
103 | 103 | [255] |
|
104 | 104 | $ hg revert -C -R s s/a |
|
105 | 105 | |
|
106 | 106 | add sub sub |
|
107 | 107 | |
|
108 | 108 | $ echo ss = ss > s/.hgsub |
|
109 | 109 | $ hg init s/ss |
|
110 | 110 | $ echo a > s/ss/a |
|
111 | 111 | $ hg -R s add s/.hgsub |
|
112 | 112 | $ hg -R s/ss add s/ss/a |
|
113 | 113 | $ hg sum |
|
114 | 114 | parent: 1:7cf8cfea66e4 tip |
|
115 | 115 | 1 |
|
116 | 116 | branch: default |
|
117 | 117 | commit: 1 subrepos |
|
118 | 118 | update: (current) |
|
119 | 119 | phases: 2 draft |
|
120 | 120 | $ hg ci -m2 |
|
121 | 121 | committing subrepository s |
|
122 | 122 | committing subrepository s/ss (glob) |
|
123 | 123 | $ hg sum |
|
124 | 124 | parent: 2:df30734270ae tip |
|
125 | 125 | 2 |
|
126 | 126 | branch: default |
|
127 | 127 | commit: (clean) |
|
128 | 128 | update: (current) |
|
129 | 129 | phases: 3 draft |
|
130 | 130 | |
|
131 | 131 | test handling .hgsubstate "modified" explicitly. |
|
132 | 132 | |
|
133 | 133 | $ hg parents --template '{node}\n{files}\n' |
|
134 | 134 | df30734270ae757feb35e643b7018e818e78a9aa |
|
135 | 135 | .hgsubstate |
|
136 | 136 | $ hg rollback -q |
|
137 | 137 | $ hg status -A .hgsubstate |
|
138 | 138 | M .hgsubstate |
|
139 | 139 | $ hg ci -m2 |
|
140 | 140 | $ hg parents --template '{node}\n{files}\n' |
|
141 | 141 | df30734270ae757feb35e643b7018e818e78a9aa |
|
142 | 142 | .hgsubstate |
|
143 | 143 | |
|
144 | 144 | bump sub rev (and check it is ignored by ui.commitsubrepos) |
|
145 | 145 | |
|
146 | 146 | $ echo b > s/a |
|
147 | 147 | $ hg -R s ci -ms1 |
|
148 | 148 | $ hg --config ui.commitsubrepos=no ci -m3 |
|
149 | 149 | |
|
150 | 150 | leave sub dirty (and check ui.commitsubrepos=no aborts the commit) |
|
151 | 151 | |
|
152 | 152 | $ echo c > s/a |
|
153 | 153 | $ hg --config ui.commitsubrepos=no ci -m4 |
|
154 | 154 | abort: uncommitted changes in subrepository 's' |
|
155 | 155 | (use --subrepos for recursive commit) |
|
156 | 156 | [255] |
|
157 | 157 | $ hg id |
|
158 | 158 | f6affe3fbfaa+ tip |
|
159 | 159 | $ hg -R s ci -mc |
|
160 | 160 | $ hg id |
|
161 | 161 | f6affe3fbfaa+ tip |
|
162 | 162 | $ echo d > s/a |
|
163 | 163 | $ hg ci -m4 |
|
164 | 164 | committing subrepository s |
|
165 | 165 | $ hg tip -R s |
|
166 | 166 | changeset: 4:02dcf1d70411 |
|
167 | 167 | tag: tip |
|
168 | 168 | user: test |
|
169 | 169 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
170 | 170 | summary: 4 |
|
171 | 171 | |
|
172 | 172 | |
|
173 | 173 | check caching |
|
174 | 174 | |
|
175 | 175 | $ hg co 0 |
|
176 | 176 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
177 | 177 | $ hg debugsub |
|
178 | 178 | |
|
179 | 179 | restore |
|
180 | 180 | |
|
181 | 181 | $ hg co |
|
182 | 182 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
183 | 183 | $ hg debugsub |
|
184 | 184 | path s |
|
185 | 185 | source s |
|
186 | 186 | revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef |
|
187 | 187 | |
|
188 | 188 | new branch for merge tests |
|
189 | 189 | |
|
190 | 190 | $ hg co 1 |
|
191 | 191 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
192 | 192 | $ echo t = t >> .hgsub |
|
193 | 193 | $ hg init t |
|
194 | 194 | $ echo t > t/t |
|
195 | 195 | $ hg -R t add t |
|
196 | 196 | adding t/t (glob) |
|
197 | 197 | |
|
198 | 198 | 5 |
|
199 | 199 | |
|
200 | 200 | $ hg ci -m5 # add sub |
|
201 | 201 | committing subrepository t |
|
202 | 202 | created new head |
|
203 | 203 | $ echo t2 > t/t |
|
204 | 204 | |
|
205 | 205 | 6 |
|
206 | 206 | |
|
207 | 207 | $ hg st -R s |
|
208 | 208 | $ hg ci -m6 # change sub |
|
209 | 209 | committing subrepository t |
|
210 | 210 | $ hg debugsub |
|
211 | 211 | path s |
|
212 | 212 | source s |
|
213 | 213 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
214 | 214 | path t |
|
215 | 215 | source t |
|
216 | 216 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
217 | 217 | $ echo t3 > t/t |
|
218 | 218 | |
|
219 | 219 | 7 |
|
220 | 220 | |
|
221 | 221 | $ hg ci -m7 # change sub again for conflict test |
|
222 | 222 | committing subrepository t |
|
223 | 223 | $ hg rm .hgsub |
|
224 | 224 | |
|
225 | 225 | 8 |
|
226 | 226 | |
|
227 | 227 | $ hg ci -m8 # remove sub |
|
228 | 228 | |
|
229 | 229 | test handling .hgsubstate "removed" explicitly. |
|
230 | 230 | |
|
231 | 231 | $ hg parents --template '{node}\n{files}\n' |
|
232 | 232 | 96615c1dad2dc8e3796d7332c77ce69156f7b78e |
|
233 | 233 | .hgsub .hgsubstate |
|
234 | 234 | $ hg rollback -q |
|
235 | 235 | $ hg remove .hgsubstate |
|
236 | 236 | $ hg ci -m8 |
|
237 | 237 | $ hg parents --template '{node}\n{files}\n' |
|
238 | 238 | 96615c1dad2dc8e3796d7332c77ce69156f7b78e |
|
239 | 239 | .hgsub .hgsubstate |
|
240 | 240 | |
|
241 | 241 | merge tests |
|
242 | 242 | |
|
243 | 243 | $ hg co -C 3 |
|
244 | 244 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
245 | 245 | $ hg merge 5 # test adding |
|
246 | 246 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
247 | 247 | (branch merge, don't forget to commit) |
|
248 | 248 | $ hg debugsub |
|
249 | 249 | path s |
|
250 | 250 | source s |
|
251 | 251 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
252 | 252 | path t |
|
253 | 253 | source t |
|
254 | 254 | revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382 |
|
255 | 255 | $ hg ci -m9 |
|
256 | 256 | created new head |
|
257 | 257 | $ hg merge 6 --debug # test change |
|
258 | 258 | searching for copies back to rev 2 |
|
259 | 259 | resolving manifests |
|
260 | 260 | branchmerge: True, force: False, partial: False |
|
261 | 261 | ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4 |
|
262 | 262 | .hgsubstate: versions differ -> m |
|
263 | 263 | subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec |
|
264 | 264 | subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg |
|
265 | 265 | getting subrepo t |
|
266 | 266 | resolving manifests |
|
267 | 267 | branchmerge: False, force: False, partial: False |
|
268 | 268 | ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a |
|
269 | 269 | t: remote is newer -> g |
|
270 | 270 | getting t |
|
271 | 271 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
272 | 272 | (branch merge, don't forget to commit) |
|
273 | 273 | $ hg debugsub |
|
274 | 274 | path s |
|
275 | 275 | source s |
|
276 | 276 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
277 | 277 | path t |
|
278 | 278 | source t |
|
279 | 279 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
280 | 280 | $ echo conflict > t/t |
|
281 | 281 | $ hg ci -m10 |
|
282 | 282 | committing subrepository t |
|
283 | 283 | $ HGMERGE=internal:merge hg merge --debug 7 # test conflict |
|
284 | 284 | searching for copies back to rev 2 |
|
285 | 285 | resolving manifests |
|
286 | 286 | branchmerge: True, force: False, partial: False |
|
287 | 287 | ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf |
|
288 | 288 | .hgsubstate: versions differ -> m |
|
289 | 289 | subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4 |
|
290 | 290 | subrepo t: both sides changed |
|
291 | 291 | subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198) |
|
292 | 292 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
293 | 293 | merging subrepo t |
|
294 | 294 | searching for copies back to rev 2 |
|
295 | 295 | resolving manifests |
|
296 | 296 | branchmerge: True, force: False, partial: False |
|
297 | 297 | ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198 |
|
298 | 298 | preserving t for resolve of t |
|
299 | 299 | t: versions differ -> m |
|
300 | 300 | picked tool 'internal:merge' for t (binary False symlink False) |
|
301 | 301 | merging t |
|
302 | 302 | my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a |
|
303 | 303 | warning: conflicts during merge. |
|
304 | 304 | merging t incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
305 | 305 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
306 | 306 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
307 | 307 | subrepo t: merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg |
|
308 | 308 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
309 | 309 | (branch merge, don't forget to commit) |
|
310 | 310 | |
|
311 | 311 | should conflict |
|
312 | 312 | |
|
313 | 313 | $ cat t/t |
|
314 | 314 | <<<<<<< local: 20a0db6fbf6c - test: 10 |
|
315 | 315 | conflict |
|
316 | 316 | ======= |
|
317 | 317 | t3 |
|
318 | 318 | >>>>>>> other: 7af322bc1198 - test: 7 |
|
319 | 319 | |
|
320 | 320 | 11: remove subrepo t |
|
321 | 321 | |
|
322 | 322 | $ hg co -C 5 |
|
323 | 323 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
324 | 324 | $ hg revert -r 4 .hgsub # remove t |
|
325 | 325 | $ hg ci -m11 |
|
326 | 326 | created new head |
|
327 | 327 | $ hg debugsub |
|
328 | 328 | path s |
|
329 | 329 | source s |
|
330 | 330 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
331 | 331 | |
|
332 | 332 | local removed, remote changed, keep changed |
|
333 | 333 | |
|
334 | 334 | $ hg merge 6 |
|
335 | 335 | remote changed subrepository t which local removed |
|
336 | 336 | use (c)hanged version or (d)elete? c |
|
337 | 337 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
338 | 338 | (branch merge, don't forget to commit) |
|
339 | 339 | BROKEN: should include subrepo t |
|
340 | 340 | $ hg debugsub |
|
341 | 341 | path s |
|
342 | 342 | source s |
|
343 | 343 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
344 | 344 | $ cat .hgsubstate |
|
345 | 345 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
346 | 346 | 6747d179aa9a688023c4b0cad32e4c92bb7f34ad t |
|
347 | 347 | $ hg ci -m 'local removed, remote changed, keep changed' |
|
348 | 348 | BROKEN: should include subrepo t |
|
349 | 349 | $ hg debugsub |
|
350 | 350 | path s |
|
351 | 351 | source s |
|
352 | 352 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
353 | 353 | BROKEN: should include subrepo t |
|
354 | 354 | $ cat .hgsubstate |
|
355 | 355 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
356 | 356 | $ cat t/t |
|
357 | 357 | t2 |
|
358 | 358 | |
|
359 | 359 | local removed, remote changed, keep removed |
|
360 | 360 | |
|
361 | 361 | $ hg co -C 11 |
|
362 | 362 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
363 | 363 | $ hg merge --config ui.interactive=true 6 <<EOF |
|
364 | 364 | > d |
|
365 | 365 | > EOF |
|
366 | 366 | remote changed subrepository t which local removed |
|
367 | 367 | use (c)hanged version or (d)elete? d |
|
368 | 368 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
369 | 369 | (branch merge, don't forget to commit) |
|
370 | 370 | $ hg debugsub |
|
371 | 371 | path s |
|
372 | 372 | source s |
|
373 | 373 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
374 | 374 | $ cat .hgsubstate |
|
375 | 375 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
376 | 376 | $ hg ci -m 'local removed, remote changed, keep removed' |
|
377 | 377 | created new head |
|
378 | 378 | $ hg debugsub |
|
379 | 379 | path s |
|
380 | 380 | source s |
|
381 | 381 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
382 | 382 | $ cat .hgsubstate |
|
383 | 383 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
384 | 384 | |
|
385 | 385 | local changed, remote removed, keep changed |
|
386 | 386 | |
|
387 | 387 | $ hg co -C 6 |
|
388 | 388 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
389 | 389 | $ hg merge 11 |
|
390 | 390 | local changed subrepository t which remote removed |
|
391 | 391 | use (c)hanged version or (d)elete? c |
|
392 | 392 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
393 | 393 | (branch merge, don't forget to commit) |
|
394 | 394 | BROKEN: should include subrepo t |
|
395 | 395 | $ hg debugsub |
|
396 | 396 | path s |
|
397 | 397 | source s |
|
398 | 398 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
399 | 399 | BROKEN: should include subrepo t |
|
400 | 400 | $ cat .hgsubstate |
|
401 | 401 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
402 | 402 | $ hg ci -m 'local changed, remote removed, keep changed' |
|
403 | 403 | created new head |
|
404 | 404 | BROKEN: should include subrepo t |
|
405 | 405 | $ hg debugsub |
|
406 | 406 | path s |
|
407 | 407 | source s |
|
408 | 408 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
409 | 409 | BROKEN: should include subrepo t |
|
410 | 410 | $ cat .hgsubstate |
|
411 | 411 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
412 | 412 | $ cat t/t |
|
413 | 413 | t2 |
|
414 | 414 | |
|
415 | 415 | local changed, remote removed, keep removed |
|
416 | 416 | |
|
417 | 417 | $ hg co -C 6 |
|
418 | 418 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
419 | 419 | $ hg merge --config ui.interactive=true 11 <<EOF |
|
420 | 420 | > d |
|
421 | 421 | > EOF |
|
422 | 422 | local changed subrepository t which remote removed |
|
423 | 423 | use (c)hanged version or (d)elete? d |
|
424 | 424 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
425 | 425 | (branch merge, don't forget to commit) |
|
426 | 426 | $ hg debugsub |
|
427 | 427 | path s |
|
428 | 428 | source s |
|
429 | 429 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
430 | 430 | $ cat .hgsubstate |
|
431 | 431 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
432 | 432 | $ hg ci -m 'local changed, remote removed, keep removed' |
|
433 | 433 | created new head |
|
434 | 434 | $ hg debugsub |
|
435 | 435 | path s |
|
436 | 436 | source s |
|
437 | 437 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
438 | 438 | $ cat .hgsubstate |
|
439 | 439 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
440 | 440 | |
|
441 | 441 | clean up to avoid having to fix up the tests below |
|
442 | 442 | |
|
443 | 443 | $ hg co -C 10 |
|
444 | 444 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
445 | 445 | $ cat >> $HGRCPATH <<EOF |
|
446 | 446 | > [extensions] |
|
447 | 447 | > strip= |
|
448 | 448 | > EOF |
|
449 | 449 | $ hg strip -r 11:15 |
|
450 | 450 | saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob) |
|
451 | 451 | |
|
452 | 452 | clone |
|
453 | 453 | |
|
454 | 454 | $ cd .. |
|
455 | 455 | $ hg clone t tc |
|
456 | 456 | updating to branch default |
|
457 | 457 | cloning subrepo s from $TESTTMP/t/s |
|
458 | 458 | cloning subrepo s/ss from $TESTTMP/t/s/ss (glob) |
|
459 | 459 | cloning subrepo t from $TESTTMP/t/t |
|
460 | 460 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
461 | 461 | $ cd tc |
|
462 | 462 | $ hg debugsub |
|
463 | 463 | path s |
|
464 | 464 | source s |
|
465 | 465 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
466 | 466 | path t |
|
467 | 467 | source t |
|
468 | 468 | revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e |
|
469 | 469 | |
|
470 | 470 | push |
|
471 | 471 | |
|
472 | 472 | $ echo bah > t/t |
|
473 | 473 | $ hg ci -m11 |
|
474 | 474 | committing subrepository t |
|
475 | 475 | $ hg push |
|
476 | 476 | pushing to $TESTTMP/t (glob) |
|
477 | 477 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
478 | 478 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
479 | 479 | pushing subrepo t to $TESTTMP/t/t |
|
480 | 480 | searching for changes |
|
481 | 481 | adding changesets |
|
482 | 482 | adding manifests |
|
483 | 483 | adding file changes |
|
484 | 484 | added 1 changesets with 1 changes to 1 files |
|
485 | 485 | searching for changes |
|
486 | 486 | adding changesets |
|
487 | 487 | adding manifests |
|
488 | 488 | adding file changes |
|
489 | 489 | added 1 changesets with 1 changes to 1 files |
|
490 | 490 | |
|
491 | 491 | push -f |
|
492 | 492 | |
|
493 | 493 | $ echo bah > s/a |
|
494 | 494 | $ hg ci -m12 |
|
495 | 495 | committing subrepository s |
|
496 | 496 | $ hg push |
|
497 | 497 | pushing to $TESTTMP/t (glob) |
|
498 | 498 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
499 | 499 | pushing subrepo s to $TESTTMP/t/s |
|
500 | 500 | searching for changes |
|
501 | 501 | abort: push creates new remote head 12a213df6fa9! (in subrepo s) |
|
502 | 502 | (merge or see "hg help push" for details about pushing new heads) |
|
503 | 503 | [255] |
|
504 | 504 | $ hg push -f |
|
505 | 505 | pushing to $TESTTMP/t (glob) |
|
506 | 506 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
507 | 507 | searching for changes |
|
508 | 508 | no changes found |
|
509 | 509 | pushing subrepo s to $TESTTMP/t/s |
|
510 | 510 | searching for changes |
|
511 | 511 | adding changesets |
|
512 | 512 | adding manifests |
|
513 | 513 | adding file changes |
|
514 | 514 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
515 | 515 | pushing subrepo t to $TESTTMP/t/t |
|
516 | 516 | searching for changes |
|
517 | 517 | no changes found |
|
518 | 518 | searching for changes |
|
519 | 519 | adding changesets |
|
520 | 520 | adding manifests |
|
521 | 521 | adding file changes |
|
522 | 522 | added 1 changesets with 1 changes to 1 files |
|
523 | 523 | |
|
524 | 524 | check that unmodified subrepos are not pushed |
|
525 | 525 | |
|
526 | 526 | $ hg clone . ../tcc |
|
527 | 527 | updating to branch default |
|
528 | 528 | cloning subrepo s from $TESTTMP/tc/s |
|
529 | 529 | cloning subrepo s/ss from $TESTTMP/tc/s/ss (glob) |
|
530 | 530 | cloning subrepo t from $TESTTMP/tc/t |
|
531 | 531 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
532 | 532 | |
|
533 | 533 | the subrepos on the new clone have nothing to push to its source |
|
534 | 534 | |
|
535 | 535 | $ hg push -R ../tcc . |
|
536 | 536 | pushing to . |
|
537 | 537 | no changes made to subrepo s/ss since last push to s/ss (glob) |
|
538 | 538 | no changes made to subrepo s since last push to s |
|
539 | 539 | no changes made to subrepo t since last push to t |
|
540 | 540 | searching for changes |
|
541 | 541 | no changes found |
|
542 | 542 | [1] |
|
543 | 543 | |
|
544 | 544 | the subrepos on the source do not have a clean store versus the clone target |
|
545 | 545 | because they were never explicitly pushed to the source |
|
546 | 546 | |
|
547 | 547 | $ hg push ../tcc |
|
548 | 548 | pushing to ../tcc |
|
549 | 549 | pushing subrepo s/ss to ../tcc/s/ss (glob) |
|
550 | 550 | searching for changes |
|
551 | 551 | no changes found |
|
552 | 552 | pushing subrepo s to ../tcc/s |
|
553 | 553 | searching for changes |
|
554 | 554 | no changes found |
|
555 | 555 | pushing subrepo t to ../tcc/t |
|
556 | 556 | searching for changes |
|
557 | 557 | no changes found |
|
558 | 558 | searching for changes |
|
559 | 559 | no changes found |
|
560 | 560 | [1] |
|
561 | 561 | |
|
562 | 562 | after push their stores become clean |
|
563 | 563 | |
|
564 | 564 | $ hg push ../tcc |
|
565 | 565 | pushing to ../tcc |
|
566 | 566 | no changes made to subrepo s/ss since last push to ../tcc/s/ss (glob) |
|
567 | 567 | no changes made to subrepo s since last push to ../tcc/s |
|
568 | 568 | no changes made to subrepo t since last push to ../tcc/t |
|
569 | 569 | searching for changes |
|
570 | 570 | no changes found |
|
571 | 571 | [1] |
|
572 | 572 | |
|
573 | 573 | updating a subrepo to a different revision or changing |
|
574 | 574 | its working directory does not make its store dirty |
|
575 | 575 | |
|
576 | 576 | $ hg -R s update '.^' |
|
577 | 577 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
578 | 578 | $ hg push |
|
579 | 579 | pushing to $TESTTMP/t (glob) |
|
580 | 580 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
581 | 581 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
582 | 582 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
583 | 583 | searching for changes |
|
584 | 584 | no changes found |
|
585 | 585 | [1] |
|
586 | 586 | $ echo foo >> s/a |
|
587 | 587 | $ hg push |
|
588 | 588 | pushing to $TESTTMP/t (glob) |
|
589 | 589 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
590 | 590 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
591 | 591 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
592 | 592 | searching for changes |
|
593 | 593 | no changes found |
|
594 | 594 | [1] |
|
595 | 595 | $ hg -R s update -C tip |
|
596 | 596 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
597 | 597 | |
|
598 | 598 | committing into a subrepo makes its store (but not its parent's store) dirty |
|
599 | 599 | |
|
600 | 600 | $ echo foo >> s/ss/a |
|
601 | 601 | $ hg -R s/ss commit -m 'test dirty store detection' |
|
602 | 602 | |
|
603 | 603 | $ hg out -S -r `hg log -r tip -T "{node|short}"` |
|
604 | 604 | comparing with $TESTTMP/t (glob) |
|
605 | 605 | searching for changes |
|
606 | 606 | no changes found |
|
607 | 607 | comparing with $TESTTMP/t/s |
|
608 | 608 | searching for changes |
|
609 | 609 | no changes found |
|
610 | 610 | comparing with $TESTTMP/t/s/ss |
|
611 | 611 | searching for changes |
|
612 | 612 | changeset: 1:79ea5566a333 |
|
613 | 613 | tag: tip |
|
614 | 614 | user: test |
|
615 | 615 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
616 | 616 | summary: test dirty store detection |
|
617 | 617 | |
|
618 | 618 | comparing with $TESTTMP/t/t |
|
619 | 619 | searching for changes |
|
620 | 620 | no changes found |
|
621 | 621 | |
|
622 | 622 | $ hg push |
|
623 | 623 | pushing to $TESTTMP/t (glob) |
|
624 | 624 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
625 | 625 | searching for changes |
|
626 | 626 | adding changesets |
|
627 | 627 | adding manifests |
|
628 | 628 | adding file changes |
|
629 | 629 | added 1 changesets with 1 changes to 1 files |
|
630 | 630 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
631 | 631 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
632 | 632 | searching for changes |
|
633 | 633 | no changes found |
|
634 | 634 | [1] |
|
635 | 635 | |
|
636 | 636 | a subrepo store may be clean versus one repo but not versus another |
|
637 | 637 | |
|
638 | 638 | $ hg push |
|
639 | 639 | pushing to $TESTTMP/t (glob) |
|
640 | 640 | no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob) |
|
641 | 641 | no changes made to subrepo s since last push to $TESTTMP/t/s |
|
642 | 642 | no changes made to subrepo t since last push to $TESTTMP/t/t |
|
643 | 643 | searching for changes |
|
644 | 644 | no changes found |
|
645 | 645 | [1] |
|
646 | 646 | $ hg push ../tcc |
|
647 | 647 | pushing to ../tcc |
|
648 | 648 | pushing subrepo s/ss to ../tcc/s/ss (glob) |
|
649 | 649 | searching for changes |
|
650 | 650 | adding changesets |
|
651 | 651 | adding manifests |
|
652 | 652 | adding file changes |
|
653 | 653 | added 1 changesets with 1 changes to 1 files |
|
654 | 654 | no changes made to subrepo s since last push to ../tcc/s |
|
655 | 655 | no changes made to subrepo t since last push to ../tcc/t |
|
656 | 656 | searching for changes |
|
657 | 657 | no changes found |
|
658 | 658 | [1] |
|
659 | 659 | |
|
660 | 660 | update |
|
661 | 661 | |
|
662 | 662 | $ cd ../t |
|
663 | 663 | $ hg up -C # discard our earlier merge |
|
664 | 664 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
665 | 665 | $ echo blah > t/t |
|
666 | 666 | $ hg ci -m13 |
|
667 | 667 | committing subrepository t |
|
668 | 668 | |
|
669 | 669 | backout calls revert internally with minimal opts, which should not raise |
|
670 | 670 | KeyError |
|
671 | 671 | |
|
672 | 672 | $ hg backout ".^" |
|
673 | 673 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
674 | 674 | changeset c373c8102e68 backed out, don't forget to commit. |
|
675 | 675 | |
|
676 | 676 | $ hg up -C # discard changes |
|
677 | 677 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
678 | 678 | |
|
679 | 679 | pull |
|
680 | 680 | |
|
681 | 681 | $ cd ../tc |
|
682 | 682 | $ hg pull |
|
683 | 683 | pulling from $TESTTMP/t (glob) |
|
684 | 684 | searching for changes |
|
685 | 685 | adding changesets |
|
686 | 686 | adding manifests |
|
687 | 687 | adding file changes |
|
688 | 688 | added 1 changesets with 1 changes to 1 files |
|
689 | 689 | (run 'hg update' to get a working copy) |
|
690 | 690 | |
|
691 | 691 | should pull t |
|
692 | 692 | |
|
693 | 693 | $ hg incoming -S -r `hg log -r tip -T "{node|short}"` |
|
694 | 694 | comparing with $TESTTMP/t (glob) |
|
695 | 695 | no changes found |
|
696 | 696 | comparing with $TESTTMP/t/s |
|
697 | 697 | searching for changes |
|
698 | 698 | no changes found |
|
699 | 699 | comparing with $TESTTMP/t/s/ss |
|
700 | 700 | searching for changes |
|
701 | 701 | no changes found |
|
702 | 702 | comparing with $TESTTMP/t/t |
|
703 | 703 | searching for changes |
|
704 | 704 | changeset: 5:52c0adc0515a |
|
705 | 705 | tag: tip |
|
706 | 706 | user: test |
|
707 | 707 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
708 | 708 | summary: 13 |
|
709 | 709 | |
|
710 | 710 | |
|
711 | 711 | $ hg up |
|
712 | 712 | pulling subrepo t from $TESTTMP/t/t |
|
713 | 713 | searching for changes |
|
714 | 714 | adding changesets |
|
715 | 715 | adding manifests |
|
716 | 716 | adding file changes |
|
717 | 717 | added 1 changesets with 1 changes to 1 files |
|
718 | 718 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
719 | 719 | $ cat t/t |
|
720 | 720 | blah |
|
721 | 721 | |
|
722 | 722 | bogus subrepo path aborts |
|
723 | 723 | |
|
724 | 724 | $ echo 'bogus=[boguspath' >> .hgsub |
|
725 | 725 | $ hg ci -m 'bogus subrepo path' |
|
726 | 726 | abort: missing ] in subrepo source |
|
727 | 727 | [255] |
|
728 | 728 | |
|
729 | 729 | Issue1986: merge aborts when trying to merge a subrepo that |
|
730 | 730 | shouldn't need merging |
|
731 | 731 | |
|
732 | 732 | # subrepo layout |
|
733 | 733 | # |
|
734 | 734 | # o 5 br |
|
735 | 735 | # /| |
|
736 | 736 | # o | 4 default |
|
737 | 737 | # | | |
|
738 | 738 | # | o 3 br |
|
739 | 739 | # |/| |
|
740 | 740 | # o | 2 default |
|
741 | 741 | # | | |
|
742 | 742 | # | o 1 br |
|
743 | 743 | # |/ |
|
744 | 744 | # o 0 default |
|
745 | 745 | |
|
746 | 746 | $ cd .. |
|
747 | 747 | $ rm -rf sub |
|
748 | 748 | $ hg init main |
|
749 | 749 | $ cd main |
|
750 | 750 | $ hg init s |
|
751 | 751 | $ cd s |
|
752 | 752 | $ echo a > a |
|
753 | 753 | $ hg ci -Am1 |
|
754 | 754 | adding a |
|
755 | 755 | $ hg branch br |
|
756 | 756 | marked working directory as branch br |
|
757 | 757 | (branches are permanent and global, did you want a bookmark?) |
|
758 | 758 | $ echo a >> a |
|
759 | 759 | $ hg ci -m1 |
|
760 | 760 | $ hg up default |
|
761 | 761 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
762 | 762 | $ echo b > b |
|
763 | 763 | $ hg ci -Am1 |
|
764 | 764 | adding b |
|
765 | 765 | $ hg up br |
|
766 | 766 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
767 | 767 | $ hg merge tip |
|
768 | 768 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
769 | 769 | (branch merge, don't forget to commit) |
|
770 | 770 | $ hg ci -m1 |
|
771 | 771 | $ hg up 2 |
|
772 | 772 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
773 | 773 | $ echo c > c |
|
774 | 774 | $ hg ci -Am1 |
|
775 | 775 | adding c |
|
776 | 776 | $ hg up 3 |
|
777 | 777 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
778 | 778 | $ hg merge 4 |
|
779 | 779 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
780 | 780 | (branch merge, don't forget to commit) |
|
781 | 781 | $ hg ci -m1 |
|
782 | 782 | |
|
783 | 783 | # main repo layout: |
|
784 | 784 | # |
|
785 | 785 | # * <-- try to merge default into br again |
|
786 | 786 | # .`| |
|
787 | 787 | # . o 5 br --> substate = 5 |
|
788 | 788 | # . | |
|
789 | 789 | # o | 4 default --> substate = 4 |
|
790 | 790 | # | | |
|
791 | 791 | # | o 3 br --> substate = 2 |
|
792 | 792 | # |/| |
|
793 | 793 | # o | 2 default --> substate = 2 |
|
794 | 794 | # | | |
|
795 | 795 | # | o 1 br --> substate = 3 |
|
796 | 796 | # |/ |
|
797 | 797 | # o 0 default --> substate = 2 |
|
798 | 798 | |
|
799 | 799 | $ cd .. |
|
800 | 800 | $ echo 's = s' > .hgsub |
|
801 | 801 | $ hg -R s up 2 |
|
802 | 802 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
803 | 803 | $ hg ci -Am1 |
|
804 | 804 | adding .hgsub |
|
805 | 805 | $ hg branch br |
|
806 | 806 | marked working directory as branch br |
|
807 | 807 | (branches are permanent and global, did you want a bookmark?) |
|
808 | 808 | $ echo b > b |
|
809 | 809 | $ hg -R s up 3 |
|
810 | 810 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
811 | 811 | $ hg ci -Am1 |
|
812 | 812 | adding b |
|
813 | 813 | $ hg up default |
|
814 | 814 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
815 | 815 | $ echo c > c |
|
816 | 816 | $ hg ci -Am1 |
|
817 | 817 | adding c |
|
818 | 818 | $ hg up 1 |
|
819 | 819 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
820 | 820 | $ hg merge 2 |
|
821 | 821 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
822 | 822 | (branch merge, don't forget to commit) |
|
823 | 823 | $ hg ci -m1 |
|
824 | 824 | $ hg up 2 |
|
825 | 825 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
826 | 826 | $ hg -R s up 4 |
|
827 | 827 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
828 | 828 | $ echo d > d |
|
829 | 829 | $ hg ci -Am1 |
|
830 | 830 | adding d |
|
831 | 831 | $ hg up 3 |
|
832 | 832 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
833 | 833 | $ hg -R s up 5 |
|
834 | 834 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
835 | 835 | $ echo e > e |
|
836 | 836 | $ hg ci -Am1 |
|
837 | 837 | adding e |
|
838 | 838 | |
|
839 | 839 | $ hg up 5 |
|
840 | 840 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
841 | 841 | $ hg merge 4 # try to merge default into br again |
|
842 | 842 | subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88) |
|
843 | 843 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
844 | 844 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
845 | 845 | (branch merge, don't forget to commit) |
|
846 | 846 | $ cd .. |
|
847 | 847 | |
|
848 | 848 | test subrepo delete from .hgsubstate |
|
849 | 849 | |
|
850 | 850 | $ hg init testdelete |
|
851 | 851 | $ mkdir testdelete/nested testdelete/nested2 |
|
852 | 852 | $ hg init testdelete/nested |
|
853 | 853 | $ hg init testdelete/nested2 |
|
854 | 854 | $ echo test > testdelete/nested/foo |
|
855 | 855 | $ echo test > testdelete/nested2/foo |
|
856 | 856 | $ hg -R testdelete/nested add |
|
857 | 857 | adding testdelete/nested/foo (glob) |
|
858 | 858 | $ hg -R testdelete/nested2 add |
|
859 | 859 | adding testdelete/nested2/foo (glob) |
|
860 | 860 | $ hg -R testdelete/nested ci -m test |
|
861 | 861 | $ hg -R testdelete/nested2 ci -m test |
|
862 | 862 | $ echo nested = nested > testdelete/.hgsub |
|
863 | 863 | $ echo nested2 = nested2 >> testdelete/.hgsub |
|
864 | 864 | $ hg -R testdelete add |
|
865 | 865 | adding testdelete/.hgsub (glob) |
|
866 | 866 | $ hg -R testdelete ci -m "nested 1 & 2 added" |
|
867 | 867 | $ echo nested = nested > testdelete/.hgsub |
|
868 | 868 | $ hg -R testdelete ci -m "nested 2 deleted" |
|
869 | 869 | $ cat testdelete/.hgsubstate |
|
870 | 870 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested |
|
871 | 871 | $ hg -R testdelete remove testdelete/.hgsub |
|
872 | 872 | $ hg -R testdelete ci -m ".hgsub deleted" |
|
873 | 873 | $ cat testdelete/.hgsubstate |
|
874 | 874 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested |
|
875 | 875 | |
|
876 | 876 | test repository cloning |
|
877 | 877 | |
|
878 | 878 | $ mkdir mercurial mercurial2 |
|
879 | 879 | $ hg init nested_absolute |
|
880 | 880 | $ echo test > nested_absolute/foo |
|
881 | 881 | $ hg -R nested_absolute add |
|
882 | 882 | adding nested_absolute/foo (glob) |
|
883 | 883 | $ hg -R nested_absolute ci -mtest |
|
884 | 884 | $ cd mercurial |
|
885 | 885 | $ hg init nested_relative |
|
886 | 886 | $ echo test2 > nested_relative/foo2 |
|
887 | 887 | $ hg -R nested_relative add |
|
888 | 888 | adding nested_relative/foo2 (glob) |
|
889 | 889 | $ hg -R nested_relative ci -mtest2 |
|
890 | 890 | $ hg init main |
|
891 | 891 | $ echo "nested_relative = ../nested_relative" > main/.hgsub |
|
892 | 892 | $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub |
|
893 | 893 | $ hg -R main add |
|
894 | 894 | adding main/.hgsub (glob) |
|
895 | 895 | $ hg -R main ci -m "add subrepos" |
|
896 | 896 | $ cd .. |
|
897 | 897 | $ hg clone mercurial/main mercurial2/main |
|
898 | 898 | updating to branch default |
|
899 | 899 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
900 | 900 | $ cat mercurial2/main/nested_absolute/.hg/hgrc \ |
|
901 | 901 | > mercurial2/main/nested_relative/.hg/hgrc |
|
902 | 902 | [paths] |
|
903 | 903 | default = $TESTTMP/mercurial/nested_absolute |
|
904 | 904 | [paths] |
|
905 | 905 | default = $TESTTMP/mercurial/nested_relative |
|
906 | 906 | $ rm -rf mercurial mercurial2 |
|
907 | 907 | |
|
908 | 908 | Issue1977: multirepo push should fail if subrepo push fails |
|
909 | 909 | |
|
910 | 910 | $ hg init repo |
|
911 | 911 | $ hg init repo/s |
|
912 | 912 | $ echo a > repo/s/a |
|
913 | 913 | $ hg -R repo/s ci -Am0 |
|
914 | 914 | adding a |
|
915 | 915 | $ echo s = s > repo/.hgsub |
|
916 | 916 | $ hg -R repo ci -Am1 |
|
917 | 917 | adding .hgsub |
|
918 | 918 | $ hg clone repo repo2 |
|
919 | 919 | updating to branch default |
|
920 | 920 | cloning subrepo s from $TESTTMP/repo/s |
|
921 | 921 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
922 | 922 | $ hg -q -R repo2 pull -u |
|
923 | 923 | $ echo 1 > repo2/s/a |
|
924 | 924 | $ hg -R repo2/s ci -m2 |
|
925 | 925 | $ hg -q -R repo2/s push |
|
926 | 926 | $ hg -R repo2/s up -C 0 |
|
927 | 927 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
928 | 928 | $ echo 2 > repo2/s/b |
|
929 | 929 | $ hg -R repo2/s ci -m3 -A |
|
930 | 930 | adding b |
|
931 | 931 | created new head |
|
932 | 932 | $ hg -R repo2 ci -m3 |
|
933 | 933 | $ hg -q -R repo2 push |
|
934 | 934 | abort: push creates new remote head cc505f09a8b2! (in subrepo s) |
|
935 | 935 | (merge or see "hg help push" for details about pushing new heads) |
|
936 | 936 | [255] |
|
937 | 937 | $ hg -R repo update |
|
938 | 938 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
939 | 939 | |
|
940 | 940 | test if untracked file is not overwritten |
|
941 | 941 | |
|
942 | (this also tests that updated .hgsubstate is treated as "modified", | |
|
943 | when 'merge.update()' is aborted before 'merge.recordupdates()', even | |
|
944 | if none of mode, size and timestamp of it isn't changed on the | |
|
945 | filesystem (see also issue4583)) | |
|
946 | ||
|
942 | 947 | $ echo issue3276_ok > repo/s/b |
|
943 | 948 | $ hg -R repo2 push -f -q |
|
944 | 949 | $ touch -t 200001010000 repo/.hgsubstate |
|
945 | $ hg -R repo status --config debug.dirstate.delaywrite=2 repo/.hgsubstate | |
|
950 | ||
|
951 | $ cat >> repo/.hg/hgrc <<EOF | |
|
952 | > [fakedirstatewritetime] | |
|
953 | > # emulate invoking dirstate.write() via repo.status() | |
|
954 | > # at 2000-01-01 00:00 | |
|
955 | > fakenow = 200001010000 | |
|
956 | > | |
|
957 | > [extensions] | |
|
958 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
|
959 | > EOF | |
|
946 | 960 | $ hg -R repo update |
|
947 | 961 | b: untracked file differs |
|
948 | 962 | abort: untracked files in working directory differ from files in requested revision (in subrepo s) |
|
949 | 963 | [255] |
|
964 | $ cat >> repo/.hg/hgrc <<EOF | |
|
965 | > [extensions] | |
|
966 | > fakedirstatewritetime = ! | |
|
967 | > EOF | |
|
950 | 968 | |
|
951 | 969 | $ cat repo/s/b |
|
952 | 970 | issue3276_ok |
|
953 | 971 | $ rm repo/s/b |
|
954 | 972 | $ touch -t 200001010000 repo/.hgsubstate |
|
955 | 973 | $ hg -R repo revert --all |
|
956 | 974 | reverting repo/.hgsubstate (glob) |
|
957 | 975 | reverting subrepo s |
|
958 | 976 | $ hg -R repo update |
|
959 | 977 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
960 | 978 | $ cat repo/s/b |
|
961 | 979 | 2 |
|
962 | 980 | $ rm -rf repo2 repo |
|
963 | 981 | |
|
964 | 982 | |
|
965 | 983 | Issue1852 subrepos with relative paths always push/pull relative to default |
|
966 | 984 | |
|
967 | 985 | Prepare a repo with subrepo |
|
968 | 986 | |
|
969 | 987 | $ hg init issue1852a |
|
970 | 988 | $ cd issue1852a |
|
971 | 989 | $ hg init sub/repo |
|
972 | 990 | $ echo test > sub/repo/foo |
|
973 | 991 | $ hg -R sub/repo add sub/repo/foo |
|
974 | 992 | $ echo sub/repo = sub/repo > .hgsub |
|
975 | 993 | $ hg add .hgsub |
|
976 | 994 | $ hg ci -mtest |
|
977 | 995 | committing subrepository sub/repo (glob) |
|
978 | 996 | $ echo test >> sub/repo/foo |
|
979 | 997 | $ hg ci -mtest |
|
980 | 998 | committing subrepository sub/repo (glob) |
|
981 | 999 | $ hg cat sub/repo/foo |
|
982 | 1000 | test |
|
983 | 1001 | test |
|
984 | 1002 | $ mkdir -p tmp/sub/repo |
|
985 | 1003 | $ hg cat -r 0 --output tmp/%p_p sub/repo/foo |
|
986 | 1004 | $ cat tmp/sub/repo/foo_p |
|
987 | 1005 | test |
|
988 | 1006 | $ mv sub/repo sub_ |
|
989 | 1007 | $ hg cat sub/repo/baz |
|
990 | 1008 | skipping missing subrepository: sub/repo |
|
991 | 1009 | [1] |
|
992 | 1010 | $ rm -rf sub/repo |
|
993 | 1011 | $ mv sub_ sub/repo |
|
994 | 1012 | $ cd .. |
|
995 | 1013 | |
|
996 | 1014 | Create repo without default path, pull top repo, and see what happens on update |
|
997 | 1015 | |
|
998 | 1016 | $ hg init issue1852b |
|
999 | 1017 | $ hg -R issue1852b pull issue1852a |
|
1000 | 1018 | pulling from issue1852a |
|
1001 | 1019 | requesting all changes |
|
1002 | 1020 | adding changesets |
|
1003 | 1021 | adding manifests |
|
1004 | 1022 | adding file changes |
|
1005 | 1023 | added 2 changesets with 3 changes to 2 files |
|
1006 | 1024 |
(run ' |
|
1007 | 1025 | $ hg -R issue1852b update |
|
1008 | 1026 | abort: default path for subrepository not found (in subrepo sub/repo) (glob) |
|
1009 | 1027 | [255] |
|
1010 | 1028 | |
|
1011 | 1029 | Ensure a full traceback, not just the SubrepoAbort part |
|
1012 | 1030 | |
|
1013 | 1031 |
$ |
|
1014 | 1032 | raise util.Abort(_("default path for subrepository not found")) |
|
1015 | 1033 | |
|
1016 | 1034 |
|
|
1017 | 1035 | |
|
1018 | 1036 | $ hg -R issue1852b pull -u issue1852a |
|
1019 | 1037 | pulling from issue1852a |
|
1020 | 1038 | searching for changes |
|
1021 | 1039 | no changes found |
|
1022 | 1040 | |
|
1023 | 1041 | Try the same, but with pull -u |
|
1024 | 1042 | |
|
1025 | 1043 | $ hg init issue1852c |
|
1026 | 1044 | $ hg -R issue1852c pull -r0 -u issue1852a |
|
1027 | 1045 | pulling from issue1852a |
|
1028 | 1046 | adding changesets |
|
1029 | 1047 | adding manifests |
|
1030 | 1048 | adding file changes |
|
1031 | 1049 | added 1 changesets with 2 changes to 2 files |
|
1032 | 1050 | cloning subrepo sub/repo from issue1852a/sub/repo (glob) |
|
1033 | 1051 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1034 | 1052 | |
|
1035 | 1053 | Try to push from the other side |
|
1036 | 1054 | |
|
1037 | 1055 | $ hg -R issue1852a push `pwd`/issue1852c |
|
1038 | 1056 | pushing to $TESTTMP/issue1852c (glob) |
|
1039 | 1057 | pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob) |
|
1040 | 1058 | searching for changes |
|
1041 | 1059 | no changes found |
|
1042 | 1060 | searching for changes |
|
1043 | 1061 | adding changesets |
|
1044 | 1062 | adding manifests |
|
1045 | 1063 | adding file changes |
|
1046 | 1064 | added 1 changesets with 1 changes to 1 files |
|
1047 | 1065 | |
|
1048 | 1066 | Incoming and outgoing should not use the default path: |
|
1049 | 1067 | |
|
1050 | 1068 | $ hg clone -q issue1852a issue1852d |
|
1051 | 1069 | $ hg -R issue1852d outgoing --subrepos issue1852c |
|
1052 | 1070 | comparing with issue1852c |
|
1053 | 1071 | searching for changes |
|
1054 | 1072 | no changes found |
|
1055 | 1073 | comparing with issue1852c/sub/repo |
|
1056 | 1074 | searching for changes |
|
1057 | 1075 | no changes found |
|
1058 | 1076 | [1] |
|
1059 | 1077 | $ hg -R issue1852d incoming --subrepos issue1852c |
|
1060 | 1078 | comparing with issue1852c |
|
1061 | 1079 | searching for changes |
|
1062 | 1080 | no changes found |
|
1063 | 1081 | comparing with issue1852c/sub/repo |
|
1064 | 1082 | searching for changes |
|
1065 | 1083 | no changes found |
|
1066 | 1084 | [1] |
|
1067 | 1085 | |
|
1068 | 1086 | Check that merge of a new subrepo doesn't write the uncommitted state to |
|
1069 | 1087 | .hgsubstate (issue4622) |
|
1070 | 1088 | |
|
1071 | 1089 | $ hg init issue1852a/addedsub |
|
1072 | 1090 | $ echo zzz > issue1852a/addedsub/zz.txt |
|
1073 | 1091 | $ hg -R issue1852a/addedsub ci -Aqm "initial ZZ" |
|
1074 | 1092 | |
|
1075 | 1093 | $ hg clone issue1852a/addedsub issue1852d/addedsub |
|
1076 | 1094 | updating to branch default |
|
1077 | 1095 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1078 | 1096 | |
|
1079 | 1097 | $ echo def > issue1852a/sub/repo/foo |
|
1080 | 1098 |
$ |
|
1081 | 1099 | adding tmp/sub/repo/foo_p |
|
1082 | 1100 | committing subrepository sub/repo (glob) |
|
1083 | 1101 | |
|
1084 | 1102 |
$ |
|
1085 | 1103 | $ echo xyz > issue1852d/sub/repo/foo |
|
1086 | 1104 | $ hg -R issue1852d pull -u |
|
1087 | 1105 | pulling from $TESTTMP/issue1852a (glob) |
|
1088 | 1106 | searching for changes |
|
1089 | 1107 | adding changesets |
|
1090 | 1108 | adding manifests |
|
1091 | 1109 | adding file changes |
|
1092 | 1110 | added 1 changesets with 2 changes to 2 files |
|
1093 | 1111 | subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c) |
|
1094 | 1112 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
1095 | 1113 | pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo (glob) |
|
1096 | 1114 | searching for changes |
|
1097 | 1115 | adding changesets |
|
1098 | 1116 | adding manifests |
|
1099 | 1117 | adding file changes |
|
1100 | 1118 | added 1 changesets with 1 changes to 1 files |
|
1101 | 1119 | subrepository sources for sub/repo differ (glob) |
|
1102 | 1120 | use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l |
|
1103 | 1121 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1104 | 1122 | $ cat issue1852d/.hgsubstate |
|
1105 | 1123 | f42d5c7504a811dda50f5cf3e5e16c3330b87172 sub/repo |
|
1106 | 1124 | |
|
1107 | 1125 | Check status of files when none of them belong to the first |
|
1108 | 1126 | subrepository: |
|
1109 | 1127 | |
|
1110 | 1128 | $ hg init subrepo-status |
|
1111 | 1129 | $ cd subrepo-status |
|
1112 | 1130 | $ hg init subrepo-1 |
|
1113 | 1131 | $ hg init subrepo-2 |
|
1114 | 1132 | $ cd subrepo-2 |
|
1115 | 1133 | $ touch file |
|
1116 | 1134 | $ hg add file |
|
1117 | 1135 | $ cd .. |
|
1118 | 1136 | $ echo subrepo-1 = subrepo-1 > .hgsub |
|
1119 | 1137 | $ echo subrepo-2 = subrepo-2 >> .hgsub |
|
1120 | 1138 | $ hg add .hgsub |
|
1121 | 1139 |
$ |
|
1122 | 1140 | committing subrepository subrepo-2 |
|
1123 | 1141 | $ hg st subrepo-2/file |
|
1124 | 1142 | |
|
1125 | 1143 | Check that share works with subrepo |
|
1126 | 1144 | $ hg --config extensions.share= share . ../shared |
|
1127 | 1145 | updating working directory |
|
1128 | 1146 | cloning subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2 |
|
1129 | 1147 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1130 | 1148 | $ test -f ../shared/subrepo-1/.hg/sharedpath |
|
1131 | 1149 | [1] |
|
1132 | 1150 | $ hg -R ../shared in |
|
1133 | 1151 | abort: repository default not found! |
|
1134 | 1152 | [255] |
|
1135 | 1153 | $ hg -R ../shared/subrepo-2 showconfig paths |
|
1136 | 1154 | paths.default=$TESTTMP/subrepo-status/subrepo-2 |
|
1137 | 1155 | $ hg -R ../shared/subrepo-1 sum --remote |
|
1138 | 1156 | parent: -1:000000000000 tip (empty repository) |
|
1139 | 1157 | branch: default |
|
1140 | 1158 | commit: (clean) |
|
1141 | 1159 | update: (current) |
|
1142 | 1160 | remote: (synced) |
|
1143 | 1161 | |
|
1144 | 1162 | Check hg update --clean |
|
1145 | 1163 | $ cd $TESTTMP/t |
|
1146 | 1164 | $ rm -r t/t.orig |
|
1147 | 1165 | $ hg status -S --all |
|
1148 | 1166 | C .hgsub |
|
1149 | 1167 | C .hgsubstate |
|
1150 | 1168 | C a |
|
1151 | 1169 | C s/.hgsub |
|
1152 | 1170 | C s/.hgsubstate |
|
1153 | 1171 | C s/a |
|
1154 | 1172 | C s/ss/a |
|
1155 | 1173 | C t/t |
|
1156 | 1174 | $ echo c1 > s/a |
|
1157 | 1175 | $ cd s |
|
1158 | 1176 | $ echo c1 > b |
|
1159 | 1177 | $ echo c1 > c |
|
1160 | 1178 | $ hg add b |
|
1161 | 1179 | $ cd .. |
|
1162 | 1180 | $ hg status -S |
|
1163 | 1181 | M s/a |
|
1164 | 1182 | A s/b |
|
1165 | 1183 | ? s/c |
|
1166 | 1184 | $ hg update -C |
|
1167 | 1185 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1168 | 1186 | $ hg status -S |
|
1169 | 1187 | ? s/b |
|
1170 | 1188 | ? s/c |
|
1171 | 1189 | |
|
1172 | 1190 | Sticky subrepositories, no changes |
|
1173 | 1191 | $ cd $TESTTMP/t |
|
1174 | 1192 | $ hg id |
|
1175 | 1193 | 925c17564ef8 tip |
|
1176 | 1194 | $ hg -R s id |
|
1177 | 1195 | 12a213df6fa9 tip |
|
1178 | 1196 | $ hg -R t id |
|
1179 | 1197 | 52c0adc0515a tip |
|
1180 | 1198 | $ hg update 11 |
|
1181 | 1199 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1182 | 1200 | $ hg id |
|
1183 | 1201 | 365661e5936a |
|
1184 | 1202 | $ hg -R s id |
|
1185 | 1203 | fc627a69481f |
|
1186 | 1204 | $ hg -R t id |
|
1187 | 1205 | e95bcfa18a35 |
|
1188 | 1206 | |
|
1189 | 1207 | Sticky subrepositories, file changes |
|
1190 | 1208 | $ touch s/f1 |
|
1191 | 1209 | $ touch t/f1 |
|
1192 | 1210 | $ hg add -S s/f1 |
|
1193 | 1211 | $ hg add -S t/f1 |
|
1194 | 1212 | $ hg id |
|
1195 | 1213 | 365661e5936a+ |
|
1196 | 1214 | $ hg -R s id |
|
1197 | 1215 | fc627a69481f+ |
|
1198 | 1216 | $ hg -R t id |
|
1199 | 1217 | e95bcfa18a35+ |
|
1200 | 1218 | $ hg update tip |
|
1201 | 1219 | subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9) |
|
1202 | 1220 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
1203 | 1221 | subrepository sources for s differ |
|
1204 | 1222 | use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l |
|
1205 | 1223 | subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a) |
|
1206 | 1224 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
1207 | 1225 | subrepository sources for t differ |
|
1208 | 1226 | use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l |
|
1209 | 1227 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1210 | 1228 | $ hg id |
|
1211 | 1229 | 925c17564ef8+ tip |
|
1212 | 1230 | $ hg -R s id |
|
1213 | 1231 | fc627a69481f+ |
|
1214 | 1232 | $ hg -R t id |
|
1215 | 1233 | e95bcfa18a35+ |
|
1216 | 1234 | $ hg update --clean tip |
|
1217 | 1235 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1218 | 1236 | |
|
1219 | 1237 | Sticky subrepository, revision updates |
|
1220 | 1238 | $ hg id |
|
1221 | 1239 | 925c17564ef8 tip |
|
1222 | 1240 | $ hg -R s id |
|
1223 | 1241 | 12a213df6fa9 tip |
|
1224 | 1242 | $ hg -R t id |
|
1225 | 1243 | 52c0adc0515a tip |
|
1226 | 1244 | $ cd s |
|
1227 | 1245 | $ hg update -r -2 |
|
1228 | 1246 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1229 | 1247 | $ cd ../t |
|
1230 | 1248 | $ hg update -r 2 |
|
1231 | 1249 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1232 | 1250 | $ cd .. |
|
1233 | 1251 | $ hg update 10 |
|
1234 | 1252 | subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f) |
|
1235 | 1253 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
1236 | 1254 | subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c) |
|
1237 | 1255 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
1238 | 1256 | subrepository sources for t differ (in checked out version) |
|
1239 | 1257 | use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l |
|
1240 | 1258 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1241 | 1259 | $ hg id |
|
1242 | 1260 | e45c8b14af55+ |
|
1243 | 1261 | $ hg -R s id |
|
1244 | 1262 | 02dcf1d70411 |
|
1245 | 1263 | $ hg -R t id |
|
1246 | 1264 | 7af322bc1198 |
|
1247 | 1265 | |
|
1248 | 1266 | Sticky subrepository, file changes and revision updates |
|
1249 | 1267 | $ touch s/f1 |
|
1250 | 1268 | $ touch t/f1 |
|
1251 | 1269 | $ hg add -S s/f1 |
|
1252 | 1270 | $ hg add -S t/f1 |
|
1253 | 1271 | $ hg id |
|
1254 | 1272 | e45c8b14af55+ |
|
1255 | 1273 | $ hg -R s id |
|
1256 | 1274 | 02dcf1d70411+ |
|
1257 | 1275 | $ hg -R t id |
|
1258 | 1276 | 7af322bc1198+ |
|
1259 | 1277 | $ hg update tip |
|
1260 | 1278 | subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9) |
|
1261 | 1279 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
1262 | 1280 | subrepository sources for s differ |
|
1263 | 1281 | use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l |
|
1264 | 1282 | subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a) |
|
1265 | 1283 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
1266 | 1284 | subrepository sources for t differ |
|
1267 | 1285 | use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l |
|
1268 | 1286 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1269 | 1287 | $ hg id |
|
1270 | 1288 | 925c17564ef8+ tip |
|
1271 | 1289 | $ hg -R s id |
|
1272 | 1290 | 02dcf1d70411+ |
|
1273 | 1291 | $ hg -R t id |
|
1274 | 1292 | 7af322bc1198+ |
|
1275 | 1293 | |
|
1276 | 1294 | Sticky repository, update --clean |
|
1277 | 1295 | $ hg update --clean tip |
|
1278 | 1296 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1279 | 1297 | $ hg id |
|
1280 | 1298 | 925c17564ef8 tip |
|
1281 | 1299 | $ hg -R s id |
|
1282 | 1300 | 12a213df6fa9 tip |
|
1283 | 1301 | $ hg -R t id |
|
1284 | 1302 | 52c0adc0515a tip |
|
1285 | 1303 | |
|
1286 | 1304 | Test subrepo already at intended revision: |
|
1287 | 1305 | $ cd s |
|
1288 | 1306 | $ hg update fc627a69481f |
|
1289 | 1307 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1290 | 1308 | $ cd .. |
|
1291 | 1309 | $ hg update 11 |
|
1292 | 1310 | subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f) |
|
1293 | 1311 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
1294 | 1312 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1295 | 1313 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1296 | 1314 | $ hg id -n |
|
1297 | 1315 | 11+ |
|
1298 | 1316 | $ hg -R s id |
|
1299 | 1317 | fc627a69481f |
|
1300 | 1318 | $ hg -R t id |
|
1301 | 1319 | e95bcfa18a35 |
|
1302 | 1320 | |
|
1303 | 1321 |
|
|
1304 | 1322 | |
|
1305 | 1323 | $ hg rm -f .hgsubstate |
|
1306 | 1324 | $ hg ci -mrm |
|
1307 | 1325 | nothing changed |
|
1308 | 1326 | [1] |
|
1309 | 1327 | $ hg log -vr tip |
|
1310 | 1328 | changeset: 13:925c17564ef8 |
|
1311 | 1329 | tag: tip |
|
1312 | 1330 | user: test |
|
1313 | 1331 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1314 | 1332 | files: .hgsubstate |
|
1315 | 1333 | description: |
|
1316 | 1334 | 13 |
|
1317 | 1335 | |
|
1318 | 1336 | |
|
1319 | 1337 | |
|
1320 | 1338 | Test that removing .hgsub removes .hgsubstate: |
|
1321 | 1339 | |
|
1322 | 1340 | $ hg rm .hgsub |
|
1323 | 1341 | $ hg ci -mrm2 |
|
1324 | 1342 | created new head |
|
1325 | 1343 | $ hg log -vr tip |
|
1326 | 1344 | changeset: 14:2400bccd50af |
|
1327 | 1345 | tag: tip |
|
1328 | 1346 | parent: 11:365661e5936a |
|
1329 | 1347 | user: test |
|
1330 | 1348 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1331 | 1349 | files: .hgsub .hgsubstate |
|
1332 | 1350 | description: |
|
1333 | 1351 | rm2 |
|
1334 | 1352 | |
|
1335 | 1353 | |
|
1336 | 1354 | Test issue3153: diff -S with deleted subrepos |
|
1337 | 1355 | |
|
1338 | 1356 | $ hg diff --nodates -S -c . |
|
1339 | 1357 | diff -r 365661e5936a -r 2400bccd50af .hgsub |
|
1340 | 1358 | --- a/.hgsub |
|
1341 | 1359 | +++ /dev/null |
|
1342 | 1360 | @@ -1,2 +0,0 @@ |
|
1343 | 1361 | -s = s |
|
1344 | 1362 | -t = t |
|
1345 | 1363 | diff -r 365661e5936a -r 2400bccd50af .hgsubstate |
|
1346 | 1364 | --- a/.hgsubstate |
|
1347 | 1365 | +++ /dev/null |
|
1348 | 1366 | @@ -1,2 +0,0 @@ |
|
1349 | 1367 | -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s |
|
1350 | 1368 | -e95bcfa18a358dc4936da981ebf4147b4cad1362 t |
|
1351 | 1369 | |
|
1352 | 1370 | Test behavior of add for explicit path in subrepo: |
|
1353 | 1371 | $ cd .. |
|
1354 | 1372 | $ hg init explicit |
|
1355 | 1373 | $ cd explicit |
|
1356 | 1374 | $ echo s = s > .hgsub |
|
1357 | 1375 | $ hg add .hgsub |
|
1358 | 1376 | $ hg init s |
|
1359 | 1377 | $ hg ci -m0 |
|
1360 | 1378 | Adding with an explicit path in a subrepo adds the file |
|
1361 | 1379 | $ echo c1 > f1 |
|
1362 | 1380 | $ echo c2 > s/f2 |
|
1363 | 1381 | $ hg st -S |
|
1364 | 1382 | ? f1 |
|
1365 | 1383 | ? s/f2 |
|
1366 | 1384 | $ hg add s/f2 |
|
1367 | 1385 | $ hg st -S |
|
1368 | 1386 | A s/f2 |
|
1369 | 1387 | ? f1 |
|
1370 | 1388 | $ hg ci -R s -m0 |
|
1371 | 1389 | $ hg ci -Am1 |
|
1372 | 1390 | adding f1 |
|
1373 | 1391 | Adding with an explicit path in a subrepo with -S has the same behavior |
|
1374 | 1392 | $ echo c3 > f3 |
|
1375 | 1393 | $ echo c4 > s/f4 |
|
1376 | 1394 | $ hg st -S |
|
1377 | 1395 | ? f3 |
|
1378 | 1396 | ? s/f4 |
|
1379 | 1397 | $ hg add -S s/f4 |
|
1380 | 1398 | $ hg st -S |
|
1381 | 1399 | A s/f4 |
|
1382 | 1400 | ? f3 |
|
1383 | 1401 | $ hg ci -R s -m1 |
|
1384 | 1402 | $ hg ci -Ama2 |
|
1385 | 1403 | adding f3 |
|
1386 | 1404 | Adding without a path or pattern silently ignores subrepos |
|
1387 | 1405 | $ echo c5 > f5 |
|
1388 | 1406 | $ echo c6 > s/f6 |
|
1389 | 1407 | $ echo c7 > s/f7 |
|
1390 | 1408 | $ hg st -S |
|
1391 | 1409 | ? f5 |
|
1392 | 1410 | ? s/f6 |
|
1393 | 1411 | ? s/f7 |
|
1394 | 1412 | $ hg add |
|
1395 | 1413 | adding f5 |
|
1396 | 1414 | $ hg st -S |
|
1397 | 1415 | A f5 |
|
1398 | 1416 | ? s/f6 |
|
1399 | 1417 | ? s/f7 |
|
1400 | 1418 | $ hg ci -R s -Am2 |
|
1401 | 1419 | adding f6 |
|
1402 | 1420 | adding f7 |
|
1403 | 1421 | $ hg ci -m3 |
|
1404 | 1422 | Adding without a path or pattern with -S also adds files in subrepos |
|
1405 | 1423 | $ echo c8 > f8 |
|
1406 | 1424 | $ echo c9 > s/f9 |
|
1407 | 1425 | $ echo c10 > s/f10 |
|
1408 | 1426 | $ hg st -S |
|
1409 | 1427 | ? f8 |
|
1410 | 1428 | ? s/f10 |
|
1411 | 1429 | ? s/f9 |
|
1412 | 1430 | $ hg add -S |
|
1413 | 1431 | adding f8 |
|
1414 | 1432 | adding s/f10 (glob) |
|
1415 | 1433 | adding s/f9 (glob) |
|
1416 | 1434 | $ hg st -S |
|
1417 | 1435 | A f8 |
|
1418 | 1436 | A s/f10 |
|
1419 | 1437 | A s/f9 |
|
1420 | 1438 | $ hg ci -R s -m3 |
|
1421 | 1439 | $ hg ci -m4 |
|
1422 | 1440 | Adding with a pattern silently ignores subrepos |
|
1423 | 1441 | $ echo c11 > fm11 |
|
1424 | 1442 | $ echo c12 > fn12 |
|
1425 | 1443 | $ echo c13 > s/fm13 |
|
1426 | 1444 | $ echo c14 > s/fn14 |
|
1427 | 1445 | $ hg st -S |
|
1428 | 1446 | ? fm11 |
|
1429 | 1447 | ? fn12 |
|
1430 | 1448 | ? s/fm13 |
|
1431 | 1449 | ? s/fn14 |
|
1432 | 1450 | $ hg add 'glob:**fm*' |
|
1433 | 1451 | adding fm11 |
|
1434 | 1452 | $ hg st -S |
|
1435 | 1453 | A fm11 |
|
1436 | 1454 | ? fn12 |
|
1437 | 1455 | ? s/fm13 |
|
1438 | 1456 | ? s/fn14 |
|
1439 | 1457 | $ hg ci -R s -Am4 |
|
1440 | 1458 | adding fm13 |
|
1441 | 1459 | adding fn14 |
|
1442 | 1460 | $ hg ci -Am5 |
|
1443 | 1461 | adding fn12 |
|
1444 | 1462 | Adding with a pattern with -S also adds matches in subrepos |
|
1445 | 1463 | $ echo c15 > fm15 |
|
1446 | 1464 | $ echo c16 > fn16 |
|
1447 | 1465 | $ echo c17 > s/fm17 |
|
1448 | 1466 | $ echo c18 > s/fn18 |
|
1449 | 1467 | $ hg st -S |
|
1450 | 1468 | ? fm15 |
|
1451 | 1469 | ? fn16 |
|
1452 | 1470 | ? s/fm17 |
|
1453 | 1471 | ? s/fn18 |
|
1454 | 1472 | $ hg add -S 'glob:**fm*' |
|
1455 | 1473 | adding fm15 |
|
1456 | 1474 | adding s/fm17 (glob) |
|
1457 | 1475 | $ hg st -S |
|
1458 | 1476 | A fm15 |
|
1459 | 1477 | A s/fm17 |
|
1460 | 1478 | ? fn16 |
|
1461 | 1479 | ? s/fn18 |
|
1462 | 1480 | $ hg ci -R s -Am5 |
|
1463 | 1481 | adding fn18 |
|
1464 | 1482 | $ hg ci -Am6 |
|
1465 | 1483 | adding fn16 |
|
1466 | 1484 | |
|
1467 | 1485 | Test behavior of forget for explicit path in subrepo: |
|
1468 | 1486 | Forgetting an explicit path in a subrepo untracks the file |
|
1469 | 1487 | $ echo c19 > s/f19 |
|
1470 | 1488 | $ hg add s/f19 |
|
1471 | 1489 | $ hg st -S |
|
1472 | 1490 | A s/f19 |
|
1473 | 1491 | $ hg forget s/f19 |
|
1474 | 1492 | $ hg st -S |
|
1475 | 1493 | ? s/f19 |
|
1476 | 1494 | $ rm s/f19 |
|
1477 | 1495 | $ cd .. |
|
1478 | 1496 | |
|
1479 | 1497 | Courtesy phases synchronisation to publishing server does not block the push |
|
1480 | 1498 | (issue3781) |
|
1481 | 1499 | |
|
1482 | 1500 | $ cp -r main issue3781 |
|
1483 | 1501 | $ cp -r main issue3781-dest |
|
1484 | 1502 | $ cd issue3781-dest/s |
|
1485 | 1503 | $ hg phase tip # show we have draft changeset |
|
1486 | 1504 | 5: draft |
|
1487 | 1505 | $ chmod a-w .hg/store/phaseroots # prevent phase push |
|
1488 | 1506 | $ cd ../../issue3781 |
|
1489 | 1507 | $ cat >> .hg/hgrc << EOF |
|
1490 | 1508 | > [paths] |
|
1491 | 1509 | > default=../issue3781-dest/ |
|
1492 | 1510 | > EOF |
|
1493 | 1511 |
$ |
|
1494 | 1512 |
|
|
1495 | 1513 |
|
|
1496 | 1514 |
|
|
1497 | 1515 |
|
|
1498 | 1516 |
|
|
1499 | 1517 |
|
|
1500 | 1518 | [1] |
|
1501 | 1519 | # clean the push cache |
|
1502 | 1520 |
$ |
|
1503 | 1521 |
$ |
|
1504 | 1522 |
|
|
1505 | 1523 |
|
|
1506 | 1524 |
|
|
1507 | 1525 |
|
|
1508 | 1526 |
|
|
1509 | 1527 |
|
|
1510 | 1528 | [1] |
|
1511 | 1529 |
$ |
|
1512 | 1530 | |
|
1513 | 1531 |
Test |
|
1514 | 1532 |
|
|
1515 | 1533 | |
|
1516 | 1534 |
$ |
|
1517 | 1535 |
$ |
|
1518 | 1536 | |
|
1519 | 1537 |
$ |
|
1520 | 1538 | > [phases] |
|
1521 | 1539 | > new-commit = secret |
|
1522 | 1540 | > EOF |
|
1523 | 1541 |
$ |
|
1524 | 1542 | > [phases] |
|
1525 | 1543 | > new-commit = draft |
|
1526 | 1544 | > EOF |
|
1527 | 1545 |
$ |
|
1528 | 1546 | $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1 |
|
1529 | 1547 | committing subrepository ss |
|
1530 | 1548 | transaction abort! |
|
1531 | 1549 | rollback completed |
|
1532 | 1550 | abort: can't commit in draft phase conflicting secret from subrepository ss |
|
1533 | 1551 | [255] |
|
1534 | 1552 | $ echo phasecheck2 >> s/ss/a |
|
1535 | 1553 | $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2 |
|
1536 | 1554 | committing subrepository ss |
|
1537 | 1555 | $ hg -R s/ss phase tip |
|
1538 | 1556 | 3: secret |
|
1539 | 1557 | $ hg -R s phase tip |
|
1540 | 1558 | 6: draft |
|
1541 | 1559 | $ echo phasecheck3 >> s/ss/a |
|
1542 | 1560 | $ hg -R s commit -S -m phasecheck3 |
|
1543 | 1561 | committing subrepository ss |
|
1544 | 1562 | warning: changes are committed in secret phase from subrepository ss |
|
1545 | 1563 | $ hg -R s/ss phase tip |
|
1546 | 1564 | 4: secret |
|
1547 | 1565 | $ hg -R s phase tip |
|
1548 | 1566 | 7: secret |
|
1549 | 1567 | |
|
1550 | 1568 | $ cat >> t/.hg/hgrc <<EOF |
|
1551 | 1569 | > [phases] |
|
1552 | 1570 | > new-commit = draft |
|
1553 | 1571 | > EOF |
|
1554 | 1572 | $ cat >> .hg/hgrc <<EOF |
|
1555 | 1573 | > [phases] |
|
1556 | 1574 | > new-commit = public |
|
1557 | 1575 | > EOF |
|
1558 | 1576 | $ echo phasecheck4 >> s/ss/a |
|
1559 | 1577 | $ echo phasecheck4 >> t/t |
|
1560 | 1578 | $ hg commit -S -m phasecheck4 |
|
1561 | 1579 | committing subrepository s |
|
1562 | 1580 | committing subrepository s/ss (glob) |
|
1563 | 1581 | warning: changes are committed in secret phase from subrepository ss |
|
1564 | 1582 | committing subrepository t |
|
1565 | 1583 | warning: changes are committed in secret phase from subrepository s |
|
1566 | 1584 | created new head |
|
1567 | 1585 | $ hg -R s/ss phase tip |
|
1568 | 1586 | 5: secret |
|
1569 | 1587 | $ hg -R s phase tip |
|
1570 | 1588 | 8: secret |
|
1571 | 1589 | $ hg -R t phase tip |
|
1572 | 1590 | 6: draft |
|
1573 | 1591 | $ hg phase tip |
|
1574 | 1592 | 15: secret |
|
1575 | 1593 | |
|
1576 | 1594 | $ cd .. |
|
1577 | 1595 | |
|
1578 | 1596 | |
|
1579 | 1597 | Test that commit --secret works on both repo and subrepo (issue4182) |
|
1580 | 1598 | |
|
1581 | 1599 | $ cd main |
|
1582 | 1600 | $ echo secret >> b |
|
1583 | 1601 | $ echo secret >> s/b |
|
1584 | 1602 | $ hg commit --secret --subrepo -m "secret" |
|
1585 | 1603 | committing subrepository s |
|
1586 | 1604 | $ hg phase -r . |
|
1587 | 1605 | 6: secret |
|
1588 | 1606 | $ cd s |
|
1589 | 1607 | $ hg phase -r . |
|
1590 | 1608 | 6: secret |
|
1591 | 1609 | $ cd ../../ |
|
1592 | 1610 | |
|
1593 | 1611 | Test "subrepos" template keyword |
|
1594 | 1612 | |
|
1595 | 1613 | $ cd t |
|
1596 | 1614 | $ hg update -q 15 |
|
1597 | 1615 | $ cat > .hgsub <<EOF |
|
1598 | 1616 | > s = s |
|
1599 | 1617 | > EOF |
|
1600 | 1618 | $ hg commit -m "16" |
|
1601 | 1619 | warning: changes are committed in secret phase from subrepository s |
|
1602 | 1620 | |
|
1603 | 1621 | (addition of ".hgsub" itself) |
|
1604 | 1622 | |
|
1605 | 1623 | $ hg diff --nodates -c 1 .hgsubstate |
|
1606 | 1624 | diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate |
|
1607 | 1625 | --- /dev/null |
|
1608 | 1626 | +++ b/.hgsubstate |
|
1609 | 1627 | @@ -0,0 +1,1 @@ |
|
1610 | 1628 | +e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1611 | 1629 | $ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1612 | 1630 | f7b1eb17ad24 000000000000 |
|
1613 | 1631 | s |
|
1614 | 1632 | |
|
1615 | 1633 | (modification of existing entry) |
|
1616 | 1634 | |
|
1617 | 1635 | $ hg diff --nodates -c 2 .hgsubstate |
|
1618 | 1636 | diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate |
|
1619 | 1637 | --- a/.hgsubstate |
|
1620 | 1638 | +++ b/.hgsubstate |
|
1621 | 1639 | @@ -1,1 +1,1 @@ |
|
1622 | 1640 | -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1623 | 1641 | +dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s |
|
1624 | 1642 | $ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1625 | 1643 | 7cf8cfea66e4 000000000000 |
|
1626 | 1644 | s |
|
1627 | 1645 | |
|
1628 | 1646 | (addition of entry) |
|
1629 | 1647 | |
|
1630 | 1648 | $ hg diff --nodates -c 5 .hgsubstate |
|
1631 | 1649 | diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate |
|
1632 | 1650 | --- a/.hgsubstate |
|
1633 | 1651 | +++ b/.hgsubstate |
|
1634 | 1652 | @@ -1,1 +1,2 @@ |
|
1635 | 1653 | e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1636 | 1654 | +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t |
|
1637 | 1655 | $ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1638 | 1656 | 7cf8cfea66e4 000000000000 |
|
1639 | 1657 | t |
|
1640 | 1658 | |
|
1641 | 1659 | (removal of existing entry) |
|
1642 | 1660 | |
|
1643 | 1661 | $ hg diff --nodates -c 16 .hgsubstate |
|
1644 | 1662 | diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate |
|
1645 | 1663 | --- a/.hgsubstate |
|
1646 | 1664 | +++ b/.hgsubstate |
|
1647 | 1665 | @@ -1,2 +1,1 @@ |
|
1648 | 1666 | 0731af8ca9423976d3743119d0865097c07bdc1b s |
|
1649 | 1667 | -e202dc79b04c88a636ea8913d9182a1346d9b3dc t |
|
1650 | 1668 | $ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1651 | 1669 | 8bec38d2bd0b 000000000000 |
|
1652 | 1670 | t |
|
1653 | 1671 | |
|
1654 | 1672 | (merging) |
|
1655 | 1673 | |
|
1656 | 1674 | $ hg diff --nodates -c 9 .hgsubstate |
|
1657 | 1675 | diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate |
|
1658 | 1676 | --- a/.hgsubstate |
|
1659 | 1677 | +++ b/.hgsubstate |
|
1660 | 1678 | @@ -1,1 +1,2 @@ |
|
1661 | 1679 | fc627a69481fcbe5f1135069e8a3881c023e4cf5 s |
|
1662 | 1680 | +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t |
|
1663 | 1681 | $ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1664 | 1682 | f6affe3fbfaa 1f14a2e2d3ec |
|
1665 | 1683 | t |
|
1666 | 1684 | |
|
1667 | 1685 | (removal of ".hgsub" itself) |
|
1668 | 1686 | |
|
1669 | 1687 | $ hg diff --nodates -c 8 .hgsubstate |
|
1670 | 1688 | diff -r f94576341bcf -r 96615c1dad2d .hgsubstate |
|
1671 | 1689 | --- a/.hgsubstate |
|
1672 | 1690 | +++ /dev/null |
|
1673 | 1691 | @@ -1,2 +0,0 @@ |
|
1674 | 1692 | -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s |
|
1675 | 1693 | -7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t |
|
1676 | 1694 | $ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}" |
|
1677 | 1695 | f94576341bcf 000000000000 |
|
1678 | 1696 | |
|
1679 | 1697 | Test that '[paths]' is configured correctly at subrepo creation |
|
1680 | 1698 | |
|
1681 | 1699 | $ cd $TESTTMP/tc |
|
1682 | 1700 | $ cat > .hgsub <<EOF |
|
1683 | 1701 | > # to clear bogus subrepo path 'bogus=[boguspath' |
|
1684 | 1702 | > s = s |
|
1685 | 1703 | > t = t |
|
1686 | 1704 | > EOF |
|
1687 | 1705 | $ hg update -q --clean null |
|
1688 | 1706 | $ rm -rf s t |
|
1689 | 1707 | $ cat >> .hg/hgrc <<EOF |
|
1690 | 1708 | > [paths] |
|
1691 | 1709 | > default-push = /foo/bar |
|
1692 | 1710 | > EOF |
|
1693 | 1711 | $ hg update -q |
|
1694 | 1712 | $ cat s/.hg/hgrc |
|
1695 | 1713 | [paths] |
|
1696 | 1714 | default = $TESTTMP/t/s |
|
1697 | 1715 | default-push = /foo/bar/s |
|
1698 | 1716 | $ cat s/ss/.hg/hgrc |
|
1699 | 1717 | [paths] |
|
1700 | 1718 | default = $TESTTMP/t/s/ss |
|
1701 | 1719 | default-push = /foo/bar/s/ss |
|
1702 | 1720 | $ cat t/.hg/hgrc |
|
1703 | 1721 | [paths] |
|
1704 | 1722 | default = $TESTTMP/t/t |
|
1705 | 1723 | default-push = /foo/bar/t |
|
1706 | 1724 | |
|
1707 | 1725 | $ cd $TESTTMP/t |
|
1708 | 1726 | $ hg up -qC 0 |
|
1709 | 1727 | $ echo 'bar' > bar.txt |
|
1710 | 1728 | $ hg ci -Am 'branch before subrepo add' |
|
1711 | 1729 | adding bar.txt |
|
1712 | 1730 | created new head |
|
1713 | 1731 | $ hg merge -r "first(subrepo('s'))" |
|
1714 | 1732 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1715 | 1733 | (branch merge, don't forget to commit) |
|
1716 | 1734 | $ hg status -S -X '.hgsub*' |
|
1717 | 1735 | A s/a |
|
1718 | 1736 | ? s/b |
|
1719 | 1737 | ? s/c |
|
1720 | 1738 | ? s/f1 |
|
1721 | 1739 | $ hg status -S --rev 'p2()' |
|
1722 | 1740 | A bar.txt |
|
1723 | 1741 | ? s/b |
|
1724 | 1742 | ? s/c |
|
1725 | 1743 | ? s/f1 |
|
1726 | 1744 | $ hg diff -S -X '.hgsub*' --nodates |
|
1727 | 1745 | diff -r 000000000000 s/a |
|
1728 | 1746 | --- /dev/null |
|
1729 | 1747 | +++ b/s/a |
|
1730 | 1748 | @@ -0,0 +1,1 @@ |
|
1731 | 1749 | +a |
|
1732 | 1750 | $ hg diff -S --rev 'p2()' --nodates |
|
1733 | 1751 | diff -r 7cf8cfea66e4 bar.txt |
|
1734 | 1752 | --- /dev/null |
|
1735 | 1753 | +++ b/bar.txt |
|
1736 | 1754 | @@ -0,0 +1,1 @@ |
|
1737 | 1755 | +bar |
|
1738 | 1756 | |
|
1739 | 1757 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now