Show More
@@ -1,1178 +1,1178 b'' | |||
|
1 | 1 | # Copyright 2009-2010 Gregory P. Ward |
|
2 | 2 | # Copyright 2009-2010 Intelerad Medical Systems Incorporated |
|
3 | 3 | # Copyright 2010-2011 Fog Creek Software |
|
4 | 4 | # Copyright 2010-2011 Unity Technologies |
|
5 | 5 | # |
|
6 | 6 | # This software may be used and distributed according to the terms of the |
|
7 | 7 | # GNU General Public License version 2 or any later version. |
|
8 | 8 | |
|
9 | 9 | '''Overridden Mercurial commands and functions for the largefiles extension''' |
|
10 | 10 | |
|
11 | 11 | import os |
|
12 | 12 | import copy |
|
13 | 13 | |
|
14 | 14 | from mercurial import hg, commands, util, cmdutil, scmutil, match as match_, \ |
|
15 | 15 | node, archival, error, merge, discovery |
|
16 | 16 | from mercurial.i18n import _ |
|
17 | 17 | from mercurial.node import hex |
|
18 | 18 | from hgext import rebase |
|
19 | 19 | |
|
20 | 20 | import lfutil |
|
21 | 21 | import lfcommands |
|
22 | 22 | |
|
23 | 23 | # -- Utility functions: commonly/repeatedly needed functionality --------------- |
|
24 | 24 | |
|
25 | 25 | def installnormalfilesmatchfn(manifest): |
|
26 | 26 | '''overrides scmutil.match so that the matcher it returns will ignore all |
|
27 | 27 | largefiles''' |
|
28 | 28 | oldmatch = None # for the closure |
|
29 | 29 | def overridematch(ctx, pats=[], opts={}, globbed=False, |
|
30 | 30 | default='relpath'): |
|
31 | 31 | match = oldmatch(ctx, pats, opts, globbed, default) |
|
32 | 32 | m = copy.copy(match) |
|
33 | 33 | notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in |
|
34 | 34 | manifest) |
|
35 | 35 | m._files = filter(notlfile, m._files) |
|
36 | 36 | m._fmap = set(m._files) |
|
37 | 37 | origmatchfn = m.matchfn |
|
38 | 38 | m.matchfn = lambda f: notlfile(f) and origmatchfn(f) or None |
|
39 | 39 | return m |
|
40 | 40 | oldmatch = installmatchfn(overridematch) |
|
41 | 41 | |
|
42 | 42 | def installmatchfn(f): |
|
43 | 43 | oldmatch = scmutil.match |
|
44 | 44 | setattr(f, 'oldmatch', oldmatch) |
|
45 | 45 | scmutil.match = f |
|
46 | 46 | return oldmatch |
|
47 | 47 | |
|
48 | 48 | def restorematchfn(): |
|
49 | 49 | '''restores scmutil.match to what it was before installnormalfilesmatchfn |
|
50 | 50 | was called. no-op if scmutil.match is its original function. |
|
51 | 51 | |
|
52 | 52 | Note that n calls to installnormalfilesmatchfn will require n calls to |
|
53 | 53 | restore matchfn to reverse''' |
|
54 | 54 | scmutil.match = getattr(scmutil.match, 'oldmatch', scmutil.match) |
|
55 | 55 | |
|
56 | 56 | def addlargefiles(ui, repo, *pats, **opts): |
|
57 | 57 | large = opts.pop('large', None) |
|
58 | 58 | lfsize = lfutil.getminsize( |
|
59 | 59 | ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None)) |
|
60 | 60 | |
|
61 | 61 | lfmatcher = None |
|
62 | 62 | if lfutil.islfilesrepo(repo): |
|
63 | 63 | lfpats = ui.configlist(lfutil.longname, 'patterns', default=[]) |
|
64 | 64 | if lfpats: |
|
65 | 65 | lfmatcher = match_.match(repo.root, '', list(lfpats)) |
|
66 | 66 | |
|
67 | 67 | lfnames = [] |
|
68 | 68 | m = scmutil.match(repo[None], pats, opts) |
|
69 | 69 | m.bad = lambda x, y: None |
|
70 | 70 | wctx = repo[None] |
|
71 | 71 | for f in repo.walk(m): |
|
72 | 72 | exact = m.exact(f) |
|
73 | 73 | lfile = lfutil.standin(f) in wctx |
|
74 | 74 | nfile = f in wctx |
|
75 | 75 | exists = lfile or nfile |
|
76 | 76 | |
|
77 | 77 | # Don't warn the user when they attempt to add a normal tracked file. |
|
78 | 78 | # The normal add code will do that for us. |
|
79 | 79 | if exact and exists: |
|
80 | 80 | if lfile: |
|
81 | 81 | ui.warn(_('%s already a largefile\n') % f) |
|
82 | 82 | continue |
|
83 | 83 | |
|
84 | 84 | if (exact or not exists) and not lfutil.isstandin(f): |
|
85 | 85 | wfile = repo.wjoin(f) |
|
86 | 86 | |
|
87 | 87 | # In case the file was removed previously, but not committed |
|
88 | 88 | # (issue3507) |
|
89 | 89 | if not os.path.exists(wfile): |
|
90 | 90 | continue |
|
91 | 91 | |
|
92 | 92 | abovemin = (lfsize and |
|
93 | 93 | os.lstat(wfile).st_size >= lfsize * 1024 * 1024) |
|
94 | 94 | if large or abovemin or (lfmatcher and lfmatcher(f)): |
|
95 | 95 | lfnames.append(f) |
|
96 | 96 | if ui.verbose or not exact: |
|
97 | 97 | ui.status(_('adding %s as a largefile\n') % m.rel(f)) |
|
98 | 98 | |
|
99 | 99 | bad = [] |
|
100 | 100 | standins = [] |
|
101 | 101 | |
|
102 | 102 | # Need to lock, otherwise there could be a race condition between |
|
103 | 103 | # when standins are created and added to the repo. |
|
104 | 104 | wlock = repo.wlock() |
|
105 | 105 | try: |
|
106 | 106 | if not opts.get('dry_run'): |
|
107 | 107 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
108 | 108 | for f in lfnames: |
|
109 | 109 | standinname = lfutil.standin(f) |
|
110 | 110 | lfutil.writestandin(repo, standinname, hash='', |
|
111 | 111 | executable=lfutil.getexecutable(repo.wjoin(f))) |
|
112 | 112 | standins.append(standinname) |
|
113 | 113 | if lfdirstate[f] == 'r': |
|
114 | 114 | lfdirstate.normallookup(f) |
|
115 | 115 | else: |
|
116 | 116 | lfdirstate.add(f) |
|
117 | 117 | lfdirstate.write() |
|
118 | 118 | bad += [lfutil.splitstandin(f) |
|
119 | 119 | for f in repo[None].add(standins) |
|
120 | 120 | if f in m.files()] |
|
121 | 121 | finally: |
|
122 | 122 | wlock.release() |
|
123 | 123 | return bad |
|
124 | 124 | |
|
125 | 125 | def removelargefiles(ui, repo, *pats, **opts): |
|
126 | 126 | after = opts.get('after') |
|
127 | 127 | if not pats and not after: |
|
128 | 128 | raise util.Abort(_('no files specified')) |
|
129 | 129 | m = scmutil.match(repo[None], pats, opts) |
|
130 | 130 | try: |
|
131 | 131 | repo.lfstatus = True |
|
132 | 132 | s = repo.status(match=m, clean=True) |
|
133 | 133 | finally: |
|
134 | 134 | repo.lfstatus = False |
|
135 | 135 | manifest = repo[None].manifest() |
|
136 | 136 | modified, added, deleted, clean = [[f for f in list |
|
137 | 137 | if lfutil.standin(f) in manifest] |
|
138 | 138 | for list in [s[0], s[1], s[3], s[6]]] |
|
139 | 139 | |
|
140 | 140 | def warn(files, msg): |
|
141 | 141 | for f in files: |
|
142 | 142 | ui.warn(msg % m.rel(f)) |
|
143 | 143 | return int(len(files) > 0) |
|
144 | 144 | |
|
145 | 145 | result = 0 |
|
146 | 146 | |
|
147 | 147 | if after: |
|
148 | 148 | remove, forget = deleted, [] |
|
149 | 149 | result = warn(modified + added + clean, |
|
150 | 150 | _('not removing %s: file still exists\n')) |
|
151 | 151 | else: |
|
152 | 152 | remove, forget = deleted + clean, [] |
|
153 | 153 | result = warn(modified, _('not removing %s: file is modified (use -f' |
|
154 | 154 | ' to force removal)\n')) |
|
155 | 155 | result = warn(added, _('not removing %s: file has been marked for add' |
|
156 | 156 | ' (use forget to undo)\n')) or result |
|
157 | 157 | |
|
158 | 158 | for f in sorted(remove + forget): |
|
159 | 159 | if ui.verbose or not m.exact(f): |
|
160 | 160 | ui.status(_('removing %s\n') % m.rel(f)) |
|
161 | 161 | |
|
162 | 162 | # Need to lock because standin files are deleted then removed from the |
|
163 | 163 | # repository and we could race in-between. |
|
164 | 164 | wlock = repo.wlock() |
|
165 | 165 | try: |
|
166 | 166 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
167 | 167 | for f in remove: |
|
168 | 168 | if not after: |
|
169 | 169 | # If this is being called by addremove, notify the user that we |
|
170 | 170 | # are removing the file. |
|
171 | 171 | if getattr(repo, "_isaddremove", False): |
|
172 | 172 | ui.status(_('removing %s\n') % f) |
|
173 | 173 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
|
174 | 174 | lfdirstate.remove(f) |
|
175 | 175 | lfdirstate.write() |
|
176 | 176 | forget = [lfutil.standin(f) for f in forget] |
|
177 | 177 | remove = [lfutil.standin(f) for f in remove] |
|
178 | 178 | repo[None].forget(forget) |
|
179 | 179 | # If this is being called by addremove, let the original addremove |
|
180 | 180 | # function handle this. |
|
181 | 181 | if not getattr(repo, "_isaddremove", False): |
|
182 | 182 | for f in remove: |
|
183 | 183 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
|
184 | 184 | repo[None].forget(remove) |
|
185 | 185 | finally: |
|
186 | 186 | wlock.release() |
|
187 | 187 | |
|
188 | 188 | return result |
|
189 | 189 | |
|
190 | 190 | # For overriding mercurial.hgweb.webcommands so that largefiles will |
|
191 | 191 | # appear at their right place in the manifests. |
|
192 | 192 | def decodepath(orig, path): |
|
193 | 193 | return lfutil.splitstandin(path) or path |
|
194 | 194 | |
|
195 | 195 | # -- Wrappers: modify existing commands -------------------------------- |
|
196 | 196 | |
|
197 | 197 | # Add works by going through the files that the user wanted to add and |
|
198 | 198 | # checking if they should be added as largefiles. Then it makes a new |
|
199 | 199 | # matcher which matches only the normal files and runs the original |
|
200 | 200 | # version of add. |
|
201 | 201 | def overrideadd(orig, ui, repo, *pats, **opts): |
|
202 | 202 | normal = opts.pop('normal') |
|
203 | 203 | if normal: |
|
204 | 204 | if opts.get('large'): |
|
205 | 205 | raise util.Abort(_('--normal cannot be used with --large')) |
|
206 | 206 | return orig(ui, repo, *pats, **opts) |
|
207 | 207 | bad = addlargefiles(ui, repo, *pats, **opts) |
|
208 | 208 | installnormalfilesmatchfn(repo[None].manifest()) |
|
209 | 209 | result = orig(ui, repo, *pats, **opts) |
|
210 | 210 | restorematchfn() |
|
211 | 211 | |
|
212 | 212 | return (result == 1 or bad) and 1 or 0 |
|
213 | 213 | |
|
214 | 214 | def overrideremove(orig, ui, repo, *pats, **opts): |
|
215 | 215 | installnormalfilesmatchfn(repo[None].manifest()) |
|
216 | 216 | result = orig(ui, repo, *pats, **opts) |
|
217 | 217 | restorematchfn() |
|
218 | 218 | return removelargefiles(ui, repo, *pats, **opts) or result |
|
219 | 219 | |
|
220 | 220 | def overridestatusfn(orig, repo, rev2, **opts): |
|
221 | 221 | try: |
|
222 | 222 | repo._repo.lfstatus = True |
|
223 | 223 | return orig(repo, rev2, **opts) |
|
224 | 224 | finally: |
|
225 | 225 | repo._repo.lfstatus = False |
|
226 | 226 | |
|
227 | 227 | def overridestatus(orig, ui, repo, *pats, **opts): |
|
228 | 228 | try: |
|
229 | 229 | repo.lfstatus = True |
|
230 | 230 | return orig(ui, repo, *pats, **opts) |
|
231 | 231 | finally: |
|
232 | 232 | repo.lfstatus = False |
|
233 | 233 | |
|
234 | 234 | def overridedirty(orig, repo, ignoreupdate=False): |
|
235 | 235 | try: |
|
236 | 236 | repo._repo.lfstatus = True |
|
237 | 237 | return orig(repo, ignoreupdate) |
|
238 | 238 | finally: |
|
239 | 239 | repo._repo.lfstatus = False |
|
240 | 240 | |
|
241 | 241 | def overridelog(orig, ui, repo, *pats, **opts): |
|
242 | 242 | def overridematch(ctx, pats=[], opts={}, globbed=False, |
|
243 | 243 | default='relpath'): |
|
244 | 244 | """Matcher that merges root directory with .hglf, suitable for log. |
|
245 | 245 | It is still possible to match .hglf directly. |
|
246 | 246 | For any listed files run log on the standin too. |
|
247 | 247 | matchfn tries both the given filename and with .hglf stripped. |
|
248 | 248 | """ |
|
249 | 249 | match = oldmatch(ctx, pats, opts, globbed, default) |
|
250 | 250 | m = copy.copy(match) |
|
251 | 251 | standins = [lfutil.standin(f) for f in m._files] |
|
252 | 252 | m._files.extend(standins) |
|
253 | 253 | m._fmap = set(m._files) |
|
254 | 254 | origmatchfn = m.matchfn |
|
255 | 255 | def lfmatchfn(f): |
|
256 | 256 | lf = lfutil.splitstandin(f) |
|
257 | 257 | if lf is not None and origmatchfn(lf): |
|
258 | 258 | return True |
|
259 | 259 | r = origmatchfn(f) |
|
260 | 260 | return r |
|
261 | 261 | m.matchfn = lfmatchfn |
|
262 | 262 | return m |
|
263 | 263 | oldmatch = installmatchfn(overridematch) |
|
264 | 264 | try: |
|
265 | 265 | repo.lfstatus = True |
|
266 | 266 | return orig(ui, repo, *pats, **opts) |
|
267 | 267 | finally: |
|
268 | 268 | repo.lfstatus = False |
|
269 | 269 | restorematchfn() |
|
270 | 270 | |
|
271 | 271 | def overrideverify(orig, ui, repo, *pats, **opts): |
|
272 | 272 | large = opts.pop('large', False) |
|
273 | 273 | all = opts.pop('lfa', False) |
|
274 | 274 | contents = opts.pop('lfc', False) |
|
275 | 275 | |
|
276 | 276 | result = orig(ui, repo, *pats, **opts) |
|
277 | 277 | if large: |
|
278 | 278 | result = result or lfcommands.verifylfiles(ui, repo, all, contents) |
|
279 | 279 | return result |
|
280 | 280 | |
|
281 | 281 | def overridedebugstate(orig, ui, repo, *pats, **opts): |
|
282 | 282 | large = opts.pop('large', False) |
|
283 | 283 | if large: |
|
284 | 284 | lfcommands.debugdirstate(ui, repo) |
|
285 | 285 | else: |
|
286 | 286 | orig(ui, repo, *pats, **opts) |
|
287 | 287 | |
|
288 | 288 | # Override needs to refresh standins so that update's normal merge |
|
289 | 289 | # will go through properly. Then the other update hook (overriding repo.update) |
|
290 | 290 | # will get the new files. Filemerge is also overridden so that the merge |
|
291 | 291 | # will merge standins correctly. |
|
292 | 292 | def overrideupdate(orig, ui, repo, *pats, **opts): |
|
293 | 293 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
294 | 294 | s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False, |
|
295 | 295 | False, False) |
|
296 | 296 | (unsure, modified, added, removed, missing, unknown, ignored, clean) = s |
|
297 | 297 | |
|
298 | 298 | # Need to lock between the standins getting updated and their |
|
299 | 299 | # largefiles getting updated |
|
300 | 300 | wlock = repo.wlock() |
|
301 | 301 | try: |
|
302 | 302 | if opts['check']: |
|
303 | 303 | mod = len(modified) > 0 |
|
304 | 304 | for lfile in unsure: |
|
305 | 305 | standin = lfutil.standin(lfile) |
|
306 | 306 | if repo['.'][standin].data().strip() != \ |
|
307 | 307 | lfutil.hashfile(repo.wjoin(lfile)): |
|
308 | 308 | mod = True |
|
309 | 309 | else: |
|
310 | 310 | lfdirstate.normal(lfile) |
|
311 | 311 | lfdirstate.write() |
|
312 | 312 | if mod: |
|
313 | 313 | raise util.Abort(_('uncommitted local changes')) |
|
314 | 314 | # XXX handle removed differently |
|
315 | 315 | if not opts['clean']: |
|
316 | 316 | for lfile in unsure + modified + added: |
|
317 | 317 | lfutil.updatestandin(repo, lfutil.standin(lfile)) |
|
318 | 318 | finally: |
|
319 | 319 | wlock.release() |
|
320 | 320 | return orig(ui, repo, *pats, **opts) |
|
321 | 321 | |
|
322 | 322 | # Before starting the manifest merge, merge.updates will call |
|
323 | 323 | # _checkunknown to check if there are any files in the merged-in |
|
324 | 324 | # changeset that collide with unknown files in the working copy. |
|
325 | 325 | # |
|
326 | 326 | # The largefiles are seen as unknown, so this prevents us from merging |
|
327 | 327 | # in a file 'foo' if we already have a largefile with the same name. |
|
328 | 328 | # |
|
329 | 329 | # The overridden function filters the unknown files by removing any |
|
330 | 330 | # largefiles. This makes the merge proceed and we can then handle this |
|
331 | 331 | # case further in the overridden manifestmerge function below. |
|
332 | 332 | def overridecheckunknownfile(origfn, repo, wctx, mctx, f): |
|
333 | 333 | if lfutil.standin(f) in wctx: |
|
334 | 334 | return False |
|
335 | 335 | return origfn(repo, wctx, mctx, f) |
|
336 | 336 | |
|
337 | 337 | # The manifest merge handles conflicts on the manifest level. We want |
|
338 | 338 | # to handle changes in largefile-ness of files at this level too. |
|
339 | 339 | # |
|
340 | 340 | # The strategy is to run the original manifestmerge and then process |
|
341 | 341 | # the action list it outputs. There are two cases we need to deal with: |
|
342 | 342 | # |
|
343 | 343 | # 1. Normal file in p1, largefile in p2. Here the largefile is |
|
344 | 344 | # detected via its standin file, which will enter the working copy |
|
345 | 345 | # with a "get" action. It is not "merge" since the standin is all |
|
346 | 346 | # Mercurial is concerned with at this level -- the link to the |
|
347 | 347 | # existing normal file is not relevant here. |
|
348 | 348 | # |
|
349 | 349 | # 2. Largefile in p1, normal file in p2. Here we get a "merge" action |
|
350 | 350 | # since the largefile will be present in the working copy and |
|
351 | 351 | # different from the normal file in p2. Mercurial therefore |
|
352 | 352 | # triggers a merge action. |
|
353 | 353 | # |
|
354 | 354 | # In both cases, we prompt the user and emit new actions to either |
|
355 | 355 | # remove the standin (if the normal file was kept) or to remove the |
|
356 | 356 | # normal file and get the standin (if the largefile was kept). The |
|
357 | 357 | # default prompt answer is to use the largefile version since it was |
|
358 | 358 | # presumably changed on purpose. |
|
359 | 359 | # |
|
360 | 360 | # Finally, the merge.applyupdates function will then take care of |
|
361 | 361 | # writing the files into the working copy and lfcommands.updatelfiles |
|
362 | 362 | # will update the largefiles. |
|
363 | 363 | def overridemanifestmerge(origfn, repo, p1, p2, pa, overwrite, partial): |
|
364 | 364 | actions = origfn(repo, p1, p2, pa, overwrite, partial) |
|
365 | 365 | processed = [] |
|
366 | 366 | |
|
367 | 367 | for action in actions: |
|
368 | 368 | if overwrite: |
|
369 | 369 | processed.append(action) |
|
370 | 370 | continue |
|
371 | f, m, args = action | |
|
371 | f, m, args, msg = action | |
|
372 | 372 | |
|
373 | 373 | choices = (_('&Largefile'), _('&Normal file')) |
|
374 | 374 | if m == "g" and lfutil.splitstandin(f) in p1 and f in p2: |
|
375 | 375 | # Case 1: normal file in the working copy, largefile in |
|
376 | 376 | # the second parent |
|
377 | 377 | lfile = lfutil.splitstandin(f) |
|
378 | 378 | standin = f |
|
379 | 379 | msg = _('%s has been turned into a largefile\n' |
|
380 | 380 | 'use (l)argefile or keep as (n)ormal file?') % lfile |
|
381 | 381 | if repo.ui.promptchoice(msg, choices, 0) == 0: |
|
382 | processed.append((lfile, "r", None)) | |
|
383 | processed.append((standin, "g", (p2.flags(standin),))) | |
|
382 | processed.append((lfile, "r", None, msg)) | |
|
383 | processed.append((standin, "g", (p2.flags(standin),), msg)) | |
|
384 | 384 | else: |
|
385 | processed.append((standin, "r", None)) | |
|
385 | processed.append((standin, "r", None, msg)) | |
|
386 | 386 | elif m == "g" and lfutil.standin(f) in p1 and f in p2: |
|
387 | 387 | # Case 2: largefile in the working copy, normal file in |
|
388 | 388 | # the second parent |
|
389 | 389 | standin = lfutil.standin(f) |
|
390 | 390 | lfile = f |
|
391 | 391 | msg = _('%s has been turned into a normal file\n' |
|
392 | 392 | 'keep as (l)argefile or use (n)ormal file?') % lfile |
|
393 | 393 | if repo.ui.promptchoice(msg, choices, 0) == 0: |
|
394 | processed.append((lfile, "r", None)) | |
|
394 | processed.append((lfile, "r", None, msg)) | |
|
395 | 395 | else: |
|
396 | processed.append((standin, "r", None)) | |
|
397 | processed.append((lfile, "g", (p2.flags(lfile),))) | |
|
396 | processed.append((standin, "r", None, msg)) | |
|
397 | processed.append((lfile, "g", (p2.flags(lfile),), msg)) | |
|
398 | 398 | else: |
|
399 | 399 | processed.append(action) |
|
400 | 400 | |
|
401 | 401 | return processed |
|
402 | 402 | |
|
403 | 403 | # Override filemerge to prompt the user about how they wish to merge |
|
404 | 404 | # largefiles. This will handle identical edits, and copy/rename + |
|
405 | 405 | # edit without prompting the user. |
|
406 | 406 | def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca): |
|
407 | 407 | # Use better variable names here. Because this is a wrapper we cannot |
|
408 | 408 | # change the variable names in the function declaration. |
|
409 | 409 | fcdest, fcother, fcancestor = fcd, fco, fca |
|
410 | 410 | if not lfutil.isstandin(orig): |
|
411 | 411 | return origfn(repo, mynode, orig, fcdest, fcother, fcancestor) |
|
412 | 412 | else: |
|
413 | 413 | if not fcother.cmp(fcdest): # files identical? |
|
414 | 414 | return None |
|
415 | 415 | |
|
416 | 416 | # backwards, use working dir parent as ancestor |
|
417 | 417 | if fcancestor == fcother: |
|
418 | 418 | fcancestor = fcdest.parents()[0] |
|
419 | 419 | |
|
420 | 420 | if orig != fcother.path(): |
|
421 | 421 | repo.ui.status(_('merging %s and %s to %s\n') |
|
422 | 422 | % (lfutil.splitstandin(orig), |
|
423 | 423 | lfutil.splitstandin(fcother.path()), |
|
424 | 424 | lfutil.splitstandin(fcdest.path()))) |
|
425 | 425 | else: |
|
426 | 426 | repo.ui.status(_('merging %s\n') |
|
427 | 427 | % lfutil.splitstandin(fcdest.path())) |
|
428 | 428 | |
|
429 | 429 | if fcancestor.path() != fcother.path() and fcother.data() == \ |
|
430 | 430 | fcancestor.data(): |
|
431 | 431 | return 0 |
|
432 | 432 | if fcancestor.path() != fcdest.path() and fcdest.data() == \ |
|
433 | 433 | fcancestor.data(): |
|
434 | 434 | repo.wwrite(fcdest.path(), fcother.data(), fcother.flags()) |
|
435 | 435 | return 0 |
|
436 | 436 | |
|
437 | 437 | if repo.ui.promptchoice(_('largefile %s has a merge conflict\n' |
|
438 | 438 | 'keep (l)ocal or take (o)ther?') % |
|
439 | 439 | lfutil.splitstandin(orig), |
|
440 | 440 | (_('&Local'), _('&Other')), 0) == 0: |
|
441 | 441 | return 0 |
|
442 | 442 | else: |
|
443 | 443 | repo.wwrite(fcdest.path(), fcother.data(), fcother.flags()) |
|
444 | 444 | return 0 |
|
445 | 445 | |
|
446 | 446 | # Copy first changes the matchers to match standins instead of |
|
447 | 447 | # largefiles. Then it overrides util.copyfile in that function it |
|
448 | 448 | # checks if the destination largefile already exists. It also keeps a |
|
449 | 449 | # list of copied files so that the largefiles can be copied and the |
|
450 | 450 | # dirstate updated. |
|
451 | 451 | def overridecopy(orig, ui, repo, pats, opts, rename=False): |
|
452 | 452 | # doesn't remove largefile on rename |
|
453 | 453 | if len(pats) < 2: |
|
454 | 454 | # this isn't legal, let the original function deal with it |
|
455 | 455 | return orig(ui, repo, pats, opts, rename) |
|
456 | 456 | |
|
457 | 457 | def makestandin(relpath): |
|
458 | 458 | path = scmutil.canonpath(repo.root, repo.getcwd(), relpath) |
|
459 | 459 | return os.path.join(repo.wjoin(lfutil.standin(path))) |
|
460 | 460 | |
|
461 | 461 | fullpats = scmutil.expandpats(pats) |
|
462 | 462 | dest = fullpats[-1] |
|
463 | 463 | |
|
464 | 464 | if os.path.isdir(dest): |
|
465 | 465 | if not os.path.isdir(makestandin(dest)): |
|
466 | 466 | os.makedirs(makestandin(dest)) |
|
467 | 467 | # This could copy both lfiles and normal files in one command, |
|
468 | 468 | # but we don't want to do that. First replace their matcher to |
|
469 | 469 | # only match normal files and run it, then replace it to just |
|
470 | 470 | # match largefiles and run it again. |
|
471 | 471 | nonormalfiles = False |
|
472 | 472 | nolfiles = False |
|
473 | 473 | try: |
|
474 | 474 | try: |
|
475 | 475 | installnormalfilesmatchfn(repo[None].manifest()) |
|
476 | 476 | result = orig(ui, repo, pats, opts, rename) |
|
477 | 477 | except util.Abort, e: |
|
478 | 478 | if str(e) != _('no files to copy'): |
|
479 | 479 | raise e |
|
480 | 480 | else: |
|
481 | 481 | nonormalfiles = True |
|
482 | 482 | result = 0 |
|
483 | 483 | finally: |
|
484 | 484 | restorematchfn() |
|
485 | 485 | |
|
486 | 486 | # The first rename can cause our current working directory to be removed. |
|
487 | 487 | # In that case there is nothing left to copy/rename so just quit. |
|
488 | 488 | try: |
|
489 | 489 | repo.getcwd() |
|
490 | 490 | except OSError: |
|
491 | 491 | return result |
|
492 | 492 | |
|
493 | 493 | try: |
|
494 | 494 | try: |
|
495 | 495 | # When we call orig below it creates the standins but we don't add |
|
496 | 496 | # them to the dir state until later so lock during that time. |
|
497 | 497 | wlock = repo.wlock() |
|
498 | 498 | |
|
499 | 499 | manifest = repo[None].manifest() |
|
500 | 500 | oldmatch = None # for the closure |
|
501 | 501 | def overridematch(ctx, pats=[], opts={}, globbed=False, |
|
502 | 502 | default='relpath'): |
|
503 | 503 | newpats = [] |
|
504 | 504 | # The patterns were previously mangled to add the standin |
|
505 | 505 | # directory; we need to remove that now |
|
506 | 506 | for pat in pats: |
|
507 | 507 | if match_.patkind(pat) is None and lfutil.shortname in pat: |
|
508 | 508 | newpats.append(pat.replace(lfutil.shortname, '')) |
|
509 | 509 | else: |
|
510 | 510 | newpats.append(pat) |
|
511 | 511 | match = oldmatch(ctx, newpats, opts, globbed, default) |
|
512 | 512 | m = copy.copy(match) |
|
513 | 513 | lfile = lambda f: lfutil.standin(f) in manifest |
|
514 | 514 | m._files = [lfutil.standin(f) for f in m._files if lfile(f)] |
|
515 | 515 | m._fmap = set(m._files) |
|
516 | 516 | origmatchfn = m.matchfn |
|
517 | 517 | m.matchfn = lambda f: (lfutil.isstandin(f) and |
|
518 | 518 | (f in manifest) and |
|
519 | 519 | origmatchfn(lfutil.splitstandin(f)) or |
|
520 | 520 | None) |
|
521 | 521 | return m |
|
522 | 522 | oldmatch = installmatchfn(overridematch) |
|
523 | 523 | listpats = [] |
|
524 | 524 | for pat in pats: |
|
525 | 525 | if match_.patkind(pat) is not None: |
|
526 | 526 | listpats.append(pat) |
|
527 | 527 | else: |
|
528 | 528 | listpats.append(makestandin(pat)) |
|
529 | 529 | |
|
530 | 530 | try: |
|
531 | 531 | origcopyfile = util.copyfile |
|
532 | 532 | copiedfiles = [] |
|
533 | 533 | def overridecopyfile(src, dest): |
|
534 | 534 | if (lfutil.shortname in src and |
|
535 | 535 | dest.startswith(repo.wjoin(lfutil.shortname))): |
|
536 | 536 | destlfile = dest.replace(lfutil.shortname, '') |
|
537 | 537 | if not opts['force'] and os.path.exists(destlfile): |
|
538 | 538 | raise IOError('', |
|
539 | 539 | _('destination largefile already exists')) |
|
540 | 540 | copiedfiles.append((src, dest)) |
|
541 | 541 | origcopyfile(src, dest) |
|
542 | 542 | |
|
543 | 543 | util.copyfile = overridecopyfile |
|
544 | 544 | result += orig(ui, repo, listpats, opts, rename) |
|
545 | 545 | finally: |
|
546 | 546 | util.copyfile = origcopyfile |
|
547 | 547 | |
|
548 | 548 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
549 | 549 | for (src, dest) in copiedfiles: |
|
550 | 550 | if (lfutil.shortname in src and |
|
551 | 551 | dest.startswith(repo.wjoin(lfutil.shortname))): |
|
552 | 552 | srclfile = src.replace(repo.wjoin(lfutil.standin('')), '') |
|
553 | 553 | destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '') |
|
554 | 554 | destlfiledir = os.path.dirname(repo.wjoin(destlfile)) or '.' |
|
555 | 555 | if not os.path.isdir(destlfiledir): |
|
556 | 556 | os.makedirs(destlfiledir) |
|
557 | 557 | if rename: |
|
558 | 558 | os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile)) |
|
559 | 559 | lfdirstate.remove(srclfile) |
|
560 | 560 | else: |
|
561 | 561 | util.copyfile(repo.wjoin(srclfile), |
|
562 | 562 | repo.wjoin(destlfile)) |
|
563 | 563 | |
|
564 | 564 | lfdirstate.add(destlfile) |
|
565 | 565 | lfdirstate.write() |
|
566 | 566 | except util.Abort, e: |
|
567 | 567 | if str(e) != _('no files to copy'): |
|
568 | 568 | raise e |
|
569 | 569 | else: |
|
570 | 570 | nolfiles = True |
|
571 | 571 | finally: |
|
572 | 572 | restorematchfn() |
|
573 | 573 | wlock.release() |
|
574 | 574 | |
|
575 | 575 | if nolfiles and nonormalfiles: |
|
576 | 576 | raise util.Abort(_('no files to copy')) |
|
577 | 577 | |
|
578 | 578 | return result |
|
579 | 579 | |
|
580 | 580 | # When the user calls revert, we have to be careful to not revert any |
|
581 | 581 | # changes to other largefiles accidentally. This means we have to keep |
|
582 | 582 | # track of the largefiles that are being reverted so we only pull down |
|
583 | 583 | # the necessary largefiles. |
|
584 | 584 | # |
|
585 | 585 | # Standins are only updated (to match the hash of largefiles) before |
|
586 | 586 | # commits. Update the standins then run the original revert, changing |
|
587 | 587 | # the matcher to hit standins instead of largefiles. Based on the |
|
588 | 588 | # resulting standins update the largefiles. Then return the standins |
|
589 | 589 | # to their proper state |
|
590 | 590 | def overriderevert(orig, ui, repo, *pats, **opts): |
|
591 | 591 | # Because we put the standins in a bad state (by updating them) |
|
592 | 592 | # and then return them to a correct state we need to lock to |
|
593 | 593 | # prevent others from changing them in their incorrect state. |
|
594 | 594 | wlock = repo.wlock() |
|
595 | 595 | try: |
|
596 | 596 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
597 | 597 | (modified, added, removed, missing, unknown, ignored, clean) = \ |
|
598 | 598 | lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev()) |
|
599 | 599 | lfdirstate.write() |
|
600 | 600 | for lfile in modified: |
|
601 | 601 | lfutil.updatestandin(repo, lfutil.standin(lfile)) |
|
602 | 602 | for lfile in missing: |
|
603 | 603 | if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))): |
|
604 | 604 | os.unlink(repo.wjoin(lfutil.standin(lfile))) |
|
605 | 605 | |
|
606 | 606 | try: |
|
607 | 607 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
608 | 608 | oldmatch = None # for the closure |
|
609 | 609 | def overridematch(ctx, pats=[], opts={}, globbed=False, |
|
610 | 610 | default='relpath'): |
|
611 | 611 | match = oldmatch(ctx, pats, opts, globbed, default) |
|
612 | 612 | m = copy.copy(match) |
|
613 | 613 | def tostandin(f): |
|
614 | 614 | if lfutil.standin(f) in ctx: |
|
615 | 615 | return lfutil.standin(f) |
|
616 | 616 | elif lfutil.standin(f) in repo[None]: |
|
617 | 617 | return None |
|
618 | 618 | return f |
|
619 | 619 | m._files = [tostandin(f) for f in m._files] |
|
620 | 620 | m._files = [f for f in m._files if f is not None] |
|
621 | 621 | m._fmap = set(m._files) |
|
622 | 622 | origmatchfn = m.matchfn |
|
623 | 623 | def matchfn(f): |
|
624 | 624 | if lfutil.isstandin(f): |
|
625 | 625 | # We need to keep track of what largefiles are being |
|
626 | 626 | # matched so we know which ones to update later -- |
|
627 | 627 | # otherwise we accidentally revert changes to other |
|
628 | 628 | # largefiles. This is repo-specific, so duckpunch the |
|
629 | 629 | # repo object to keep the list of largefiles for us |
|
630 | 630 | # later. |
|
631 | 631 | if origmatchfn(lfutil.splitstandin(f)) and \ |
|
632 | 632 | (f in repo[None] or f in ctx): |
|
633 | 633 | lfileslist = getattr(repo, '_lfilestoupdate', []) |
|
634 | 634 | lfileslist.append(lfutil.splitstandin(f)) |
|
635 | 635 | repo._lfilestoupdate = lfileslist |
|
636 | 636 | return True |
|
637 | 637 | else: |
|
638 | 638 | return False |
|
639 | 639 | return origmatchfn(f) |
|
640 | 640 | m.matchfn = matchfn |
|
641 | 641 | return m |
|
642 | 642 | oldmatch = installmatchfn(overridematch) |
|
643 | 643 | scmutil.match |
|
644 | 644 | matches = overridematch(repo[None], pats, opts) |
|
645 | 645 | orig(ui, repo, *pats, **opts) |
|
646 | 646 | finally: |
|
647 | 647 | restorematchfn() |
|
648 | 648 | lfileslist = getattr(repo, '_lfilestoupdate', []) |
|
649 | 649 | lfcommands.updatelfiles(ui, repo, filelist=lfileslist, |
|
650 | 650 | printmessage=False) |
|
651 | 651 | |
|
652 | 652 | # empty out the largefiles list so we start fresh next time |
|
653 | 653 | repo._lfilestoupdate = [] |
|
654 | 654 | for lfile in modified: |
|
655 | 655 | if lfile in lfileslist: |
|
656 | 656 | if os.path.exists(repo.wjoin(lfutil.standin(lfile))) and lfile\ |
|
657 | 657 | in repo['.']: |
|
658 | 658 | lfutil.writestandin(repo, lfutil.standin(lfile), |
|
659 | 659 | repo['.'][lfile].data().strip(), |
|
660 | 660 | 'x' in repo['.'][lfile].flags()) |
|
661 | 661 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
662 | 662 | for lfile in added: |
|
663 | 663 | standin = lfutil.standin(lfile) |
|
664 | 664 | if standin not in ctx and (standin in matches or opts.get('all')): |
|
665 | 665 | if lfile in lfdirstate: |
|
666 | 666 | lfdirstate.drop(lfile) |
|
667 | 667 | util.unlinkpath(repo.wjoin(standin)) |
|
668 | 668 | lfdirstate.write() |
|
669 | 669 | finally: |
|
670 | 670 | wlock.release() |
|
671 | 671 | |
|
672 | 672 | def hgupdaterepo(orig, repo, node, overwrite): |
|
673 | 673 | if not overwrite: |
|
674 | 674 | # Only call updatelfiles on the standins that have changed to save time |
|
675 | 675 | oldstandins = lfutil.getstandinsstate(repo) |
|
676 | 676 | |
|
677 | 677 | result = orig(repo, node, overwrite) |
|
678 | 678 | |
|
679 | 679 | filelist = None |
|
680 | 680 | if not overwrite: |
|
681 | 681 | newstandins = lfutil.getstandinsstate(repo) |
|
682 | 682 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) |
|
683 | 683 | lfcommands.updatelfiles(repo.ui, repo, filelist=filelist) |
|
684 | 684 | return result |
|
685 | 685 | |
|
686 | 686 | def hgmerge(orig, repo, node, force=None, remind=True): |
|
687 | 687 | # Mark the repo as being in the middle of a merge, so that |
|
688 | 688 | # updatelfiles() will know that it needs to trust the standins in |
|
689 | 689 | # the working copy, not in the standins in the current node |
|
690 | 690 | repo._ismerging = True |
|
691 | 691 | try: |
|
692 | 692 | result = orig(repo, node, force, remind) |
|
693 | 693 | lfcommands.updatelfiles(repo.ui, repo) |
|
694 | 694 | finally: |
|
695 | 695 | repo._ismerging = False |
|
696 | 696 | return result |
|
697 | 697 | |
|
698 | 698 | # When we rebase a repository with remotely changed largefiles, we need to |
|
699 | 699 | # take some extra care so that the largefiles are correctly updated in the |
|
700 | 700 | # working copy |
|
701 | 701 | def overridepull(orig, ui, repo, source=None, **opts): |
|
702 | 702 | revsprepull = len(repo) |
|
703 | 703 | if opts.get('rebase', False): |
|
704 | 704 | repo._isrebasing = True |
|
705 | 705 | try: |
|
706 | 706 | if opts.get('update'): |
|
707 | 707 | del opts['update'] |
|
708 | 708 | ui.debug('--update and --rebase are not compatible, ignoring ' |
|
709 | 709 | 'the update flag\n') |
|
710 | 710 | del opts['rebase'] |
|
711 | 711 | cmdutil.bailifchanged(repo) |
|
712 | 712 | origpostincoming = commands.postincoming |
|
713 | 713 | def _dummy(*args, **kwargs): |
|
714 | 714 | pass |
|
715 | 715 | commands.postincoming = _dummy |
|
716 | 716 | if not source: |
|
717 | 717 | source = 'default' |
|
718 | 718 | repo.lfpullsource = source |
|
719 | 719 | try: |
|
720 | 720 | result = commands.pull(ui, repo, source, **opts) |
|
721 | 721 | finally: |
|
722 | 722 | commands.postincoming = origpostincoming |
|
723 | 723 | revspostpull = len(repo) |
|
724 | 724 | if revspostpull > revsprepull: |
|
725 | 725 | result = result or rebase.rebase(ui, repo) |
|
726 | 726 | finally: |
|
727 | 727 | repo._isrebasing = False |
|
728 | 728 | else: |
|
729 | 729 | if not source: |
|
730 | 730 | source = 'default' |
|
731 | 731 | repo.lfpullsource = source |
|
732 | 732 | oldheads = lfutil.getcurrentheads(repo) |
|
733 | 733 | result = orig(ui, repo, source, **opts) |
|
734 | 734 | # If we do not have the new largefiles for any new heads we pulled, we |
|
735 | 735 | # will run into a problem later if we try to merge or rebase with one of |
|
736 | 736 | # these heads, so cache the largefiles now directly into the system |
|
737 | 737 | # cache. |
|
738 | 738 | ui.status(_("caching new largefiles\n")) |
|
739 | 739 | numcached = 0 |
|
740 | 740 | heads = lfutil.getcurrentheads(repo) |
|
741 | 741 | newheads = set(heads).difference(set(oldheads)) |
|
742 | 742 | for head in newheads: |
|
743 | 743 | (cached, missing) = lfcommands.cachelfiles(ui, repo, head) |
|
744 | 744 | numcached += len(cached) |
|
745 | 745 | ui.status(_("%d largefiles cached\n") % numcached) |
|
746 | 746 | if opts.get('all_largefiles'): |
|
747 | 747 | revspostpull = len(repo) |
|
748 | 748 | revs = [] |
|
749 | 749 | for rev in xrange(revsprepull + 1, revspostpull): |
|
750 | 750 | revs.append(repo[rev].rev()) |
|
751 | 751 | lfcommands.downloadlfiles(ui, repo, revs) |
|
752 | 752 | return result |
|
753 | 753 | |
|
754 | 754 | def overrideclone(orig, ui, source, dest=None, **opts): |
|
755 | 755 | d = dest |
|
756 | 756 | if d is None: |
|
757 | 757 | d = hg.defaultdest(source) |
|
758 | 758 | if opts.get('all_largefiles') and not hg.islocal(d): |
|
759 | 759 | raise util.Abort(_( |
|
760 | 760 | '--all-largefiles is incompatible with non-local destination %s' % |
|
761 | 761 | d)) |
|
762 | 762 | |
|
763 | 763 | return orig(ui, source, dest, **opts) |
|
764 | 764 | |
|
765 | 765 | def hgclone(orig, ui, opts, *args, **kwargs): |
|
766 | 766 | result = orig(ui, opts, *args, **kwargs) |
|
767 | 767 | |
|
768 | 768 | if result is not None: |
|
769 | 769 | sourcerepo, destrepo = result |
|
770 | 770 | repo = destrepo.local() |
|
771 | 771 | |
|
772 | 772 | # The .hglf directory must exist for the standin matcher to match |
|
773 | 773 | # anything (which listlfiles uses for each rev), and .hg/largefiles is |
|
774 | 774 | # assumed to exist by the code that caches the downloaded file. These |
|
775 | 775 | # directories exist if clone updated to any rev. (If the repo does not |
|
776 | 776 | # have largefiles, download never gets to the point of needing |
|
777 | 777 | # .hg/largefiles, and the standin matcher won't match anything anyway.) |
|
778 | 778 | if 'largefiles' in repo.requirements: |
|
779 | 779 | if opts.get('noupdate'): |
|
780 | 780 | util.makedirs(repo.wjoin(lfutil.shortname)) |
|
781 | 781 | util.makedirs(repo.join(lfutil.longname)) |
|
782 | 782 | |
|
783 | 783 | # Caching is implicitly limited to 'rev' option, since the dest repo was |
|
784 | 784 | # truncated at that point. The user may expect a download count with |
|
785 | 785 | # this option, so attempt whether or not this is a largefile repo. |
|
786 | 786 | if opts.get('all_largefiles'): |
|
787 | 787 | success, missing = lfcommands.downloadlfiles(ui, repo, None) |
|
788 | 788 | |
|
789 | 789 | if missing != 0: |
|
790 | 790 | return None |
|
791 | 791 | |
|
792 | 792 | return result |
|
793 | 793 | |
|
794 | 794 | def overriderebase(orig, ui, repo, **opts): |
|
795 | 795 | repo._isrebasing = True |
|
796 | 796 | try: |
|
797 | 797 | return orig(ui, repo, **opts) |
|
798 | 798 | finally: |
|
799 | 799 | repo._isrebasing = False |
|
800 | 800 | |
|
801 | 801 | def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None, |
|
802 | 802 | prefix=None, mtime=None, subrepos=None): |
|
803 | 803 | # No need to lock because we are only reading history and |
|
804 | 804 | # largefile caches, neither of which are modified. |
|
805 | 805 | lfcommands.cachelfiles(repo.ui, repo, node) |
|
806 | 806 | |
|
807 | 807 | if kind not in archival.archivers: |
|
808 | 808 | raise util.Abort(_("unknown archive type '%s'") % kind) |
|
809 | 809 | |
|
810 | 810 | ctx = repo[node] |
|
811 | 811 | |
|
812 | 812 | if kind == 'files': |
|
813 | 813 | if prefix: |
|
814 | 814 | raise util.Abort( |
|
815 | 815 | _('cannot give prefix when archiving to files')) |
|
816 | 816 | else: |
|
817 | 817 | prefix = archival.tidyprefix(dest, kind, prefix) |
|
818 | 818 | |
|
819 | 819 | def write(name, mode, islink, getdata): |
|
820 | 820 | if matchfn and not matchfn(name): |
|
821 | 821 | return |
|
822 | 822 | data = getdata() |
|
823 | 823 | if decode: |
|
824 | 824 | data = repo.wwritedata(name, data) |
|
825 | 825 | archiver.addfile(prefix + name, mode, islink, data) |
|
826 | 826 | |
|
827 | 827 | archiver = archival.archivers[kind](dest, mtime or ctx.date()[0]) |
|
828 | 828 | |
|
829 | 829 | if repo.ui.configbool("ui", "archivemeta", True): |
|
830 | 830 | def metadata(): |
|
831 | 831 | base = 'repo: %s\nnode: %s\nbranch: %s\n' % ( |
|
832 | 832 | hex(repo.changelog.node(0)), hex(node), ctx.branch()) |
|
833 | 833 | |
|
834 | 834 | tags = ''.join('tag: %s\n' % t for t in ctx.tags() |
|
835 | 835 | if repo.tagtype(t) == 'global') |
|
836 | 836 | if not tags: |
|
837 | 837 | repo.ui.pushbuffer() |
|
838 | 838 | opts = {'template': '{latesttag}\n{latesttagdistance}', |
|
839 | 839 | 'style': '', 'patch': None, 'git': None} |
|
840 | 840 | cmdutil.show_changeset(repo.ui, repo, opts).show(ctx) |
|
841 | 841 | ltags, dist = repo.ui.popbuffer().split('\n') |
|
842 | 842 | tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':')) |
|
843 | 843 | tags += 'latesttagdistance: %s\n' % dist |
|
844 | 844 | |
|
845 | 845 | return base + tags |
|
846 | 846 | |
|
847 | 847 | write('.hg_archival.txt', 0644, False, metadata) |
|
848 | 848 | |
|
849 | 849 | for f in ctx: |
|
850 | 850 | ff = ctx.flags(f) |
|
851 | 851 | getdata = ctx[f].data |
|
852 | 852 | if lfutil.isstandin(f): |
|
853 | 853 | path = lfutil.findfile(repo, getdata().strip()) |
|
854 | 854 | if path is None: |
|
855 | 855 | raise util.Abort( |
|
856 | 856 | _('largefile %s not found in repo store or system cache') |
|
857 | 857 | % lfutil.splitstandin(f)) |
|
858 | 858 | f = lfutil.splitstandin(f) |
|
859 | 859 | |
|
860 | 860 | def getdatafn(): |
|
861 | 861 | fd = None |
|
862 | 862 | try: |
|
863 | 863 | fd = open(path, 'rb') |
|
864 | 864 | return fd.read() |
|
865 | 865 | finally: |
|
866 | 866 | if fd: |
|
867 | 867 | fd.close() |
|
868 | 868 | |
|
869 | 869 | getdata = getdatafn |
|
870 | 870 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata) |
|
871 | 871 | |
|
872 | 872 | if subrepos: |
|
873 | 873 | for subpath in sorted(ctx.substate): |
|
874 | 874 | sub = ctx.sub(subpath) |
|
875 | 875 | submatch = match_.narrowmatcher(subpath, matchfn) |
|
876 | 876 | sub.archive(repo.ui, archiver, prefix, submatch) |
|
877 | 877 | |
|
878 | 878 | archiver.done() |
|
879 | 879 | |
|
880 | 880 | def hgsubrepoarchive(orig, repo, ui, archiver, prefix, match=None): |
|
881 | 881 | repo._get(repo._state + ('hg',)) |
|
882 | 882 | rev = repo._state[1] |
|
883 | 883 | ctx = repo._repo[rev] |
|
884 | 884 | |
|
885 | 885 | lfcommands.cachelfiles(ui, repo._repo, ctx.node()) |
|
886 | 886 | |
|
887 | 887 | def write(name, mode, islink, getdata): |
|
888 | 888 | # At this point, the standin has been replaced with the largefile name, |
|
889 | 889 | # so the normal matcher works here without the lfutil variants. |
|
890 | 890 | if match and not match(f): |
|
891 | 891 | return |
|
892 | 892 | data = getdata() |
|
893 | 893 | |
|
894 | 894 | archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data) |
|
895 | 895 | |
|
896 | 896 | for f in ctx: |
|
897 | 897 | ff = ctx.flags(f) |
|
898 | 898 | getdata = ctx[f].data |
|
899 | 899 | if lfutil.isstandin(f): |
|
900 | 900 | path = lfutil.findfile(repo._repo, getdata().strip()) |
|
901 | 901 | if path is None: |
|
902 | 902 | raise util.Abort( |
|
903 | 903 | _('largefile %s not found in repo store or system cache') |
|
904 | 904 | % lfutil.splitstandin(f)) |
|
905 | 905 | f = lfutil.splitstandin(f) |
|
906 | 906 | |
|
907 | 907 | def getdatafn(): |
|
908 | 908 | fd = None |
|
909 | 909 | try: |
|
910 | 910 | fd = open(os.path.join(prefix, path), 'rb') |
|
911 | 911 | return fd.read() |
|
912 | 912 | finally: |
|
913 | 913 | if fd: |
|
914 | 914 | fd.close() |
|
915 | 915 | |
|
916 | 916 | getdata = getdatafn |
|
917 | 917 | |
|
918 | 918 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata) |
|
919 | 919 | |
|
920 | 920 | for subpath in sorted(ctx.substate): |
|
921 | 921 | sub = ctx.sub(subpath) |
|
922 | 922 | submatch = match_.narrowmatcher(subpath, match) |
|
923 | 923 | sub.archive(ui, archiver, os.path.join(prefix, repo._path) + '/', |
|
924 | 924 | submatch) |
|
925 | 925 | |
|
926 | 926 | # If a largefile is modified, the change is not reflected in its |
|
927 | 927 | # standin until a commit. cmdutil.bailifchanged() raises an exception |
|
928 | 928 | # if the repo has uncommitted changes. Wrap it to also check if |
|
929 | 929 | # largefiles were changed. This is used by bisect and backout. |
|
930 | 930 | def overridebailifchanged(orig, repo): |
|
931 | 931 | orig(repo) |
|
932 | 932 | repo.lfstatus = True |
|
933 | 933 | modified, added, removed, deleted = repo.status()[:4] |
|
934 | 934 | repo.lfstatus = False |
|
935 | 935 | if modified or added or removed or deleted: |
|
936 | 936 | raise util.Abort(_('outstanding uncommitted changes')) |
|
937 | 937 | |
|
938 | 938 | # Fetch doesn't use cmdutil.bailifchanged so override it to add the check |
|
939 | 939 | def overridefetch(orig, ui, repo, *pats, **opts): |
|
940 | 940 | repo.lfstatus = True |
|
941 | 941 | modified, added, removed, deleted = repo.status()[:4] |
|
942 | 942 | repo.lfstatus = False |
|
943 | 943 | if modified or added or removed or deleted: |
|
944 | 944 | raise util.Abort(_('outstanding uncommitted changes')) |
|
945 | 945 | return orig(ui, repo, *pats, **opts) |
|
946 | 946 | |
|
947 | 947 | def overrideforget(orig, ui, repo, *pats, **opts): |
|
948 | 948 | installnormalfilesmatchfn(repo[None].manifest()) |
|
949 | 949 | result = orig(ui, repo, *pats, **opts) |
|
950 | 950 | restorematchfn() |
|
951 | 951 | m = scmutil.match(repo[None], pats, opts) |
|
952 | 952 | |
|
953 | 953 | try: |
|
954 | 954 | repo.lfstatus = True |
|
955 | 955 | s = repo.status(match=m, clean=True) |
|
956 | 956 | finally: |
|
957 | 957 | repo.lfstatus = False |
|
958 | 958 | forget = sorted(s[0] + s[1] + s[3] + s[6]) |
|
959 | 959 | forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()] |
|
960 | 960 | |
|
961 | 961 | for f in forget: |
|
962 | 962 | if lfutil.standin(f) not in repo.dirstate and not \ |
|
963 | 963 | os.path.isdir(m.rel(lfutil.standin(f))): |
|
964 | 964 | ui.warn(_('not removing %s: file is already untracked\n') |
|
965 | 965 | % m.rel(f)) |
|
966 | 966 | result = 1 |
|
967 | 967 | |
|
968 | 968 | for f in forget: |
|
969 | 969 | if ui.verbose or not m.exact(f): |
|
970 | 970 | ui.status(_('removing %s\n') % m.rel(f)) |
|
971 | 971 | |
|
972 | 972 | # Need to lock because standin files are deleted then removed from the |
|
973 | 973 | # repository and we could race in-between. |
|
974 | 974 | wlock = repo.wlock() |
|
975 | 975 | try: |
|
976 | 976 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
977 | 977 | for f in forget: |
|
978 | 978 | if lfdirstate[f] == 'a': |
|
979 | 979 | lfdirstate.drop(f) |
|
980 | 980 | else: |
|
981 | 981 | lfdirstate.remove(f) |
|
982 | 982 | lfdirstate.write() |
|
983 | 983 | standins = [lfutil.standin(f) for f in forget] |
|
984 | 984 | for f in standins: |
|
985 | 985 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
|
986 | 986 | repo[None].forget(standins) |
|
987 | 987 | finally: |
|
988 | 988 | wlock.release() |
|
989 | 989 | |
|
990 | 990 | return result |
|
991 | 991 | |
|
992 | 992 | def getoutgoinglfiles(ui, repo, dest=None, **opts): |
|
993 | 993 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
994 | 994 | dest, branches = hg.parseurl(dest, opts.get('branch')) |
|
995 | 995 | revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) |
|
996 | 996 | if revs: |
|
997 | 997 | revs = [repo.lookup(rev) for rev in scmutil.revrange(repo, revs)] |
|
998 | 998 | |
|
999 | 999 | try: |
|
1000 | 1000 | remote = hg.peer(repo, opts, dest) |
|
1001 | 1001 | except error.RepoError: |
|
1002 | 1002 | return None |
|
1003 | 1003 | outgoing = discovery.findcommonoutgoing(repo, remote.peer(), force=False) |
|
1004 | 1004 | if not outgoing.missing: |
|
1005 | 1005 | return outgoing.missing |
|
1006 | 1006 | o = repo.changelog.nodesbetween(outgoing.missing, revs)[0] |
|
1007 | 1007 | if opts.get('newest_first'): |
|
1008 | 1008 | o.reverse() |
|
1009 | 1009 | |
|
1010 | 1010 | toupload = set() |
|
1011 | 1011 | for n in o: |
|
1012 | 1012 | parents = [p for p in repo.changelog.parents(n) if p != node.nullid] |
|
1013 | 1013 | ctx = repo[n] |
|
1014 | 1014 | files = set(ctx.files()) |
|
1015 | 1015 | if len(parents) == 2: |
|
1016 | 1016 | mc = ctx.manifest() |
|
1017 | 1017 | mp1 = ctx.parents()[0].manifest() |
|
1018 | 1018 | mp2 = ctx.parents()[1].manifest() |
|
1019 | 1019 | for f in mp1: |
|
1020 | 1020 | if f not in mc: |
|
1021 | 1021 | files.add(f) |
|
1022 | 1022 | for f in mp2: |
|
1023 | 1023 | if f not in mc: |
|
1024 | 1024 | files.add(f) |
|
1025 | 1025 | for f in mc: |
|
1026 | 1026 | if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None): |
|
1027 | 1027 | files.add(f) |
|
1028 | 1028 | toupload = toupload.union( |
|
1029 | 1029 | set([f for f in files if lfutil.isstandin(f) and f in ctx])) |
|
1030 | 1030 | return sorted(toupload) |
|
1031 | 1031 | |
|
1032 | 1032 | def overrideoutgoing(orig, ui, repo, dest=None, **opts): |
|
1033 | 1033 | result = orig(ui, repo, dest, **opts) |
|
1034 | 1034 | |
|
1035 | 1035 | if opts.pop('large', None): |
|
1036 | 1036 | toupload = getoutgoinglfiles(ui, repo, dest, **opts) |
|
1037 | 1037 | if toupload is None: |
|
1038 | 1038 | ui.status(_('largefiles: No remote repo\n')) |
|
1039 | 1039 | elif not toupload: |
|
1040 | 1040 | ui.status(_('largefiles: no files to upload\n')) |
|
1041 | 1041 | else: |
|
1042 | 1042 | ui.status(_('largefiles to upload:\n')) |
|
1043 | 1043 | for file in toupload: |
|
1044 | 1044 | ui.status(lfutil.splitstandin(file) + '\n') |
|
1045 | 1045 | ui.status('\n') |
|
1046 | 1046 | |
|
1047 | 1047 | return result |
|
1048 | 1048 | |
|
1049 | 1049 | def overridesummary(orig, ui, repo, *pats, **opts): |
|
1050 | 1050 | try: |
|
1051 | 1051 | repo.lfstatus = True |
|
1052 | 1052 | orig(ui, repo, *pats, **opts) |
|
1053 | 1053 | finally: |
|
1054 | 1054 | repo.lfstatus = False |
|
1055 | 1055 | |
|
1056 | 1056 | if opts.pop('large', None): |
|
1057 | 1057 | toupload = getoutgoinglfiles(ui, repo, None, **opts) |
|
1058 | 1058 | if toupload is None: |
|
1059 | 1059 | # i18n: column positioning for "hg summary" |
|
1060 | 1060 | ui.status(_('largefiles: (no remote repo)\n')) |
|
1061 | 1061 | elif not toupload: |
|
1062 | 1062 | # i18n: column positioning for "hg summary" |
|
1063 | 1063 | ui.status(_('largefiles: (no files to upload)\n')) |
|
1064 | 1064 | else: |
|
1065 | 1065 | # i18n: column positioning for "hg summary" |
|
1066 | 1066 | ui.status(_('largefiles: %d to upload\n') % len(toupload)) |
|
1067 | 1067 | |
|
1068 | 1068 | def scmutiladdremove(orig, repo, pats=[], opts={}, dry_run=None, |
|
1069 | 1069 | similarity=None): |
|
1070 | 1070 | if not lfutil.islfilesrepo(repo): |
|
1071 | 1071 | return orig(repo, pats, opts, dry_run, similarity) |
|
1072 | 1072 | # Get the list of missing largefiles so we can remove them |
|
1073 | 1073 | lfdirstate = lfutil.openlfdirstate(repo.ui, repo) |
|
1074 | 1074 | s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False, |
|
1075 | 1075 | False, False) |
|
1076 | 1076 | (unsure, modified, added, removed, missing, unknown, ignored, clean) = s |
|
1077 | 1077 | |
|
1078 | 1078 | # Call into the normal remove code, but the removing of the standin, we want |
|
1079 | 1079 | # to have handled by original addremove. Monkey patching here makes sure |
|
1080 | 1080 | # we don't remove the standin in the largefiles code, preventing a very |
|
1081 | 1081 | # confused state later. |
|
1082 | 1082 | if missing: |
|
1083 | 1083 | m = [repo.wjoin(f) for f in missing] |
|
1084 | 1084 | repo._isaddremove = True |
|
1085 | 1085 | removelargefiles(repo.ui, repo, *m, **opts) |
|
1086 | 1086 | repo._isaddremove = False |
|
1087 | 1087 | # Call into the normal add code, and any files that *should* be added as |
|
1088 | 1088 | # largefiles will be |
|
1089 | 1089 | addlargefiles(repo.ui, repo, *pats, **opts) |
|
1090 | 1090 | # Now that we've handled largefiles, hand off to the original addremove |
|
1091 | 1091 | # function to take care of the rest. Make sure it doesn't do anything with |
|
1092 | 1092 | # largefiles by installing a matcher that will ignore them. |
|
1093 | 1093 | installnormalfilesmatchfn(repo[None].manifest()) |
|
1094 | 1094 | result = orig(repo, pats, opts, dry_run, similarity) |
|
1095 | 1095 | restorematchfn() |
|
1096 | 1096 | return result |
|
1097 | 1097 | |
|
1098 | 1098 | # Calling purge with --all will cause the largefiles to be deleted. |
|
1099 | 1099 | # Override repo.status to prevent this from happening. |
|
1100 | 1100 | def overridepurge(orig, ui, repo, *dirs, **opts): |
|
1101 | 1101 | # XXX large file status is buggy when used on repo proxy. |
|
1102 | 1102 | # XXX this needs to be investigate. |
|
1103 | 1103 | repo = repo.unfiltered() |
|
1104 | 1104 | oldstatus = repo.status |
|
1105 | 1105 | def overridestatus(node1='.', node2=None, match=None, ignored=False, |
|
1106 | 1106 | clean=False, unknown=False, listsubrepos=False): |
|
1107 | 1107 | r = oldstatus(node1, node2, match, ignored, clean, unknown, |
|
1108 | 1108 | listsubrepos) |
|
1109 | 1109 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
1110 | 1110 | modified, added, removed, deleted, unknown, ignored, clean = r |
|
1111 | 1111 | unknown = [f for f in unknown if lfdirstate[f] == '?'] |
|
1112 | 1112 | ignored = [f for f in ignored if lfdirstate[f] == '?'] |
|
1113 | 1113 | return modified, added, removed, deleted, unknown, ignored, clean |
|
1114 | 1114 | repo.status = overridestatus |
|
1115 | 1115 | orig(ui, repo, *dirs, **opts) |
|
1116 | 1116 | repo.status = oldstatus |
|
1117 | 1117 | |
|
1118 | 1118 | def overriderollback(orig, ui, repo, **opts): |
|
1119 | 1119 | result = orig(ui, repo, **opts) |
|
1120 | 1120 | merge.update(repo, node=None, branchmerge=False, force=True, |
|
1121 | 1121 | partial=lfutil.isstandin) |
|
1122 | 1122 | wlock = repo.wlock() |
|
1123 | 1123 | try: |
|
1124 | 1124 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
1125 | 1125 | lfiles = lfutil.listlfiles(repo) |
|
1126 | 1126 | oldlfiles = lfutil.listlfiles(repo, repo[None].parents()[0].rev()) |
|
1127 | 1127 | for file in lfiles: |
|
1128 | 1128 | if file in oldlfiles: |
|
1129 | 1129 | lfdirstate.normallookup(file) |
|
1130 | 1130 | else: |
|
1131 | 1131 | lfdirstate.add(file) |
|
1132 | 1132 | lfdirstate.write() |
|
1133 | 1133 | finally: |
|
1134 | 1134 | wlock.release() |
|
1135 | 1135 | return result |
|
1136 | 1136 | |
|
1137 | 1137 | def overridetransplant(orig, ui, repo, *revs, **opts): |
|
1138 | 1138 | try: |
|
1139 | 1139 | oldstandins = lfutil.getstandinsstate(repo) |
|
1140 | 1140 | repo._istransplanting = True |
|
1141 | 1141 | result = orig(ui, repo, *revs, **opts) |
|
1142 | 1142 | newstandins = lfutil.getstandinsstate(repo) |
|
1143 | 1143 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) |
|
1144 | 1144 | lfcommands.updatelfiles(repo.ui, repo, filelist=filelist, |
|
1145 | 1145 | printmessage=True) |
|
1146 | 1146 | finally: |
|
1147 | 1147 | repo._istransplanting = False |
|
1148 | 1148 | return result |
|
1149 | 1149 | |
|
1150 | 1150 | def overridecat(orig, ui, repo, file1, *pats, **opts): |
|
1151 | 1151 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
1152 | 1152 | err = 1 |
|
1153 | 1153 | notbad = set() |
|
1154 | 1154 | m = scmutil.match(ctx, (file1,) + pats, opts) |
|
1155 | 1155 | origmatchfn = m.matchfn |
|
1156 | 1156 | def lfmatchfn(f): |
|
1157 | 1157 | lf = lfutil.splitstandin(f) |
|
1158 | 1158 | if lf is None: |
|
1159 | 1159 | return origmatchfn(f) |
|
1160 | 1160 | notbad.add(lf) |
|
1161 | 1161 | return origmatchfn(lf) |
|
1162 | 1162 | m.matchfn = lfmatchfn |
|
1163 | 1163 | m.bad = lambda f, msg: f not in notbad |
|
1164 | 1164 | for f in ctx.walk(m): |
|
1165 | 1165 | lf = lfutil.splitstandin(f) |
|
1166 | 1166 | if lf is None: |
|
1167 | 1167 | err = orig(ui, repo, f, **opts) |
|
1168 | 1168 | else: |
|
1169 | 1169 | err = lfcommands.catlfile(repo, lf, ctx.rev(), opts.get('output')) |
|
1170 | 1170 | return err |
|
1171 | 1171 | |
|
1172 | 1172 | def mercurialsinkbefore(orig, sink): |
|
1173 | 1173 | sink.repo._isconverting = True |
|
1174 | 1174 | orig(sink) |
|
1175 | 1175 | |
|
1176 | 1176 | def mercurialsinkafter(orig, sink): |
|
1177 | 1177 | sink.repo._isconverting = False |
|
1178 | 1178 | orig(sink) |
@@ -1,649 +1,649 b'' | |||
|
1 | 1 | # merge.py - directory-level update/merge handling 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, hex, bin |
|
9 | 9 | from i18n import _ |
|
10 | 10 | import error, util, filemerge, copies, subrepo |
|
11 | 11 | import errno, os, shutil |
|
12 | 12 | |
|
13 | 13 | class mergestate(object): |
|
14 | 14 | '''track 3-way merge state of individual files''' |
|
15 | 15 | def __init__(self, repo): |
|
16 | 16 | self._repo = repo |
|
17 | 17 | self._dirty = False |
|
18 | 18 | self._read() |
|
19 | 19 | def reset(self, node=None): |
|
20 | 20 | self._state = {} |
|
21 | 21 | if node: |
|
22 | 22 | self._local = node |
|
23 | 23 | shutil.rmtree(self._repo.join("merge"), True) |
|
24 | 24 | self._dirty = False |
|
25 | 25 | def _read(self): |
|
26 | 26 | self._state = {} |
|
27 | 27 | try: |
|
28 | 28 | f = self._repo.opener("merge/state") |
|
29 | 29 | for i, l in enumerate(f): |
|
30 | 30 | if i == 0: |
|
31 | 31 | self._local = bin(l[:-1]) |
|
32 | 32 | else: |
|
33 | 33 | bits = l[:-1].split("\0") |
|
34 | 34 | self._state[bits[0]] = bits[1:] |
|
35 | 35 | f.close() |
|
36 | 36 | except IOError, err: |
|
37 | 37 | if err.errno != errno.ENOENT: |
|
38 | 38 | raise |
|
39 | 39 | self._dirty = False |
|
40 | 40 | def commit(self): |
|
41 | 41 | if self._dirty: |
|
42 | 42 | f = self._repo.opener("merge/state", "w") |
|
43 | 43 | f.write(hex(self._local) + "\n") |
|
44 | 44 | for d, v in self._state.iteritems(): |
|
45 | 45 | f.write("\0".join([d] + v) + "\n") |
|
46 | 46 | f.close() |
|
47 | 47 | self._dirty = False |
|
48 | 48 | def add(self, fcl, fco, fca, fd): |
|
49 | 49 | hash = util.sha1(fcl.path()).hexdigest() |
|
50 | 50 | self._repo.opener.write("merge/" + hash, fcl.data()) |
|
51 | 51 | self._state[fd] = ['u', hash, fcl.path(), fca.path(), |
|
52 | 52 | hex(fca.filenode()), fco.path(), fcl.flags()] |
|
53 | 53 | self._dirty = True |
|
54 | 54 | def __contains__(self, dfile): |
|
55 | 55 | return dfile in self._state |
|
56 | 56 | def __getitem__(self, dfile): |
|
57 | 57 | return self._state[dfile][0] |
|
58 | 58 | def __iter__(self): |
|
59 | 59 | l = self._state.keys() |
|
60 | 60 | l.sort() |
|
61 | 61 | for f in l: |
|
62 | 62 | yield f |
|
63 | 63 | def mark(self, dfile, state): |
|
64 | 64 | self._state[dfile][0] = state |
|
65 | 65 | self._dirty = True |
|
66 | 66 | def resolve(self, dfile, wctx, octx): |
|
67 | 67 | if self[dfile] == 'r': |
|
68 | 68 | return 0 |
|
69 | 69 | state, hash, lfile, afile, anode, ofile, flags = self._state[dfile] |
|
70 | 70 | fcd = wctx[dfile] |
|
71 | 71 | fco = octx[ofile] |
|
72 | 72 | fca = self._repo.filectx(afile, fileid=anode) |
|
73 | 73 | # "premerge" x flags |
|
74 | 74 | flo = fco.flags() |
|
75 | 75 | fla = fca.flags() |
|
76 | 76 | if 'x' in flags + flo + fla and 'l' not in flags + flo + fla: |
|
77 | 77 | if fca.node() == nullid: |
|
78 | 78 | self._repo.ui.warn(_('warning: cannot merge flags for %s\n') % |
|
79 | 79 | afile) |
|
80 | 80 | elif flags == fla: |
|
81 | 81 | flags = flo |
|
82 | 82 | # restore local |
|
83 | 83 | f = self._repo.opener("merge/" + hash) |
|
84 | 84 | self._repo.wwrite(dfile, f.read(), flags) |
|
85 | 85 | f.close() |
|
86 | 86 | r = filemerge.filemerge(self._repo, self._local, lfile, fcd, fco, fca) |
|
87 | 87 | if r is None: |
|
88 | 88 | # no real conflict |
|
89 | 89 | del self._state[dfile] |
|
90 | 90 | elif not r: |
|
91 | 91 | self.mark(dfile, 'r') |
|
92 | 92 | return r |
|
93 | 93 | |
|
94 | 94 | def _checkunknownfile(repo, wctx, mctx, f): |
|
95 | 95 | return (not repo.dirstate._ignore(f) |
|
96 | 96 | and os.path.isfile(repo.wjoin(f)) |
|
97 | 97 | and repo.dirstate.normalize(f) not in repo.dirstate |
|
98 | 98 | and mctx[f].cmp(wctx[f])) |
|
99 | 99 | |
|
100 | 100 | def _checkunknown(repo, wctx, mctx): |
|
101 | 101 | "check for collisions between unknown files and files in mctx" |
|
102 | 102 | |
|
103 | 103 | error = False |
|
104 | 104 | for f in mctx: |
|
105 | 105 | if f not in wctx and _checkunknownfile(repo, wctx, mctx, f): |
|
106 | 106 | error = True |
|
107 | 107 | wctx._repo.ui.warn(_("%s: untracked file differs\n") % f) |
|
108 | 108 | if error: |
|
109 | 109 | raise util.Abort(_("untracked files in working directory differ " |
|
110 | 110 | "from files in requested revision")) |
|
111 | 111 | |
|
112 | 112 | def _remains(f, m, ma, workingctx=False): |
|
113 | 113 | """check whether specified file remains after merge. |
|
114 | 114 | |
|
115 | 115 | It is assumed that specified file is not contained in the manifest |
|
116 | 116 | of the other context. |
|
117 | 117 | """ |
|
118 | 118 | if f in ma: |
|
119 | 119 | n = m[f] |
|
120 | 120 | if n != ma[f]: |
|
121 | 121 | return True # because it is changed locally |
|
122 | 122 | # even though it doesn't remain, if "remote deleted" is |
|
123 | 123 | # chosen in manifestmerge() |
|
124 | 124 | elif workingctx and n[20:] == "a": |
|
125 | 125 | return True # because it is added locally (linear merge specific) |
|
126 | 126 | else: |
|
127 | 127 | return False # because it is removed remotely |
|
128 | 128 | else: |
|
129 | 129 | return True # because it is added locally |
|
130 | 130 | |
|
131 | 131 | def _checkcollision(mctx, extractxs): |
|
132 | 132 | "check for case folding collisions in the destination context" |
|
133 | 133 | folded = {} |
|
134 | 134 | for fn in mctx: |
|
135 | 135 | fold = util.normcase(fn) |
|
136 | 136 | if fold in folded: |
|
137 | 137 | raise util.Abort(_("case-folding collision between %s and %s") |
|
138 | 138 | % (fn, folded[fold])) |
|
139 | 139 | folded[fold] = fn |
|
140 | 140 | |
|
141 | 141 | if extractxs: |
|
142 | 142 | wctx, actx = extractxs |
|
143 | 143 | # class to delay looking up copy mapping |
|
144 | 144 | class pathcopies(object): |
|
145 | 145 | @util.propertycache |
|
146 | 146 | def map(self): |
|
147 | 147 | # {dst@mctx: src@wctx} copy mapping |
|
148 | 148 | return copies.pathcopies(wctx, mctx) |
|
149 | 149 | pc = pathcopies() |
|
150 | 150 | |
|
151 | 151 | for fn in wctx: |
|
152 | 152 | fold = util.normcase(fn) |
|
153 | 153 | mfn = folded.get(fold, None) |
|
154 | 154 | if (mfn and mfn != fn and pc.map.get(mfn) != fn and |
|
155 | 155 | _remains(fn, wctx.manifest(), actx.manifest(), True) and |
|
156 | 156 | _remains(mfn, mctx.manifest(), actx.manifest())): |
|
157 | 157 | raise util.Abort(_("case-folding collision between %s and %s") |
|
158 | 158 | % (mfn, fn)) |
|
159 | 159 | |
|
160 | 160 | def _forgetremoved(wctx, mctx, branchmerge): |
|
161 | 161 | """ |
|
162 | 162 | Forget removed files |
|
163 | 163 | |
|
164 | 164 | If we're jumping between revisions (as opposed to merging), and if |
|
165 | 165 | neither the working directory nor the target rev has the file, |
|
166 | 166 | then we need to remove it from the dirstate, to prevent the |
|
167 | 167 | dirstate from listing the file when it is no longer in the |
|
168 | 168 | manifest. |
|
169 | 169 | |
|
170 | 170 | If we're merging, and the other revision has removed a file |
|
171 | 171 | that is not present in the working directory, we need to mark it |
|
172 | 172 | as removed. |
|
173 | 173 | """ |
|
174 | 174 | |
|
175 | 175 | actions = [] |
|
176 | 176 | state = branchmerge and 'r' or 'f' |
|
177 | 177 | for f in wctx.deleted(): |
|
178 | 178 | if f not in mctx: |
|
179 | actions.append((f, state, None)) | |
|
179 | actions.append((f, state, None, "forget deleted")) | |
|
180 | 180 | |
|
181 | 181 | if not branchmerge: |
|
182 | 182 | for f in wctx.removed(): |
|
183 | 183 | if f not in mctx: |
|
184 | actions.append((f, "f", None)) | |
|
184 | actions.append((f, "f", None, "forget removed")) | |
|
185 | 185 | |
|
186 | 186 | return actions |
|
187 | 187 | |
|
188 | 188 | def manifestmerge(repo, p1, p2, pa, overwrite, partial): |
|
189 | 189 | """ |
|
190 | 190 | Merge p1 and p2 with ancestor pa and generate merge action list |
|
191 | 191 | |
|
192 | 192 | overwrite = whether we clobber working files |
|
193 | 193 | partial = function to filter file lists |
|
194 | 194 | """ |
|
195 | 195 | |
|
196 | 196 | def act(msg, m, f, *args): |
|
197 | repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m)) | |
|
198 | actions.append((f, m, args)) | |
|
197 | actions.append((f, m, args, msg)) | |
|
199 | 198 | |
|
200 | 199 | actions, copy, movewithdir = [], {}, {} |
|
201 | 200 | |
|
202 | 201 | if overwrite: |
|
203 | 202 | pa = p1 |
|
204 | 203 | elif pa == p2: # backwards |
|
205 | 204 | pa = p1.p1() |
|
206 | 205 | elif pa and repo.ui.configbool("merge", "followcopies", True): |
|
207 | 206 | ret = copies.mergecopies(repo, p1, p2, pa) |
|
208 | 207 | copy, movewithdir, diverge, renamedelete = ret |
|
209 | 208 | for of, fl in diverge.iteritems(): |
|
210 | 209 | act("divergent renames", "dr", of, fl) |
|
211 | 210 | for of, fl in renamedelete.iteritems(): |
|
212 | 211 | act("rename and delete", "rd", of, fl) |
|
213 | 212 | |
|
214 | 213 | repo.ui.note(_("resolving manifests\n")) |
|
215 | 214 | repo.ui.debug(" overwrite: %s, partial: %s\n" |
|
216 | 215 | % (bool(overwrite), bool(partial))) |
|
217 | 216 | repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, p1, p2)) |
|
218 | 217 | |
|
219 | 218 | m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest() |
|
220 | 219 | copied = set(copy.values()) |
|
221 | 220 | copied.update(movewithdir.values()) |
|
222 | 221 | |
|
223 | 222 | if '.hgsubstate' in m1: |
|
224 | 223 | # check whether sub state is modified |
|
225 | 224 | for s in sorted(p1.substate): |
|
226 | 225 | if p1.sub(s).dirty(): |
|
227 | 226 | m1['.hgsubstate'] += "+" |
|
228 | 227 | break |
|
229 | 228 | |
|
230 | 229 | prompts = [] |
|
231 | 230 | # Compare manifests |
|
232 | 231 | visit = m1.iteritems() |
|
233 | 232 | if repo.ui.debugflag: |
|
234 | 233 | visit = sorted(visit) |
|
235 | 234 | for f, n in visit: |
|
236 | 235 | if partial and not partial(f): |
|
237 | 236 | continue |
|
238 | 237 | if f in m2: |
|
239 | 238 | n2 = m2[f] |
|
240 | 239 | fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f) |
|
241 | 240 | nol = 'l' not in fl1 + fl2 + fla |
|
242 | 241 | a = ma.get(f, nullid) |
|
243 | 242 | if n == n2 and fl1 == fl2: |
|
244 | 243 | pass # same - keep local |
|
245 | 244 | elif n2 == a and fl2 == fla: |
|
246 | 245 | pass # remote unchanged - keep local |
|
247 | 246 | elif n == a and fl1 == fla: # local unchanged - use remote |
|
248 | 247 | if n == n2: # optimization: keep local content |
|
249 | 248 | act("update permissions", "e", f, fl2) |
|
250 | 249 | else: |
|
251 | 250 | act("remote is newer", "g", f, fl2) |
|
252 | 251 | elif nol and n2 == a: # remote only changed 'x' |
|
253 | 252 | act("update permissions", "e", f, fl2) |
|
254 | 253 | elif nol and n == a: # local only changed 'x' |
|
255 | 254 | act("remote is newer", "g", f, fl1) |
|
256 | 255 | else: # both changed something |
|
257 | 256 | act("versions differ", "m", f, f, f, False) |
|
258 | 257 | elif f in copied: # files we'll deal with on m2 side |
|
259 | 258 | pass |
|
260 | 259 | elif f in movewithdir: # directory rename |
|
261 | 260 | f2 = movewithdir[f] |
|
262 | 261 | act("remote renamed directory to " + f2, "d", f, None, f2, |
|
263 | 262 | m1.flags(f)) |
|
264 | 263 | elif f in copy: |
|
265 | 264 | f2 = copy[f] |
|
266 | 265 | act("local copied/moved to " + f2, "m", f, f2, f, False) |
|
267 | 266 | elif f in ma: # clean, a different, no remote |
|
268 | 267 | if n != ma[f]: |
|
269 | 268 | prompts.append((f, "cd")) # prompt changed/deleted |
|
270 | 269 | elif n[20:] == "a": # added, no remote |
|
271 | 270 | act("remote deleted", "f", f) |
|
272 | 271 | else: |
|
273 | 272 | act("other deleted", "r", f) |
|
274 | 273 | |
|
275 | 274 | visit = m2.iteritems() |
|
276 | 275 | if repo.ui.debugflag: |
|
277 | 276 | visit = sorted(visit) |
|
278 | 277 | for f, n in visit: |
|
279 | 278 | if partial and not partial(f): |
|
280 | 279 | continue |
|
281 | 280 | if f in m1 or f in copied: # files already visited |
|
282 | 281 | continue |
|
283 | 282 | if f in movewithdir: |
|
284 | 283 | f2 = movewithdir[f] |
|
285 | 284 | act("local renamed directory to " + f2, "d", None, f, f2, |
|
286 | 285 | m2.flags(f)) |
|
287 | 286 | elif f in copy: |
|
288 | 287 | f2 = copy[f] |
|
289 | 288 | if f2 in m2: |
|
290 | 289 | act("remote copied to " + f, "m", |
|
291 | 290 | f2, f, f, False) |
|
292 | 291 | else: |
|
293 | 292 | act("remote moved to " + f, "m", |
|
294 | 293 | f2, f, f, True) |
|
295 | 294 | elif f not in ma: |
|
296 | 295 | if (not overwrite |
|
297 | 296 | and _checkunknownfile(repo, p1, p2, f)): |
|
298 | 297 | act("remote differs from untracked local", |
|
299 | 298 | "m", f, f, f, False) |
|
300 | 299 | else: |
|
301 | 300 | act("remote created", "g", f, m2.flags(f)) |
|
302 | 301 | elif n != ma[f]: |
|
303 | 302 | prompts.append((f, "dc")) # prompt deleted/changed |
|
304 | 303 | |
|
305 | 304 | for f, m in sorted(prompts): |
|
306 | 305 | if m == "cd": |
|
307 | 306 | if repo.ui.promptchoice( |
|
308 | 307 | _(" local changed %s which remote deleted\n" |
|
309 | 308 | "use (c)hanged version or (d)elete?") % f, |
|
310 | 309 | (_("&Changed"), _("&Delete")), 0): |
|
311 | 310 | act("prompt delete", "r", f) |
|
312 | 311 | else: |
|
313 | 312 | act("prompt keep", "a", f) |
|
314 | 313 | elif m == "dc": |
|
315 | 314 | if repo.ui.promptchoice( |
|
316 | 315 | _("remote changed %s which local deleted\n" |
|
317 | 316 | "use (c)hanged version or leave (d)eleted?") % f, |
|
318 | 317 | (_("&Changed"), _("&Deleted")), 0) == 0: |
|
319 | 318 | act("prompt recreating", "g", f, m2.flags(f)) |
|
320 | 319 | else: assert False, m |
|
321 | 320 | return actions |
|
322 | 321 | |
|
323 | 322 | def actionkey(a): |
|
324 | 323 | return a[1] == "r" and -1 or 0, a |
|
325 | 324 | |
|
326 | 325 | def applyupdates(repo, actions, wctx, mctx, actx, overwrite): |
|
327 | 326 | """apply the merge action list to the working directory |
|
328 | 327 | |
|
329 | 328 | wctx is the working copy context |
|
330 | 329 | mctx is the context to be merged into the working copy |
|
331 | 330 | actx is the context of the common ancestor |
|
332 | 331 | |
|
333 | 332 | Return a tuple of counts (updated, merged, removed, unresolved) that |
|
334 | 333 | describes how many files were affected by the update. |
|
335 | 334 | """ |
|
336 | 335 | |
|
337 | 336 | updated, merged, removed, unresolved = 0, 0, 0, 0 |
|
338 | 337 | ms = mergestate(repo) |
|
339 | 338 | ms.reset(wctx.p1().node()) |
|
340 | 339 | moves = [] |
|
341 | 340 | actions.sort(key=actionkey) |
|
342 | 341 | |
|
343 | 342 | # prescan for merges |
|
344 | 343 | for a in actions: |
|
345 | f, m, args = a | |
|
344 | f, m, args, msg = a | |
|
345 | repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m)) | |
|
346 | 346 | if m == "m": # merge |
|
347 | 347 | f2, fd, move = args |
|
348 | 348 | if fd == '.hgsubstate': # merged internally |
|
349 | 349 | continue |
|
350 | repo.ui.debug("preserving %s for resolve of %s\n" % (f, fd)) | |
|
350 | repo.ui.debug(" preserving %s for resolve of %s\n" % (f, fd)) | |
|
351 | 351 | fcl = wctx[f] |
|
352 | 352 | fco = mctx[f2] |
|
353 | 353 | if mctx == actx: # backwards, use working dir parent as ancestor |
|
354 | 354 | if fcl.parents(): |
|
355 | 355 | fca = fcl.p1() |
|
356 | 356 | else: |
|
357 | 357 | fca = repo.filectx(f, fileid=nullrev) |
|
358 | 358 | else: |
|
359 | 359 | fca = fcl.ancestor(fco, actx) |
|
360 | 360 | if not fca: |
|
361 | 361 | fca = repo.filectx(f, fileid=nullrev) |
|
362 | 362 | ms.add(fcl, fco, fca, fd) |
|
363 | 363 | if f != fd and move: |
|
364 | 364 | moves.append(f) |
|
365 | 365 | |
|
366 | 366 | audit = repo.wopener.audit |
|
367 | 367 | |
|
368 | 368 | # remove renamed files after safely stored |
|
369 | 369 | for f in moves: |
|
370 | 370 | if os.path.lexists(repo.wjoin(f)): |
|
371 | 371 | repo.ui.debug("removing %s\n" % f) |
|
372 | 372 | audit(f) |
|
373 | 373 | util.unlinkpath(repo.wjoin(f)) |
|
374 | 374 | |
|
375 | 375 | numupdates = len(actions) |
|
376 | 376 | for i, a in enumerate(actions): |
|
377 | f, m, args = a | |
|
377 | f, m, args, msg = a | |
|
378 | 378 | repo.ui.progress(_('updating'), i + 1, item=f, total=numupdates, |
|
379 | 379 | unit=_('files')) |
|
380 | 380 | if m == "r": # remove |
|
381 | 381 | repo.ui.note(_("removing %s\n") % f) |
|
382 | 382 | audit(f) |
|
383 | 383 | if f == '.hgsubstate': # subrepo states need updating |
|
384 | 384 | subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
|
385 | 385 | try: |
|
386 | 386 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
|
387 | 387 | except OSError, inst: |
|
388 | 388 | repo.ui.warn(_("update failed to remove %s: %s!\n") % |
|
389 | 389 | (f, inst.strerror)) |
|
390 | 390 | removed += 1 |
|
391 | 391 | elif m == "m": # merge |
|
392 | 392 | if fd == '.hgsubstate': # subrepo states need updating |
|
393 | 393 | subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), |
|
394 | 394 | overwrite) |
|
395 | 395 | continue |
|
396 | 396 | f2, fd, move = args |
|
397 | 397 | audit(fd) |
|
398 | 398 | r = ms.resolve(fd, wctx, mctx) |
|
399 | 399 | if r is not None and r > 0: |
|
400 | 400 | unresolved += 1 |
|
401 | 401 | else: |
|
402 | 402 | if r is None: |
|
403 | 403 | updated += 1 |
|
404 | 404 | else: |
|
405 | 405 | merged += 1 |
|
406 | 406 | elif m == "g": # get |
|
407 | 407 | flags, = args |
|
408 | 408 | repo.ui.note(_("getting %s\n") % f) |
|
409 | 409 | repo.wwrite(f, mctx.filectx(f).data(), flags) |
|
410 | 410 | updated += 1 |
|
411 | 411 | if f == '.hgsubstate': # subrepo states need updating |
|
412 | 412 | subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
|
413 | 413 | elif m == "d": # directory rename |
|
414 | 414 | f2, fd, flags = args |
|
415 | 415 | if f: |
|
416 | 416 | repo.ui.note(_("moving %s to %s\n") % (f, fd)) |
|
417 | 417 | audit(f) |
|
418 | 418 | repo.wwrite(fd, wctx.filectx(f).data(), flags) |
|
419 | 419 | util.unlinkpath(repo.wjoin(f)) |
|
420 | 420 | if f2: |
|
421 | 421 | repo.ui.note(_("getting %s to %s\n") % (f2, fd)) |
|
422 | 422 | repo.wwrite(fd, mctx.filectx(f2).data(), flags) |
|
423 | 423 | updated += 1 |
|
424 | 424 | elif m == "dr": # divergent renames |
|
425 | 425 | fl, = args |
|
426 | 426 | repo.ui.warn(_("note: possible conflict - %s was renamed " |
|
427 | 427 | "multiple times to:\n") % f) |
|
428 | 428 | for nf in fl: |
|
429 | 429 | repo.ui.warn(" %s\n" % nf) |
|
430 | 430 | elif m == "rd": # rename and delete |
|
431 | 431 | fl, = args |
|
432 | 432 | repo.ui.warn(_("note: possible conflict - %s was deleted " |
|
433 | 433 | "and renamed to:\n") % f) |
|
434 | 434 | for nf in fl: |
|
435 | 435 | repo.ui.warn(" %s\n" % nf) |
|
436 | 436 | elif m == "e": # exec |
|
437 | 437 | flags, = args |
|
438 | 438 | audit(f) |
|
439 | 439 | util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags) |
|
440 | 440 | updated += 1 |
|
441 | 441 | ms.commit() |
|
442 | 442 | repo.ui.progress(_('updating'), None, total=numupdates, unit=_('files')) |
|
443 | 443 | |
|
444 | 444 | return updated, merged, removed, unresolved |
|
445 | 445 | |
|
446 | 446 | def calculateupdates(repo, tctx, mctx, ancestor, branchmerge, force, partial): |
|
447 | 447 | "Calculate the actions needed to merge mctx into tctx" |
|
448 | 448 | actions = [] |
|
449 | 449 | folding = not util.checkcase(repo.path) |
|
450 | 450 | if folding: |
|
451 | 451 | # collision check is not needed for clean update |
|
452 | 452 | if (not branchmerge and |
|
453 | 453 | (force or not tctx.dirty(missing=True, branch=False))): |
|
454 | 454 | _checkcollision(mctx, None) |
|
455 | 455 | else: |
|
456 | 456 | _checkcollision(mctx, (tctx, ancestor)) |
|
457 | 457 | if not force: |
|
458 | 458 | _checkunknown(repo, tctx, mctx) |
|
459 | 459 | if tctx.rev() is None: |
|
460 | 460 | actions += _forgetremoved(tctx, mctx, branchmerge) |
|
461 | 461 | actions += manifestmerge(repo, tctx, mctx, |
|
462 | 462 | ancestor, |
|
463 | 463 | force and not branchmerge, |
|
464 | 464 | partial) |
|
465 | 465 | return actions |
|
466 | 466 | |
|
467 | 467 | def recordupdates(repo, actions, branchmerge): |
|
468 | 468 | "record merge actions to the dirstate" |
|
469 | 469 | |
|
470 | 470 | for a in actions: |
|
471 | f, m, args = a | |
|
471 | f, m, args, msg = a | |
|
472 | 472 | if m == "r": # remove |
|
473 | 473 | if branchmerge: |
|
474 | 474 | repo.dirstate.remove(f) |
|
475 | 475 | else: |
|
476 | 476 | repo.dirstate.drop(f) |
|
477 | 477 | elif m == "a": # re-add |
|
478 | 478 | if not branchmerge: |
|
479 | 479 | repo.dirstate.add(f) |
|
480 | 480 | elif m == "f": # forget |
|
481 | 481 | repo.dirstate.drop(f) |
|
482 | 482 | elif m == "e": # exec change |
|
483 | 483 | repo.dirstate.normallookup(f) |
|
484 | 484 | elif m == "g": # get |
|
485 | 485 | if branchmerge: |
|
486 | 486 | repo.dirstate.otherparent(f) |
|
487 | 487 | else: |
|
488 | 488 | repo.dirstate.normal(f) |
|
489 | 489 | elif m == "m": # merge |
|
490 | 490 | f2, fd, move = args |
|
491 | 491 | if branchmerge: |
|
492 | 492 | # We've done a branch merge, mark this file as merged |
|
493 | 493 | # so that we properly record the merger later |
|
494 | 494 | repo.dirstate.merge(fd) |
|
495 | 495 | if f != f2: # copy/rename |
|
496 | 496 | if move: |
|
497 | 497 | repo.dirstate.remove(f) |
|
498 | 498 | if f != fd: |
|
499 | 499 | repo.dirstate.copy(f, fd) |
|
500 | 500 | else: |
|
501 | 501 | repo.dirstate.copy(f2, fd) |
|
502 | 502 | else: |
|
503 | 503 | # We've update-merged a locally modified file, so |
|
504 | 504 | # we set the dirstate to emulate a normal checkout |
|
505 | 505 | # of that file some time in the past. Thus our |
|
506 | 506 | # merge will appear as a normal local file |
|
507 | 507 | # modification. |
|
508 | 508 | if f2 == fd: # file not locally copied/moved |
|
509 | 509 | repo.dirstate.normallookup(fd) |
|
510 | 510 | if move: |
|
511 | 511 | repo.dirstate.drop(f) |
|
512 | 512 | elif m == "d": # directory rename |
|
513 | 513 | f2, fd, flag = args |
|
514 | 514 | if not f2 and f not in repo.dirstate: |
|
515 | 515 | # untracked file moved |
|
516 | 516 | continue |
|
517 | 517 | if branchmerge: |
|
518 | 518 | repo.dirstate.add(fd) |
|
519 | 519 | if f: |
|
520 | 520 | repo.dirstate.remove(f) |
|
521 | 521 | repo.dirstate.copy(f, fd) |
|
522 | 522 | if f2: |
|
523 | 523 | repo.dirstate.copy(f2, fd) |
|
524 | 524 | else: |
|
525 | 525 | repo.dirstate.normal(fd) |
|
526 | 526 | if f: |
|
527 | 527 | repo.dirstate.drop(f) |
|
528 | 528 | |
|
529 | 529 | def update(repo, node, branchmerge, force, partial, ancestor=None, |
|
530 | 530 | mergeancestor=False): |
|
531 | 531 | """ |
|
532 | 532 | Perform a merge between the working directory and the given node |
|
533 | 533 | |
|
534 | 534 | node = the node to update to, or None if unspecified |
|
535 | 535 | branchmerge = whether to merge between branches |
|
536 | 536 | force = whether to force branch merging or file overwriting |
|
537 | 537 | partial = a function to filter file lists (dirstate not updated) |
|
538 | 538 | mergeancestor = if false, merging with an ancestor (fast-forward) |
|
539 | 539 | is only allowed between different named branches. This flag |
|
540 | 540 | is used by rebase extension as a temporary fix and should be |
|
541 | 541 | avoided in general. |
|
542 | 542 | |
|
543 | 543 | The table below shows all the behaviors of the update command |
|
544 | 544 | given the -c and -C or no options, whether the working directory |
|
545 | 545 | is dirty, whether a revision is specified, and the relationship of |
|
546 | 546 | the parent rev to the target rev (linear, on the same named |
|
547 | 547 | branch, or on another named branch). |
|
548 | 548 | |
|
549 | 549 | This logic is tested by test-update-branches.t. |
|
550 | 550 | |
|
551 | 551 | -c -C dirty rev | linear same cross |
|
552 | 552 | n n n n | ok (1) x |
|
553 | 553 | n n n y | ok ok ok |
|
554 | 554 | n n y * | merge (2) (2) |
|
555 | 555 | n y * * | --- discard --- |
|
556 | 556 | y n y * | --- (3) --- |
|
557 | 557 | y n n * | --- ok --- |
|
558 | 558 | y y * * | --- (4) --- |
|
559 | 559 | |
|
560 | 560 | x = can't happen |
|
561 | 561 | * = don't-care |
|
562 | 562 | 1 = abort: crosses branches (use 'hg merge' or 'hg update -c') |
|
563 | 563 | 2 = abort: crosses branches (use 'hg merge' to merge or |
|
564 | 564 | use 'hg update -C' to discard changes) |
|
565 | 565 | 3 = abort: uncommitted local changes |
|
566 | 566 | 4 = incompatible options (checked in commands.py) |
|
567 | 567 | |
|
568 | 568 | Return the same tuple as applyupdates(). |
|
569 | 569 | """ |
|
570 | 570 | |
|
571 | 571 | onode = node |
|
572 | 572 | wlock = repo.wlock() |
|
573 | 573 | try: |
|
574 | 574 | wc = repo[None] |
|
575 | 575 | if node is None: |
|
576 | 576 | # tip of current branch |
|
577 | 577 | try: |
|
578 | 578 | node = repo.branchtip(wc.branch()) |
|
579 | 579 | except error.RepoLookupError: |
|
580 | 580 | if wc.branch() == "default": # no default branch! |
|
581 | 581 | node = repo.lookup("tip") # update to tip |
|
582 | 582 | else: |
|
583 | 583 | raise util.Abort(_("branch %s not found") % wc.branch()) |
|
584 | 584 | overwrite = force and not branchmerge |
|
585 | 585 | pl = wc.parents() |
|
586 | 586 | p1, p2 = pl[0], repo[node] |
|
587 | 587 | if ancestor: |
|
588 | 588 | pa = repo[ancestor] |
|
589 | 589 | else: |
|
590 | 590 | pa = p1.ancestor(p2) |
|
591 | 591 | |
|
592 | 592 | fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2) |
|
593 | 593 | |
|
594 | 594 | ### check phase |
|
595 | 595 | if not overwrite and len(pl) > 1: |
|
596 | 596 | raise util.Abort(_("outstanding uncommitted merges")) |
|
597 | 597 | if branchmerge: |
|
598 | 598 | if pa == p2: |
|
599 | 599 | raise util.Abort(_("merging with a working directory ancestor" |
|
600 | 600 | " has no effect")) |
|
601 | 601 | elif pa == p1: |
|
602 | 602 | if not mergeancestor and p1.branch() == p2.branch(): |
|
603 | 603 | raise util.Abort(_("nothing to merge"), |
|
604 | 604 | hint=_("use 'hg update' " |
|
605 | 605 | "or check 'hg heads'")) |
|
606 | 606 | if not force and (wc.files() or wc.deleted()): |
|
607 | 607 | raise util.Abort(_("outstanding uncommitted changes"), |
|
608 | 608 | hint=_("use 'hg status' to list changes")) |
|
609 | 609 | for s in sorted(wc.substate): |
|
610 | 610 | if wc.sub(s).dirty(): |
|
611 | 611 | raise util.Abort(_("outstanding uncommitted changes in " |
|
612 | 612 | "subrepository '%s'") % s) |
|
613 | 613 | |
|
614 | 614 | elif not overwrite: |
|
615 | 615 | if pa == p1 or pa == p2: # linear |
|
616 | 616 | pass # all good |
|
617 | 617 | elif wc.dirty(missing=True): |
|
618 | 618 | raise util.Abort(_("crosses branches (merge branches or use" |
|
619 | 619 | " --clean to discard changes)")) |
|
620 | 620 | elif onode is None: |
|
621 | 621 | raise util.Abort(_("crosses branches (merge branches or update" |
|
622 | 622 | " --check to force update)")) |
|
623 | 623 | else: |
|
624 | 624 | # Allow jumping branches if clean and specific rev given |
|
625 | 625 | pa = p1 |
|
626 | 626 | |
|
627 | 627 | ### calculate phase |
|
628 | 628 | actions = calculateupdates(repo, wc, p2, pa, |
|
629 | 629 | branchmerge, force, partial) |
|
630 | 630 | |
|
631 | 631 | ### apply phase |
|
632 | 632 | if not branchmerge: # just jump to the new rev |
|
633 | 633 | fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' |
|
634 | 634 | if not partial: |
|
635 | 635 | repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) |
|
636 | 636 | |
|
637 | 637 | stats = applyupdates(repo, actions, wc, p2, pa, overwrite) |
|
638 | 638 | |
|
639 | 639 | if not partial: |
|
640 | 640 | repo.setparents(fp1, fp2) |
|
641 | 641 | recordupdates(repo, actions, branchmerge) |
|
642 | 642 | if not branchmerge: |
|
643 | 643 | repo.dirstate.setbranch(p2.branch()) |
|
644 | 644 | finally: |
|
645 | 645 | wlock.release() |
|
646 | 646 | |
|
647 | 647 | if not partial: |
|
648 | 648 | repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3]) |
|
649 | 649 | return stats |
@@ -1,64 +1,64 b'' | |||
|
1 | 1 | $ hg init t |
|
2 | 2 | $ cd t |
|
3 | 3 | |
|
4 | 4 | $ echo 1 > a |
|
5 | 5 | $ hg ci -qAm "first" |
|
6 | 6 | |
|
7 | 7 | $ hg cp a b |
|
8 | 8 | $ hg mv a c |
|
9 | 9 | $ echo 2 >> b |
|
10 | 10 | $ echo 2 >> c |
|
11 | 11 | |
|
12 | 12 | $ hg ci -qAm "second" |
|
13 | 13 | |
|
14 | 14 | $ hg co -C 0 |
|
15 | 15 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
16 | 16 | |
|
17 | 17 | $ echo 0 > a |
|
18 | 18 | $ echo 1 >> a |
|
19 | 19 | |
|
20 | 20 | $ hg ci -qAm "other" |
|
21 | 21 | |
|
22 | 22 | $ hg merge --debug |
|
23 | 23 | searching for copies back to rev 1 |
|
24 | 24 | unmatched files in other: |
|
25 | 25 | b |
|
26 | 26 | c |
|
27 | 27 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
28 | 28 | src: 'a' -> dst: 'b' * |
|
29 | 29 | src: 'a' -> dst: 'c' * |
|
30 | 30 | checking for directory renames |
|
31 | 31 | resolving manifests |
|
32 | 32 | overwrite: False, partial: False |
|
33 | 33 | ancestor: b8bf91eeebbc, local: add3f11052fa+, remote: 17c05bb7fcb6 |
|
34 | 34 | a: remote moved to b -> m |
|
35 | preserving a for resolve of b | |
|
35 | 36 | a: remote moved to c -> m |
|
36 |
preserving a for resolve of |
|
|
37 | preserving a for resolve of c | |
|
37 | preserving a for resolve of c | |
|
38 | 38 | removing a |
|
39 | 39 | updating: a 1/2 files (50.00%) |
|
40 | 40 | picked tool 'internal:merge' for b (binary False symlink False) |
|
41 | 41 | merging a and b to b |
|
42 | 42 | my b@add3f11052fa+ other b@17c05bb7fcb6 ancestor a@b8bf91eeebbc |
|
43 | 43 | premerge successful |
|
44 | 44 | updating: a 2/2 files (100.00%) |
|
45 | 45 | picked tool 'internal:merge' for c (binary False symlink False) |
|
46 | 46 | merging a and c to c |
|
47 | 47 | my c@add3f11052fa+ other c@17c05bb7fcb6 ancestor a@b8bf91eeebbc |
|
48 | 48 | premerge successful |
|
49 | 49 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
50 | 50 | (branch merge, don't forget to commit) |
|
51 | 51 | |
|
52 | 52 | file b |
|
53 | 53 | $ cat b |
|
54 | 54 | 0 |
|
55 | 55 | 1 |
|
56 | 56 | 2 |
|
57 | 57 | |
|
58 | 58 | file c |
|
59 | 59 | $ cat c |
|
60 | 60 | 0 |
|
61 | 61 | 1 |
|
62 | 62 | 2 |
|
63 | 63 | |
|
64 | 64 | $ cd .. |
@@ -1,67 +1,67 b'' | |||
|
1 | 1 | $ hg init repo |
|
2 | 2 | $ cd repo |
|
3 | 3 | |
|
4 | 4 | $ echo line 1 > foo |
|
5 | 5 | $ hg ci -qAm 'add foo' |
|
6 | 6 | |
|
7 | 7 | copy foo to bar and change both files |
|
8 | 8 | $ hg cp foo bar |
|
9 | 9 | $ echo line 2-1 >> foo |
|
10 | 10 | $ echo line 2-2 >> bar |
|
11 | 11 | $ hg ci -m 'cp foo bar; change both' |
|
12 | 12 | |
|
13 | 13 | in another branch, change foo in a way that doesn't conflict with |
|
14 | 14 | the other changes |
|
15 | 15 | $ hg up -qC 0 |
|
16 | 16 | $ echo line 0 > foo |
|
17 | 17 | $ hg cat foo >> foo |
|
18 | 18 | $ hg ci -m 'change foo' |
|
19 | 19 | created new head |
|
20 | 20 | |
|
21 | 21 | we get conflicts that shouldn't be there |
|
22 | 22 | $ hg merge -P |
|
23 | 23 | changeset: 1:484bf6903104 |
|
24 | 24 | user: test |
|
25 | 25 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
26 | 26 | summary: cp foo bar; change both |
|
27 | 27 | |
|
28 | 28 | $ hg merge --debug |
|
29 | 29 | searching for copies back to rev 1 |
|
30 | 30 | unmatched files in other: |
|
31 | 31 | bar |
|
32 | 32 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
33 | 33 | src: 'foo' -> dst: 'bar' * |
|
34 | 34 | checking for directory renames |
|
35 | 35 | resolving manifests |
|
36 | 36 | overwrite: False, partial: False |
|
37 | 37 | ancestor: e6dc8efe11cc, local: 6a0df1dad128+, remote: 484bf6903104 |
|
38 | foo: remote copied to bar -> m | |
|
39 | preserving foo for resolve of bar | |
|
38 | 40 | foo: versions differ -> m |
|
39 | foo: remote copied to bar -> m | |
|
40 | preserving foo for resolve of bar | |
|
41 | preserving foo for resolve of foo | |
|
41 | preserving foo for resolve of foo | |
|
42 | 42 | updating: foo 1/2 files (50.00%) |
|
43 | 43 | picked tool 'internal:merge' for bar (binary False symlink False) |
|
44 | 44 | merging foo and bar to bar |
|
45 | 45 | my bar@6a0df1dad128+ other bar@484bf6903104 ancestor foo@e6dc8efe11cc |
|
46 | 46 | premerge successful |
|
47 | 47 | updating: foo 2/2 files (100.00%) |
|
48 | 48 | picked tool 'internal:merge' for foo (binary False symlink False) |
|
49 | 49 | merging foo |
|
50 | 50 | my foo@6a0df1dad128+ other foo@484bf6903104 ancestor foo@e6dc8efe11cc |
|
51 | 51 | premerge successful |
|
52 | 52 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
53 | 53 | (branch merge, don't forget to commit) |
|
54 | 54 | |
|
55 | 55 | contents of foo |
|
56 | 56 | $ cat foo |
|
57 | 57 | line 0 |
|
58 | 58 | line 1 |
|
59 | 59 | line 2-1 |
|
60 | 60 | |
|
61 | 61 | contents of bar |
|
62 | 62 | $ cat bar |
|
63 | 63 | line 0 |
|
64 | 64 | line 1 |
|
65 | 65 | line 2-2 |
|
66 | 66 | |
|
67 | 67 | $ cd .. |
@@ -1,535 +1,535 b'' | |||
|
1 | 1 | Create a repo with some stuff in it: |
|
2 | 2 | |
|
3 | 3 | $ hg init a |
|
4 | 4 | $ cd a |
|
5 | 5 | $ echo a > a |
|
6 | 6 | $ echo a > d |
|
7 | 7 | $ echo a > e |
|
8 | 8 | $ hg ci -qAm0 |
|
9 | 9 | $ echo b > a |
|
10 | 10 | $ hg ci -m1 -u bar |
|
11 | 11 | $ hg mv a b |
|
12 | 12 | $ hg ci -m2 |
|
13 | 13 | $ hg cp b c |
|
14 | 14 | $ hg ci -m3 -u baz |
|
15 | 15 | $ echo b > d |
|
16 | 16 | $ echo f > e |
|
17 | 17 | $ hg ci -m4 |
|
18 | 18 | $ hg up -q 3 |
|
19 | 19 | $ echo b > e |
|
20 | 20 | $ hg branch -q stable |
|
21 | 21 | $ hg ci -m5 |
|
22 | 22 | $ hg merge -q default --tool internal:local |
|
23 | 23 | $ hg branch -q default |
|
24 | 24 | $ hg ci -m6 |
|
25 | 25 | $ hg phase --public 3 |
|
26 | 26 | $ hg phase --force --secret 6 |
|
27 | 27 | |
|
28 | 28 | $ hg --config extensions.graphlog= log -G --template '{author}@{rev}.{phase}: {desc}\n' |
|
29 | 29 | @ test@6.secret: 6 |
|
30 | 30 | |\ |
|
31 | 31 | | o test@5.draft: 5 |
|
32 | 32 | | | |
|
33 | 33 | o | test@4.draft: 4 |
|
34 | 34 | |/ |
|
35 | 35 | o baz@3.public: 3 |
|
36 | 36 | | |
|
37 | 37 | o test@2.public: 2 |
|
38 | 38 | | |
|
39 | 39 | o bar@1.public: 1 |
|
40 | 40 | | |
|
41 | 41 | o test@0.public: 0 |
|
42 | 42 | |
|
43 | 43 | |
|
44 | 44 | Need to specify a rev: |
|
45 | 45 | |
|
46 | 46 | $ hg graft |
|
47 | 47 | abort: no revisions specified |
|
48 | 48 | [255] |
|
49 | 49 | |
|
50 | 50 | Can't graft ancestor: |
|
51 | 51 | |
|
52 | 52 | $ hg graft 1 2 |
|
53 | 53 | skipping ancestor revision 1 |
|
54 | 54 | skipping ancestor revision 2 |
|
55 | 55 | [255] |
|
56 | 56 | |
|
57 | 57 | Specify revisions with -r: |
|
58 | 58 | |
|
59 | 59 | $ hg graft -r 1 -r 2 |
|
60 | 60 | skipping ancestor revision 1 |
|
61 | 61 | skipping ancestor revision 2 |
|
62 | 62 | [255] |
|
63 | 63 | |
|
64 | 64 | $ hg graft -r 1 2 |
|
65 | 65 | skipping ancestor revision 2 |
|
66 | 66 | skipping ancestor revision 1 |
|
67 | 67 | [255] |
|
68 | 68 | |
|
69 | 69 | Can't graft with dirty wd: |
|
70 | 70 | |
|
71 | 71 | $ hg up -q 0 |
|
72 | 72 | $ echo foo > a |
|
73 | 73 | $ hg graft 1 |
|
74 | 74 | abort: outstanding uncommitted changes |
|
75 | 75 | [255] |
|
76 | 76 | $ hg revert a |
|
77 | 77 | |
|
78 | 78 | Graft a rename: |
|
79 | 79 | |
|
80 | 80 | $ hg graft 2 -u foo |
|
81 | 81 | grafting revision 2 |
|
82 | 82 | merging a and b to b |
|
83 | 83 | $ hg export tip --git |
|
84 | 84 | # HG changeset patch |
|
85 | 85 | # User foo |
|
86 | 86 | # Date 0 0 |
|
87 | 87 | # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
88 | 88 | # Parent 68795b066622ca79a25816a662041d8f78f3cd9e |
|
89 | 89 | 2 |
|
90 | 90 | |
|
91 | 91 | diff --git a/a b/b |
|
92 | 92 | rename from a |
|
93 | 93 | rename to b |
|
94 | 94 | |
|
95 | 95 | Look for extra:source |
|
96 | 96 | |
|
97 | 97 | $ hg log --debug -r tip |
|
98 | 98 | changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
99 | 99 | tag: tip |
|
100 | 100 | phase: draft |
|
101 | 101 | parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e |
|
102 | 102 | parent: -1:0000000000000000000000000000000000000000 |
|
103 | 103 | manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb |
|
104 | 104 | user: foo |
|
105 | 105 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
106 | 106 | files+: b |
|
107 | 107 | files-: a |
|
108 | 108 | extra: branch=default |
|
109 | 109 | extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
110 | 110 | description: |
|
111 | 111 | 2 |
|
112 | 112 | |
|
113 | 113 | |
|
114 | 114 | |
|
115 | 115 | Graft out of order, skipping a merge and a duplicate |
|
116 | 116 | |
|
117 | 117 | $ hg graft 1 5 4 3 'merge()' 2 -n |
|
118 | 118 | skipping ungraftable merge revision 6 |
|
119 | 119 | skipping already grafted revision 2 |
|
120 | 120 | grafting revision 1 |
|
121 | 121 | grafting revision 5 |
|
122 | 122 | grafting revision 4 |
|
123 | 123 | grafting revision 3 |
|
124 | 124 | |
|
125 | 125 | $ hg graft 1 5 4 3 'merge()' 2 --debug |
|
126 | 126 | skipping ungraftable merge revision 6 |
|
127 | 127 | scanning for duplicate grafts |
|
128 | 128 | skipping already grafted revision 2 |
|
129 | 129 | grafting revision 1 |
|
130 | 130 | searching for copies back to rev 1 |
|
131 | 131 | unmatched files in local: |
|
132 | 132 | b |
|
133 | 133 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
134 | 134 | src: 'a' -> dst: 'b' * |
|
135 | 135 | checking for directory renames |
|
136 | 136 | resolving manifests |
|
137 | 137 | overwrite: False, partial: False |
|
138 | 138 | ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6 |
|
139 | 139 | b: local copied/moved to a -> m |
|
140 | preserving b for resolve of b | |
|
140 | preserving b for resolve of b | |
|
141 | 141 | updating: b 1/1 files (100.00%) |
|
142 | 142 | picked tool 'internal:merge' for b (binary False symlink False) |
|
143 | 143 | merging b and a to b |
|
144 | 144 | my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622 |
|
145 | 145 | premerge successful |
|
146 | 146 | b |
|
147 | 147 | grafting revision 5 |
|
148 | 148 | searching for copies back to rev 1 |
|
149 | 149 | resolving manifests |
|
150 | 150 | overwrite: False, partial: False |
|
151 | 151 | ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746 |
|
152 | 152 | e: remote is newer -> g |
|
153 | 153 | updating: e 1/1 files (100.00%) |
|
154 | 154 | getting e |
|
155 | 155 | e |
|
156 | 156 | grafting revision 4 |
|
157 | 157 | searching for copies back to rev 1 |
|
158 | 158 | resolving manifests |
|
159 | 159 | overwrite: False, partial: False |
|
160 | 160 | ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d |
|
161 | 161 | d: remote is newer -> g |
|
162 | 162 | e: versions differ -> m |
|
163 | preserving e for resolve of e | |
|
163 | preserving e for resolve of e | |
|
164 | 164 | updating: d 1/2 files (50.00%) |
|
165 | 165 | getting d |
|
166 | 166 | updating: e 2/2 files (100.00%) |
|
167 | 167 | picked tool 'internal:merge' for e (binary False symlink False) |
|
168 | 168 | merging e |
|
169 | 169 | my e@1905859650ec+ other e@9c233e8e184d ancestor e@68795b066622 |
|
170 | 170 | warning: conflicts during merge. |
|
171 | 171 | merging e incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
172 | 172 | abort: unresolved conflicts, can't continue |
|
173 | 173 | (use hg resolve and hg graft --continue) |
|
174 | 174 | [255] |
|
175 | 175 | |
|
176 | 176 | Continue without resolve should fail: |
|
177 | 177 | |
|
178 | 178 | $ hg graft -c |
|
179 | 179 | grafting revision 4 |
|
180 | 180 | abort: unresolved merge conflicts (see hg help resolve) |
|
181 | 181 | [255] |
|
182 | 182 | |
|
183 | 183 | Fix up: |
|
184 | 184 | |
|
185 | 185 | $ echo b > e |
|
186 | 186 | $ hg resolve -m e |
|
187 | 187 | |
|
188 | 188 | Continue with a revision should fail: |
|
189 | 189 | |
|
190 | 190 | $ hg graft -c 6 |
|
191 | 191 | abort: can't specify --continue and revisions |
|
192 | 192 | [255] |
|
193 | 193 | |
|
194 | 194 | $ hg graft -c -r 6 |
|
195 | 195 | abort: can't specify --continue and revisions |
|
196 | 196 | [255] |
|
197 | 197 | |
|
198 | 198 | Continue for real, clobber usernames |
|
199 | 199 | |
|
200 | 200 | $ hg graft -c -U |
|
201 | 201 | grafting revision 4 |
|
202 | 202 | grafting revision 3 |
|
203 | 203 | |
|
204 | 204 | Compare with original: |
|
205 | 205 | |
|
206 | 206 | $ hg diff -r 6 |
|
207 | 207 | $ hg status --rev 0:. -C |
|
208 | 208 | M d |
|
209 | 209 | M e |
|
210 | 210 | A b |
|
211 | 211 | a |
|
212 | 212 | A c |
|
213 | 213 | a |
|
214 | 214 | R a |
|
215 | 215 | |
|
216 | 216 | View graph: |
|
217 | 217 | |
|
218 | 218 | $ hg --config extensions.graphlog= log -G --template '{author}@{rev}.{phase}: {desc}\n' |
|
219 | 219 | @ test@11.draft: 3 |
|
220 | 220 | | |
|
221 | 221 | o test@10.draft: 4 |
|
222 | 222 | | |
|
223 | 223 | o test@9.draft: 5 |
|
224 | 224 | | |
|
225 | 225 | o bar@8.draft: 1 |
|
226 | 226 | | |
|
227 | 227 | o foo@7.draft: 2 |
|
228 | 228 | | |
|
229 | 229 | | o test@6.secret: 6 |
|
230 | 230 | | |\ |
|
231 | 231 | | | o test@5.draft: 5 |
|
232 | 232 | | | | |
|
233 | 233 | | o | test@4.draft: 4 |
|
234 | 234 | | |/ |
|
235 | 235 | | o baz@3.public: 3 |
|
236 | 236 | | | |
|
237 | 237 | | o test@2.public: 2 |
|
238 | 238 | | | |
|
239 | 239 | | o bar@1.public: 1 |
|
240 | 240 | |/ |
|
241 | 241 | o test@0.public: 0 |
|
242 | 242 | |
|
243 | 243 | Graft again onto another branch should preserve the original source |
|
244 | 244 | $ hg up -q 0 |
|
245 | 245 | $ echo 'g'>g |
|
246 | 246 | $ hg add g |
|
247 | 247 | $ hg ci -m 7 |
|
248 | 248 | created new head |
|
249 | 249 | $ hg graft 7 |
|
250 | 250 | grafting revision 7 |
|
251 | 251 | |
|
252 | 252 | $ hg log -r 7 --template '{rev}:{node}\n' |
|
253 | 253 | 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82 |
|
254 | 254 | $ hg log -r 2 --template '{rev}:{node}\n' |
|
255 | 255 | 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
256 | 256 | |
|
257 | 257 | $ hg log --debug -r tip |
|
258 | 258 | changeset: 13:9db0f28fd3747e92c57d015f53b5593aeec53c2d |
|
259 | 259 | tag: tip |
|
260 | 260 | phase: draft |
|
261 | 261 | parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f |
|
262 | 262 | parent: -1:0000000000000000000000000000000000000000 |
|
263 | 263 | manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637 |
|
264 | 264 | user: foo |
|
265 | 265 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
266 | 266 | files+: b |
|
267 | 267 | files-: a |
|
268 | 268 | extra: branch=default |
|
269 | 269 | extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
270 | 270 | description: |
|
271 | 271 | 2 |
|
272 | 272 | |
|
273 | 273 | |
|
274 | 274 | Disallow grafting an already grafted cset onto its original branch |
|
275 | 275 | $ hg up -q 6 |
|
276 | 276 | $ hg graft 7 |
|
277 | 277 | skipping already grafted revision 7 (was grafted from 2) |
|
278 | 278 | [255] |
|
279 | 279 | |
|
280 | 280 | Disallow grafting already grafted csets with the same origin onto each other |
|
281 | 281 | $ hg up -q 13 |
|
282 | 282 | $ hg graft 2 |
|
283 | 283 | skipping already grafted revision 2 |
|
284 | 284 | [255] |
|
285 | 285 | $ hg graft 7 |
|
286 | 286 | skipping already grafted revision 7 (same origin 2) |
|
287 | 287 | [255] |
|
288 | 288 | |
|
289 | 289 | $ hg up -q 7 |
|
290 | 290 | $ hg graft 2 |
|
291 | 291 | skipping already grafted revision 2 |
|
292 | 292 | [255] |
|
293 | 293 | $ hg graft tip |
|
294 | 294 | skipping already grafted revision 13 (same origin 2) |
|
295 | 295 | [255] |
|
296 | 296 | |
|
297 | 297 | Graft with --log |
|
298 | 298 | |
|
299 | 299 | $ hg up -Cq 1 |
|
300 | 300 | $ hg graft 3 --log -u foo |
|
301 | 301 | grafting revision 3 |
|
302 | 302 | warning: can't find ancestor for 'c' copied from 'b'! |
|
303 | 303 | $ hg log --template '{rev} {parents} {desc}\n' -r tip |
|
304 | 304 | 14 1:5d205f8b35b6 3 |
|
305 | 305 | (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8) |
|
306 | 306 | |
|
307 | 307 | Resolve conflicted graft |
|
308 | 308 | $ hg up -q 0 |
|
309 | 309 | $ echo b > a |
|
310 | 310 | $ hg ci -m 8 |
|
311 | 311 | created new head |
|
312 | 312 | $ echo a > a |
|
313 | 313 | $ hg ci -m 9 |
|
314 | 314 | $ hg graft 1 --tool internal:fail |
|
315 | 315 | grafting revision 1 |
|
316 | 316 | abort: unresolved conflicts, can't continue |
|
317 | 317 | (use hg resolve and hg graft --continue) |
|
318 | 318 | [255] |
|
319 | 319 | $ hg resolve --all |
|
320 | 320 | merging a |
|
321 | 321 | $ hg graft -c |
|
322 | 322 | grafting revision 1 |
|
323 | 323 | $ hg export tip --git |
|
324 | 324 | # HG changeset patch |
|
325 | 325 | # User bar |
|
326 | 326 | # Date 0 0 |
|
327 | 327 | # Node ID 64ecd9071ce83c6e62f538d8ce7709d53f32ebf7 |
|
328 | 328 | # Parent 4bdb9a9d0b84ffee1d30f0dfc7744cade17aa19c |
|
329 | 329 | 1 |
|
330 | 330 | |
|
331 | 331 | diff --git a/a b/a |
|
332 | 332 | --- a/a |
|
333 | 333 | +++ b/a |
|
334 | 334 | @@ -1,1 +1,1 @@ |
|
335 | 335 | -a |
|
336 | 336 | +b |
|
337 | 337 | |
|
338 | 338 | Resolve conflicted graft with rename |
|
339 | 339 | $ echo c > a |
|
340 | 340 | $ hg ci -m 10 |
|
341 | 341 | $ hg graft 2 --tool internal:fail |
|
342 | 342 | grafting revision 2 |
|
343 | 343 | abort: unresolved conflicts, can't continue |
|
344 | 344 | (use hg resolve and hg graft --continue) |
|
345 | 345 | [255] |
|
346 | 346 | $ hg resolve --all |
|
347 | 347 | merging a and b to b |
|
348 | 348 | $ hg graft -c |
|
349 | 349 | grafting revision 2 |
|
350 | 350 | $ hg export tip --git |
|
351 | 351 | # HG changeset patch |
|
352 | 352 | # User test |
|
353 | 353 | # Date 0 0 |
|
354 | 354 | # Node ID 2e80e1351d6ed50302fe1e05f8bd1d4d412b6e11 |
|
355 | 355 | # Parent e5a51ae854a8bbaaf25cc5c6a57ff46042dadbb4 |
|
356 | 356 | 2 |
|
357 | 357 | |
|
358 | 358 | diff --git a/a b/b |
|
359 | 359 | rename from a |
|
360 | 360 | rename to b |
|
361 | 361 | |
|
362 | 362 | Test simple origin(), with and without args |
|
363 | 363 | $ hg log -r 'origin()' |
|
364 | 364 | changeset: 1:5d205f8b35b6 |
|
365 | 365 | user: bar |
|
366 | 366 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
367 | 367 | summary: 1 |
|
368 | 368 | |
|
369 | 369 | changeset: 2:5c095ad7e90f |
|
370 | 370 | user: test |
|
371 | 371 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
372 | 372 | summary: 2 |
|
373 | 373 | |
|
374 | 374 | changeset: 3:4c60f11aa304 |
|
375 | 375 | user: baz |
|
376 | 376 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
377 | 377 | summary: 3 |
|
378 | 378 | |
|
379 | 379 | changeset: 4:9c233e8e184d |
|
380 | 380 | user: test |
|
381 | 381 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
382 | 382 | summary: 4 |
|
383 | 383 | |
|
384 | 384 | changeset: 5:97f8bfe72746 |
|
385 | 385 | branch: stable |
|
386 | 386 | parent: 3:4c60f11aa304 |
|
387 | 387 | user: test |
|
388 | 388 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
389 | 389 | summary: 5 |
|
390 | 390 | |
|
391 | 391 | $ hg log -r 'origin(7)' |
|
392 | 392 | changeset: 2:5c095ad7e90f |
|
393 | 393 | user: test |
|
394 | 394 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
395 | 395 | summary: 2 |
|
396 | 396 | |
|
397 | 397 | Now transplant a graft to test following through copies |
|
398 | 398 | $ hg up -q 0 |
|
399 | 399 | $ hg branch -q dev |
|
400 | 400 | $ hg ci -qm "dev branch" |
|
401 | 401 | $ hg --config extensions.transplant= transplant -q 7 |
|
402 | 402 | $ hg log -r 'origin(.)' |
|
403 | 403 | changeset: 2:5c095ad7e90f |
|
404 | 404 | user: test |
|
405 | 405 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
406 | 406 | summary: 2 |
|
407 | 407 | |
|
408 | 408 | Test simple destination |
|
409 | 409 | $ hg log -r 'destination()' |
|
410 | 410 | changeset: 7:ef0ef43d49e7 |
|
411 | 411 | parent: 0:68795b066622 |
|
412 | 412 | user: foo |
|
413 | 413 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
414 | 414 | summary: 2 |
|
415 | 415 | |
|
416 | 416 | changeset: 8:6b9e5368ca4e |
|
417 | 417 | user: bar |
|
418 | 418 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
419 | 419 | summary: 1 |
|
420 | 420 | |
|
421 | 421 | changeset: 9:1905859650ec |
|
422 | 422 | user: test |
|
423 | 423 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
424 | 424 | summary: 5 |
|
425 | 425 | |
|
426 | 426 | changeset: 10:52dc0b4c6907 |
|
427 | 427 | user: test |
|
428 | 428 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
429 | 429 | summary: 4 |
|
430 | 430 | |
|
431 | 431 | changeset: 11:882b35362a6b |
|
432 | 432 | user: test |
|
433 | 433 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
434 | 434 | summary: 3 |
|
435 | 435 | |
|
436 | 436 | changeset: 13:9db0f28fd374 |
|
437 | 437 | user: foo |
|
438 | 438 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
439 | 439 | summary: 2 |
|
440 | 440 | |
|
441 | 441 | changeset: 14:f64defefacee |
|
442 | 442 | parent: 1:5d205f8b35b6 |
|
443 | 443 | user: foo |
|
444 | 444 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
445 | 445 | summary: 3 |
|
446 | 446 | |
|
447 | 447 | changeset: 17:64ecd9071ce8 |
|
448 | 448 | user: bar |
|
449 | 449 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
450 | 450 | summary: 1 |
|
451 | 451 | |
|
452 | 452 | changeset: 19:2e80e1351d6e |
|
453 | 453 | user: test |
|
454 | 454 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
455 | 455 | summary: 2 |
|
456 | 456 | |
|
457 | 457 | changeset: 21:7e61b508e709 |
|
458 | 458 | branch: dev |
|
459 | 459 | tag: tip |
|
460 | 460 | user: foo |
|
461 | 461 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
462 | 462 | summary: 2 |
|
463 | 463 | |
|
464 | 464 | $ hg log -r 'destination(2)' |
|
465 | 465 | changeset: 7:ef0ef43d49e7 |
|
466 | 466 | parent: 0:68795b066622 |
|
467 | 467 | user: foo |
|
468 | 468 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
469 | 469 | summary: 2 |
|
470 | 470 | |
|
471 | 471 | changeset: 13:9db0f28fd374 |
|
472 | 472 | user: foo |
|
473 | 473 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
474 | 474 | summary: 2 |
|
475 | 475 | |
|
476 | 476 | changeset: 19:2e80e1351d6e |
|
477 | 477 | user: test |
|
478 | 478 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
479 | 479 | summary: 2 |
|
480 | 480 | |
|
481 | 481 | changeset: 21:7e61b508e709 |
|
482 | 482 | branch: dev |
|
483 | 483 | tag: tip |
|
484 | 484 | user: foo |
|
485 | 485 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
486 | 486 | summary: 2 |
|
487 | 487 | |
|
488 | 488 | Transplants of grafts can find a destination... |
|
489 | 489 | $ hg log -r 'destination(7)' |
|
490 | 490 | changeset: 21:7e61b508e709 |
|
491 | 491 | branch: dev |
|
492 | 492 | tag: tip |
|
493 | 493 | user: foo |
|
494 | 494 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
495 | 495 | summary: 2 |
|
496 | 496 | |
|
497 | 497 | ... grafts of grafts unfortunately can't |
|
498 | 498 | $ hg graft -q 13 |
|
499 | 499 | $ hg log -r 'destination(13)' |
|
500 | 500 | All copies of a cset |
|
501 | 501 | $ hg log -r 'origin(13) or destination(origin(13))' |
|
502 | 502 | changeset: 2:5c095ad7e90f |
|
503 | 503 | user: test |
|
504 | 504 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
505 | 505 | summary: 2 |
|
506 | 506 | |
|
507 | 507 | changeset: 7:ef0ef43d49e7 |
|
508 | 508 | parent: 0:68795b066622 |
|
509 | 509 | user: foo |
|
510 | 510 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
511 | 511 | summary: 2 |
|
512 | 512 | |
|
513 | 513 | changeset: 13:9db0f28fd374 |
|
514 | 514 | user: foo |
|
515 | 515 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
516 | 516 | summary: 2 |
|
517 | 517 | |
|
518 | 518 | changeset: 19:2e80e1351d6e |
|
519 | 519 | user: test |
|
520 | 520 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
521 | 521 | summary: 2 |
|
522 | 522 | |
|
523 | 523 | changeset: 21:7e61b508e709 |
|
524 | 524 | branch: dev |
|
525 | 525 | user: foo |
|
526 | 526 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
527 | 527 | summary: 2 |
|
528 | 528 | |
|
529 | 529 | changeset: 22:1313d0a825e2 |
|
530 | 530 | branch: dev |
|
531 | 531 | tag: tip |
|
532 | 532 | user: foo |
|
533 | 533 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
534 | 534 | summary: 2 |
|
535 | 535 |
@@ -1,101 +1,101 b'' | |||
|
1 | 1 | http://mercurial.selenic.com/bts/issue672 |
|
2 | 2 | |
|
3 | 3 | # 0-2-4 |
|
4 | 4 | # \ \ \ |
|
5 | 5 | # 1-3-5 |
|
6 | 6 | # |
|
7 | 7 | # rename in #1, content change in #4. |
|
8 | 8 | |
|
9 | 9 | $ hg init |
|
10 | 10 | |
|
11 | 11 | $ touch 1 |
|
12 | 12 | $ touch 2 |
|
13 | 13 | $ hg commit -Am init # 0 |
|
14 | 14 | adding 1 |
|
15 | 15 | adding 2 |
|
16 | 16 | |
|
17 | 17 | $ hg rename 1 1a |
|
18 | 18 | $ hg commit -m rename # 1 |
|
19 | 19 | |
|
20 | 20 | $ hg co -C 0 |
|
21 | 21 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
22 | 22 | |
|
23 | 23 | $ echo unrelated >> 2 |
|
24 | 24 | $ hg ci -m unrelated1 # 2 |
|
25 | 25 | created new head |
|
26 | 26 | |
|
27 | 27 | $ hg merge --debug 1 |
|
28 | 28 | searching for copies back to rev 1 |
|
29 | 29 | unmatched files in other: |
|
30 | 30 | 1a |
|
31 | 31 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
32 | 32 | src: '1' -> dst: '1a' |
|
33 | 33 | checking for directory renames |
|
34 | 34 | resolving manifests |
|
35 | 35 | overwrite: False, partial: False |
|
36 | 36 | ancestor: 81f4b099af3d, local: c64f439569a9+, remote: c12dcd37c90a |
|
37 | 37 | 1: other deleted -> r |
|
38 | 38 | 1a: remote created -> g |
|
39 | 39 | updating: 1 1/2 files (50.00%) |
|
40 | 40 | removing 1 |
|
41 | 41 | updating: 1a 2/2 files (100.00%) |
|
42 | 42 | getting 1a |
|
43 | 43 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
44 | 44 | (branch merge, don't forget to commit) |
|
45 | 45 | |
|
46 | 46 | $ hg ci -m merge1 # 3 |
|
47 | 47 | |
|
48 | 48 | $ hg co -C 2 |
|
49 | 49 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
50 | 50 | |
|
51 | 51 | $ echo hello >> 1 |
|
52 | 52 | $ hg ci -m unrelated2 # 4 |
|
53 | 53 | created new head |
|
54 | 54 | |
|
55 | 55 | $ hg co -C 3 |
|
56 | 56 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
57 | 57 | |
|
58 | 58 | $ hg merge -y --debug 4 |
|
59 | 59 | searching for copies back to rev 1 |
|
60 | 60 | unmatched files in local: |
|
61 | 61 | 1a |
|
62 | 62 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
63 | 63 | src: '1' -> dst: '1a' * |
|
64 | 64 | checking for directory renames |
|
65 | 65 | resolving manifests |
|
66 | 66 | overwrite: False, partial: False |
|
67 | 67 | ancestor: c64f439569a9, local: e327dca35ac8+, remote: 746e9549ea96 |
|
68 | 68 | 1a: local copied/moved to 1 -> m |
|
69 | preserving 1a for resolve of 1a | |
|
69 | preserving 1a for resolve of 1a | |
|
70 | 70 | updating: 1a 1/1 files (100.00%) |
|
71 | 71 | picked tool 'internal:merge' for 1a (binary False symlink False) |
|
72 | 72 | merging 1a and 1 to 1a |
|
73 | 73 | my 1a@e327dca35ac8+ other 1@746e9549ea96 ancestor 1@81f4b099af3d |
|
74 | 74 | premerge successful |
|
75 | 75 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
76 | 76 | (branch merge, don't forget to commit) |
|
77 | 77 | |
|
78 | 78 | $ hg co -C 4 |
|
79 | 79 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
80 | 80 | |
|
81 | 81 | $ hg merge -y --debug 3 |
|
82 | 82 | searching for copies back to rev 1 |
|
83 | 83 | unmatched files in other: |
|
84 | 84 | 1a |
|
85 | 85 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
86 | 86 | src: '1' -> dst: '1a' * |
|
87 | 87 | checking for directory renames |
|
88 | 88 | resolving manifests |
|
89 | 89 | overwrite: False, partial: False |
|
90 | 90 | ancestor: c64f439569a9, local: 746e9549ea96+, remote: e327dca35ac8 |
|
91 | 91 | 1: remote moved to 1a -> m |
|
92 | preserving 1 for resolve of 1a | |
|
92 | preserving 1 for resolve of 1a | |
|
93 | 93 | removing 1 |
|
94 | 94 | updating: 1 1/1 files (100.00%) |
|
95 | 95 | picked tool 'internal:merge' for 1a (binary False symlink False) |
|
96 | 96 | merging 1 and 1a to 1a |
|
97 | 97 | my 1a@746e9549ea96+ other 1a@e327dca35ac8 ancestor 1@81f4b099af3d |
|
98 | 98 | premerge successful |
|
99 | 99 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
100 | 100 | (branch merge, don't forget to commit) |
|
101 | 101 |
@@ -1,184 +1,184 b'' | |||
|
1 | 1 | Check that renames are correctly saved by a commit after a merge |
|
2 | 2 | |
|
3 | 3 | Test with the merge on 3 having the rename on the local parent |
|
4 | 4 | |
|
5 | 5 | $ hg init a |
|
6 | 6 | $ cd a |
|
7 | 7 | |
|
8 | 8 | $ echo line1 > foo |
|
9 | 9 | $ hg add foo |
|
10 | 10 | $ hg ci -m '0: add foo' |
|
11 | 11 | |
|
12 | 12 | $ echo line2 >> foo |
|
13 | 13 | $ hg ci -m '1: change foo' |
|
14 | 14 | |
|
15 | 15 | $ hg up -C 0 |
|
16 | 16 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
17 | 17 | |
|
18 | 18 | $ hg mv foo bar |
|
19 | 19 | $ rm bar |
|
20 | 20 | $ echo line0 > bar |
|
21 | 21 | $ echo line1 >> bar |
|
22 | 22 | $ hg ci -m '2: mv foo bar; change bar' |
|
23 | 23 | created new head |
|
24 | 24 | |
|
25 | 25 | $ hg merge 1 |
|
26 | 26 | merging bar and foo to bar |
|
27 | 27 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
28 | 28 | (branch merge, don't forget to commit) |
|
29 | 29 | |
|
30 | 30 | $ cat bar |
|
31 | 31 | line0 |
|
32 | 32 | line1 |
|
33 | 33 | line2 |
|
34 | 34 | |
|
35 | 35 | $ hg ci -m '3: merge with local rename' |
|
36 | 36 | |
|
37 | 37 | $ hg debugindex bar |
|
38 | 38 | rev offset length ..... linkrev nodeid p1 p2 (re) |
|
39 | 39 | 0 0 77 ..... 2 d35118874825 000000000000 000000000000 (re) |
|
40 | 40 | 1 77 76 ..... 3 5345f5ab8abd 000000000000 d35118874825 (re) |
|
41 | 41 | |
|
42 | 42 | $ hg debugrename bar |
|
43 | 43 | bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2 |
|
44 | 44 | |
|
45 | 45 | $ hg debugindex foo |
|
46 | 46 | rev offset length ..... linkrev nodeid p1 p2 (re) |
|
47 | 47 | 0 0 7 ..... 0 690b295714ae 000000000000 000000000000 (re) |
|
48 | 48 | 1 7 13 ..... 1 9e25c27b8757 690b295714ae 000000000000 (re) |
|
49 | 49 | |
|
50 | 50 | |
|
51 | 51 | Revert the content change from rev 2: |
|
52 | 52 | |
|
53 | 53 | $ hg up -C 2 |
|
54 | 54 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
55 | 55 | $ rm bar |
|
56 | 56 | $ echo line1 > bar |
|
57 | 57 | $ hg ci -m '4: revert content change from rev 2' |
|
58 | 58 | created new head |
|
59 | 59 | |
|
60 | 60 | $ hg log --template '{rev}:{node|short} {parents}\n' |
|
61 | 61 | 4:2263c1be0967 2:0f2ff26688b9 |
|
62 | 62 | 3:0555950ead28 2:0f2ff26688b9 1:5cd961e4045d |
|
63 | 63 | 2:0f2ff26688b9 0:2665aaee66e9 |
|
64 | 64 | 1:5cd961e4045d |
|
65 | 65 | 0:2665aaee66e9 |
|
66 | 66 | |
|
67 | 67 | This should use bar@rev2 as the ancestor: |
|
68 | 68 | |
|
69 | 69 | $ hg --debug merge 3 |
|
70 | 70 | searching for copies back to rev 1 |
|
71 | 71 | resolving manifests |
|
72 | 72 | overwrite: False, partial: False |
|
73 | 73 | ancestor: 0f2ff26688b9, local: 2263c1be0967+, remote: 0555950ead28 |
|
74 | 74 | bar: versions differ -> m |
|
75 | preserving bar for resolve of bar | |
|
75 | preserving bar for resolve of bar | |
|
76 | 76 | updating: bar 1/1 files (100.00%) |
|
77 | 77 | picked tool 'internal:merge' for bar (binary False symlink False) |
|
78 | 78 | merging bar |
|
79 | 79 | my bar@2263c1be0967+ other bar@0555950ead28 ancestor bar@0f2ff26688b9 |
|
80 | 80 | premerge successful |
|
81 | 81 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
82 | 82 | (branch merge, don't forget to commit) |
|
83 | 83 | |
|
84 | 84 | $ cat bar |
|
85 | 85 | line1 |
|
86 | 86 | line2 |
|
87 | 87 | |
|
88 | 88 | $ hg ci -m '5: merge' |
|
89 | 89 | |
|
90 | 90 | $ hg debugindex bar |
|
91 | 91 | rev offset length ..... linkrev nodeid p1 p2 (re) |
|
92 | 92 | 0 0 77 ..... 2 d35118874825 000000000000 000000000000 (re) |
|
93 | 93 | 1 77 76 ..... 3 5345f5ab8abd 000000000000 d35118874825 (re) |
|
94 | 94 | 2 153 7 ..... 4 ff4b45017382 d35118874825 000000000000 (re) |
|
95 | 95 | 3 160 13 ..... 5 3701b4893544 ff4b45017382 5345f5ab8abd (re) |
|
96 | 96 | |
|
97 | 97 | |
|
98 | 98 | Same thing, but with the merge on 3 having the rename |
|
99 | 99 | on the remote parent: |
|
100 | 100 | |
|
101 | 101 | $ cd .. |
|
102 | 102 | $ hg clone -U -r 1 -r 2 a b |
|
103 | 103 | adding changesets |
|
104 | 104 | adding manifests |
|
105 | 105 | adding file changes |
|
106 | 106 | added 3 changesets with 3 changes to 2 files (+1 heads) |
|
107 | 107 | $ cd b |
|
108 | 108 | |
|
109 | 109 | $ hg up -C 1 |
|
110 | 110 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
111 | 111 | |
|
112 | 112 | $ hg merge 2 |
|
113 | 113 | merging foo and bar to bar |
|
114 | 114 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
115 | 115 | (branch merge, don't forget to commit) |
|
116 | 116 | |
|
117 | 117 | $ cat bar |
|
118 | 118 | line0 |
|
119 | 119 | line1 |
|
120 | 120 | line2 |
|
121 | 121 | |
|
122 | 122 | $ hg ci -m '3: merge with remote rename' |
|
123 | 123 | |
|
124 | 124 | $ hg debugindex bar |
|
125 | 125 | rev offset length ..... linkrev nodeid p1 p2 (re) |
|
126 | 126 | 0 0 77 ..... 2 d35118874825 000000000000 000000000000 (re) |
|
127 | 127 | 1 77 76 ..... 3 5345f5ab8abd 000000000000 d35118874825 (re) |
|
128 | 128 | |
|
129 | 129 | $ hg debugrename bar |
|
130 | 130 | bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2 |
|
131 | 131 | |
|
132 | 132 | $ hg debugindex foo |
|
133 | 133 | rev offset length ..... linkrev nodeid p1 p2 (re) |
|
134 | 134 | 0 0 7 ..... 0 690b295714ae 000000000000 000000000000 (re) |
|
135 | 135 | 1 7 13 ..... 1 9e25c27b8757 690b295714ae 000000000000 (re) |
|
136 | 136 | |
|
137 | 137 | |
|
138 | 138 | Revert the content change from rev 2: |
|
139 | 139 | |
|
140 | 140 | $ hg up -C 2 |
|
141 | 141 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
142 | 142 | $ rm bar |
|
143 | 143 | $ echo line1 > bar |
|
144 | 144 | $ hg ci -m '4: revert content change from rev 2' |
|
145 | 145 | created new head |
|
146 | 146 | |
|
147 | 147 | $ hg log --template '{rev}:{node|short} {parents}\n' |
|
148 | 148 | 4:2263c1be0967 2:0f2ff26688b9 |
|
149 | 149 | 3:3ffa6b9e35f0 1:5cd961e4045d 2:0f2ff26688b9 |
|
150 | 150 | 2:0f2ff26688b9 0:2665aaee66e9 |
|
151 | 151 | 1:5cd961e4045d |
|
152 | 152 | 0:2665aaee66e9 |
|
153 | 153 | |
|
154 | 154 | This should use bar@rev2 as the ancestor: |
|
155 | 155 | |
|
156 | 156 | $ hg --debug merge 3 |
|
157 | 157 | searching for copies back to rev 1 |
|
158 | 158 | resolving manifests |
|
159 | 159 | overwrite: False, partial: False |
|
160 | 160 | ancestor: 0f2ff26688b9, local: 2263c1be0967+, remote: 3ffa6b9e35f0 |
|
161 | 161 | bar: versions differ -> m |
|
162 | preserving bar for resolve of bar | |
|
162 | preserving bar for resolve of bar | |
|
163 | 163 | updating: bar 1/1 files (100.00%) |
|
164 | 164 | picked tool 'internal:merge' for bar (binary False symlink False) |
|
165 | 165 | merging bar |
|
166 | 166 | my bar@2263c1be0967+ other bar@3ffa6b9e35f0 ancestor bar@0f2ff26688b9 |
|
167 | 167 | premerge successful |
|
168 | 168 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
169 | 169 | (branch merge, don't forget to commit) |
|
170 | 170 | |
|
171 | 171 | $ cat bar |
|
172 | 172 | line1 |
|
173 | 173 | line2 |
|
174 | 174 | |
|
175 | 175 | $ hg ci -m '5: merge' |
|
176 | 176 | |
|
177 | 177 | $ hg debugindex bar |
|
178 | 178 | rev offset length ..... linkrev nodeid p1 p2 (re) |
|
179 | 179 | 0 0 77 ..... 2 d35118874825 000000000000 000000000000 (re) |
|
180 | 180 | 1 77 76 ..... 3 5345f5ab8abd 000000000000 d35118874825 (re) |
|
181 | 181 | 2 153 7 ..... 4 ff4b45017382 d35118874825 000000000000 (re) |
|
182 | 182 | 3 160 13 ..... 5 3701b4893544 ff4b45017382 5345f5ab8abd (re) |
|
183 | 183 | |
|
184 | 184 | $ cd .. |
@@ -1,376 +1,376 b'' | |||
|
1 | 1 | $ "$TESTDIR/hghave" symlink execbit || exit 80 |
|
2 | 2 | |
|
3 | 3 | $ tellmeabout() { |
|
4 | 4 | > if [ -h $1 ]; then |
|
5 | 5 | > echo $1 is a symlink: |
|
6 | 6 | > $TESTDIR/readlink.py $1 |
|
7 | 7 | > elif [ -x $1 ]; then |
|
8 | 8 | > echo $1 is an executable file with content: |
|
9 | 9 | > cat $1 |
|
10 | 10 | > else |
|
11 | 11 | > echo $1 is a plain file with content: |
|
12 | 12 | > cat $1 |
|
13 | 13 | > fi |
|
14 | 14 | > } |
|
15 | 15 | |
|
16 | 16 | $ hg init test1 |
|
17 | 17 | $ cd test1 |
|
18 | 18 | |
|
19 | 19 | $ echo a > a |
|
20 | 20 | $ hg ci -Aqmadd |
|
21 | 21 | $ chmod +x a |
|
22 | 22 | $ hg ci -mexecutable |
|
23 | 23 | |
|
24 | 24 | $ hg up -q 0 |
|
25 | 25 | $ rm a |
|
26 | 26 | $ ln -s symlink a |
|
27 | 27 | $ hg ci -msymlink |
|
28 | 28 | created new head |
|
29 | 29 | |
|
30 | 30 | Symlink is local parent, executable is other: |
|
31 | 31 | |
|
32 | 32 | $ hg merge --debug |
|
33 | 33 | searching for copies back to rev 1 |
|
34 | 34 | resolving manifests |
|
35 | 35 | overwrite: False, partial: False |
|
36 | 36 | ancestor: c334dc3be0da, local: 521a1e40188f+, remote: 3574f3e69b1c |
|
37 | 37 | a: versions differ -> m |
|
38 | preserving a for resolve of a | |
|
38 | preserving a for resolve of a | |
|
39 | 39 | updating: a 1/1 files (100.00%) |
|
40 | 40 | picked tool 'internal:merge' for a (binary False symlink True) |
|
41 | 41 | merging a |
|
42 | 42 | my a@521a1e40188f+ other a@3574f3e69b1c ancestor a@c334dc3be0da |
|
43 | 43 | warning: internal:merge cannot merge symlinks for a |
|
44 | 44 | merging a incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
45 | 45 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
46 | 46 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
47 | 47 | [1] |
|
48 | 48 | |
|
49 | 49 | $ tellmeabout a |
|
50 | 50 | a is a symlink: |
|
51 | 51 | a -> symlink |
|
52 | 52 | $ hg resolve a --tool internal:other |
|
53 | 53 | $ tellmeabout a |
|
54 | 54 | a is an executable file with content: |
|
55 | 55 | a |
|
56 | 56 | $ hg st |
|
57 | 57 | M a |
|
58 | 58 | ? a.orig |
|
59 | 59 | |
|
60 | 60 | Symlink is other parent, executable is local: |
|
61 | 61 | |
|
62 | 62 | $ hg update -C 1 |
|
63 | 63 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
64 | 64 | |
|
65 | 65 | $ hg merge --debug |
|
66 | 66 | searching for copies back to rev 1 |
|
67 | 67 | resolving manifests |
|
68 | 68 | overwrite: False, partial: False |
|
69 | 69 | ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f |
|
70 | 70 | a: versions differ -> m |
|
71 | preserving a for resolve of a | |
|
71 | preserving a for resolve of a | |
|
72 | 72 | updating: a 1/1 files (100.00%) |
|
73 | 73 | picked tool 'internal:merge' for a (binary False symlink True) |
|
74 | 74 | merging a |
|
75 | 75 | my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da |
|
76 | 76 | warning: internal:merge cannot merge symlinks for a |
|
77 | 77 | merging a incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
78 | 78 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
79 | 79 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
80 | 80 | [1] |
|
81 | 81 | |
|
82 | 82 | $ tellmeabout a |
|
83 | 83 | a is an executable file with content: |
|
84 | 84 | a |
|
85 | 85 | |
|
86 | 86 | Update to link without local change should get us a symlink (issue3316): |
|
87 | 87 | |
|
88 | 88 | $ hg up -C 0 |
|
89 | 89 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
90 | 90 | $ hg up |
|
91 | 91 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
92 | 92 | $ hg st |
|
93 | 93 | ? a.orig |
|
94 | 94 | |
|
95 | 95 | Update to link with local change should cause a merge prompt (issue3200): |
|
96 | 96 | |
|
97 | 97 | $ hg up -Cq 0 |
|
98 | 98 | $ echo data > a |
|
99 | 99 | $ HGMERGE= hg up -y --debug |
|
100 | 100 | searching for copies back to rev 2 |
|
101 | 101 | resolving manifests |
|
102 | 102 | overwrite: False, partial: False |
|
103 | 103 | ancestor: c334dc3be0da, local: c334dc3be0da+, remote: 521a1e40188f |
|
104 | 104 | a: versions differ -> m |
|
105 | preserving a for resolve of a | |
|
105 | preserving a for resolve of a | |
|
106 | 106 | updating: a 1/1 files (100.00%) |
|
107 | 107 | (couldn't find merge tool hgmerge|tool hgmerge can't handle symlinks) (re) |
|
108 | 108 | picked tool 'internal:prompt' for a (binary False symlink True) |
|
109 | 109 | no tool found to merge a |
|
110 | 110 | keep (l)ocal or take (o)ther? l |
|
111 | 111 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
112 | 112 | $ hg diff --git |
|
113 | 113 | diff --git a/a b/a |
|
114 | 114 | old mode 120000 |
|
115 | 115 | new mode 100644 |
|
116 | 116 | --- a/a |
|
117 | 117 | +++ b/a |
|
118 | 118 | @@ -1,1 +1,1 @@ |
|
119 | 119 | -symlink |
|
120 | 120 | \ No newline at end of file |
|
121 | 121 | +data |
|
122 | 122 | |
|
123 | 123 | |
|
124 | 124 | Test only 'l' change - happens rarely, except when recovering from situations |
|
125 | 125 | where that was what happened. |
|
126 | 126 | |
|
127 | 127 | $ hg init test2 |
|
128 | 128 | $ cd test2 |
|
129 | 129 | $ printf base > f |
|
130 | 130 | $ hg ci -Aqm0 |
|
131 | 131 | $ echo file > f |
|
132 | 132 | $ echo content >> f |
|
133 | 133 | $ hg ci -qm1 |
|
134 | 134 | $ hg up -qr0 |
|
135 | 135 | $ rm f |
|
136 | 136 | $ ln -s base f |
|
137 | 137 | $ hg ci -qm2 |
|
138 | 138 | $ hg merge |
|
139 | 139 | merging f |
|
140 | 140 | warning: internal:merge cannot merge symlinks for f |
|
141 | 141 | merging f incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
142 | 142 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
143 | 143 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
144 | 144 | [1] |
|
145 | 145 | $ tellmeabout f |
|
146 | 146 | f is a symlink: |
|
147 | 147 | f -> base |
|
148 | 148 | |
|
149 | 149 | $ hg up -Cqr1 |
|
150 | 150 | $ hg merge |
|
151 | 151 | merging f |
|
152 | 152 | warning: internal:merge cannot merge symlinks for f |
|
153 | 153 | merging f incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
154 | 154 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
155 | 155 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
156 | 156 | [1] |
|
157 | 157 | $ tellmeabout f |
|
158 | 158 | f is a plain file with content: |
|
159 | 159 | file |
|
160 | 160 | content |
|
161 | 161 | |
|
162 | 162 | $ cd .. |
|
163 | 163 | |
|
164 | 164 | Test removed 'x' flag merged with change to symlink |
|
165 | 165 | |
|
166 | 166 | $ hg init test3 |
|
167 | 167 | $ cd test3 |
|
168 | 168 | $ echo f > f |
|
169 | 169 | $ chmod +x f |
|
170 | 170 | $ hg ci -Aqm0 |
|
171 | 171 | $ chmod -x f |
|
172 | 172 | $ hg ci -qm1 |
|
173 | 173 | $ hg up -qr0 |
|
174 | 174 | $ rm f |
|
175 | 175 | $ ln -s dangling f |
|
176 | 176 | $ hg ci -qm2 |
|
177 | 177 | $ hg merge |
|
178 | 178 | merging f |
|
179 | 179 | warning: internal:merge cannot merge symlinks for f |
|
180 | 180 | merging f incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
181 | 181 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
182 | 182 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
183 | 183 | [1] |
|
184 | 184 | $ tellmeabout f |
|
185 | 185 | f is a symlink: |
|
186 | 186 | f -> dangling |
|
187 | 187 | |
|
188 | 188 | $ hg up -Cqr1 |
|
189 | 189 | $ hg merge |
|
190 | 190 | merging f |
|
191 | 191 | warning: internal:merge cannot merge symlinks for f |
|
192 | 192 | merging f incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
193 | 193 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
194 | 194 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
195 | 195 | [1] |
|
196 | 196 | $ tellmeabout f |
|
197 | 197 | f is a plain file with content: |
|
198 | 198 | f |
|
199 | 199 | |
|
200 | 200 | Test removed 'x' flag merged with content change - both ways |
|
201 | 201 | |
|
202 | 202 | $ hg up -Cqr0 |
|
203 | 203 | $ echo change > f |
|
204 | 204 | $ hg ci -qm3 |
|
205 | 205 | $ hg merge -r1 |
|
206 | 206 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
207 | 207 | (branch merge, don't forget to commit) |
|
208 | 208 | $ tellmeabout f |
|
209 | 209 | f is a plain file with content: |
|
210 | 210 | change |
|
211 | 211 | |
|
212 | 212 | $ hg up -qCr1 |
|
213 | 213 | $ hg merge -r3 |
|
214 | 214 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
215 | 215 | (branch merge, don't forget to commit) |
|
216 | 216 | $ tellmeabout f |
|
217 | 217 | f is a plain file with content: |
|
218 | 218 | change |
|
219 | 219 | |
|
220 | 220 | $ cd .. |
|
221 | 221 | |
|
222 | 222 | Test merge with no common ancestor: |
|
223 | 223 | a: just different |
|
224 | 224 | b: x vs -, different (cannot calculate x, cannot ask merge tool) |
|
225 | 225 | c: x vs -, same (cannot calculate x, merge tool is no good) |
|
226 | 226 | d: x vs l, different |
|
227 | 227 | e: x vs l, same |
|
228 | 228 | f: - vs l, different |
|
229 | 229 | g: - vs l, same |
|
230 | 230 | h: l vs l, different |
|
231 | 231 | (where same means the filelog entry is shared and there thus is an ancestor!) |
|
232 | 232 | |
|
233 | 233 | $ hg init test4 |
|
234 | 234 | $ cd test4 |
|
235 | 235 | $ echo 0 > 0 |
|
236 | 236 | $ hg ci -Aqm0 |
|
237 | 237 | |
|
238 | 238 | $ echo 1 > a |
|
239 | 239 | $ echo 1 > b |
|
240 | 240 | $ chmod +x b |
|
241 | 241 | $ echo x > c |
|
242 | 242 | $ chmod +x c |
|
243 | 243 | $ echo 1 > d |
|
244 | 244 | $ chmod +x d |
|
245 | 245 | $ printf x > e |
|
246 | 246 | $ chmod +x e |
|
247 | 247 | $ echo 1 > f |
|
248 | 248 | $ printf x > g |
|
249 | 249 | $ ln -s 1 h |
|
250 | 250 | $ hg ci -qAm1 |
|
251 | 251 | |
|
252 | 252 | $ hg up -qr0 |
|
253 | 253 | $ echo 2 > a |
|
254 | 254 | $ echo 2 > b |
|
255 | 255 | $ echo x > c |
|
256 | 256 | $ ln -s 2 d |
|
257 | 257 | $ ln -s x e |
|
258 | 258 | $ ln -s 2 f |
|
259 | 259 | $ ln -s x g |
|
260 | 260 | $ ln -s 2 h |
|
261 | 261 | $ hg ci -Aqm2 |
|
262 | 262 | |
|
263 | 263 | $ hg merge |
|
264 | 264 | merging a |
|
265 | 265 | warning: conflicts during merge. |
|
266 | 266 | merging a incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
267 | 267 | warning: cannot merge flags for b |
|
268 | 268 | merging b |
|
269 | 269 | warning: conflicts during merge. |
|
270 | 270 | merging b incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
271 | 271 | merging d |
|
272 | 272 | warning: internal:merge cannot merge symlinks for d |
|
273 | 273 | merging d incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
274 | 274 | merging f |
|
275 | 275 | warning: internal:merge cannot merge symlinks for f |
|
276 | 276 | merging f incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
277 | 277 | merging h |
|
278 | 278 | warning: internal:merge cannot merge symlinks for h |
|
279 | 279 | merging h incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
280 | 280 | 3 files updated, 0 files merged, 0 files removed, 5 files unresolved |
|
281 | 281 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
282 | 282 | [1] |
|
283 | 283 | $ hg resolve -l |
|
284 | 284 | U a |
|
285 | 285 | U b |
|
286 | 286 | U d |
|
287 | 287 | U f |
|
288 | 288 | U h |
|
289 | 289 | $ tellmeabout a |
|
290 | 290 | a is a plain file with content: |
|
291 | 291 | <<<<<<< local |
|
292 | 292 | 2 |
|
293 | 293 | ======= |
|
294 | 294 | 1 |
|
295 | 295 | >>>>>>> other |
|
296 | 296 | $ tellmeabout b |
|
297 | 297 | b is a plain file with content: |
|
298 | 298 | <<<<<<< local |
|
299 | 299 | 2 |
|
300 | 300 | ======= |
|
301 | 301 | 1 |
|
302 | 302 | >>>>>>> other |
|
303 | 303 | $ tellmeabout c |
|
304 | 304 | c is a plain file with content: |
|
305 | 305 | x |
|
306 | 306 | $ tellmeabout d |
|
307 | 307 | d is a symlink: |
|
308 | 308 | d -> 2 |
|
309 | 309 | $ tellmeabout e |
|
310 | 310 | e is a symlink: |
|
311 | 311 | e -> x |
|
312 | 312 | $ tellmeabout f |
|
313 | 313 | f is a symlink: |
|
314 | 314 | f -> 2 |
|
315 | 315 | $ tellmeabout g |
|
316 | 316 | g is a symlink: |
|
317 | 317 | g -> x |
|
318 | 318 | $ tellmeabout h |
|
319 | 319 | h is a symlink: |
|
320 | 320 | h -> 2 |
|
321 | 321 | |
|
322 | 322 | $ hg up -Cqr1 |
|
323 | 323 | $ hg merge |
|
324 | 324 | merging a |
|
325 | 325 | warning: conflicts during merge. |
|
326 | 326 | merging a incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
327 | 327 | warning: cannot merge flags for b |
|
328 | 328 | merging b |
|
329 | 329 | warning: conflicts during merge. |
|
330 | 330 | merging b incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
331 | 331 | merging d |
|
332 | 332 | warning: internal:merge cannot merge symlinks for d |
|
333 | 333 | merging d incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
334 | 334 | merging f |
|
335 | 335 | warning: internal:merge cannot merge symlinks for f |
|
336 | 336 | merging f incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
337 | 337 | merging h |
|
338 | 338 | warning: internal:merge cannot merge symlinks for h |
|
339 | 339 | merging h incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
340 | 340 | 3 files updated, 0 files merged, 0 files removed, 5 files unresolved |
|
341 | 341 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
342 | 342 | [1] |
|
343 | 343 | $ tellmeabout a |
|
344 | 344 | a is a plain file with content: |
|
345 | 345 | <<<<<<< local |
|
346 | 346 | 1 |
|
347 | 347 | ======= |
|
348 | 348 | 2 |
|
349 | 349 | >>>>>>> other |
|
350 | 350 | $ tellmeabout b |
|
351 | 351 | b is an executable file with content: |
|
352 | 352 | <<<<<<< local |
|
353 | 353 | 1 |
|
354 | 354 | ======= |
|
355 | 355 | 2 |
|
356 | 356 | >>>>>>> other |
|
357 | 357 | $ tellmeabout c |
|
358 | 358 | c is a plain file with content: |
|
359 | 359 | x |
|
360 | 360 | $ tellmeabout d |
|
361 | 361 | d is an executable file with content: |
|
362 | 362 | 1 |
|
363 | 363 | $ tellmeabout e |
|
364 | 364 | e is an executable file with content: |
|
365 | 365 | x (no-eol) |
|
366 | 366 | $ tellmeabout f |
|
367 | 367 | f is a plain file with content: |
|
368 | 368 | 1 |
|
369 | 369 | $ tellmeabout g |
|
370 | 370 | g is a plain file with content: |
|
371 | 371 | x (no-eol) |
|
372 | 372 | $ tellmeabout h |
|
373 | 373 | h is a symlink: |
|
374 | 374 | h -> 1 |
|
375 | 375 | |
|
376 | 376 | $ cd .. |
@@ -1,147 +1,147 b'' | |||
|
1 | 1 | initial |
|
2 | 2 | $ hg init test-a |
|
3 | 3 | $ cd test-a |
|
4 | 4 | $ cat >test.txt <<"EOF" |
|
5 | 5 | > 1 |
|
6 | 6 | > 2 |
|
7 | 7 | > 3 |
|
8 | 8 | > EOF |
|
9 | 9 | $ hg add test.txt |
|
10 | 10 | $ hg commit -m "Initial" |
|
11 | 11 | |
|
12 | 12 | clone |
|
13 | 13 | $ cd .. |
|
14 | 14 | $ hg clone test-a test-b |
|
15 | 15 | updating to branch default |
|
16 | 16 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
17 | 17 | |
|
18 | 18 | change test-a |
|
19 | 19 | $ cd test-a |
|
20 | 20 | $ cat >test.txt <<"EOF" |
|
21 | 21 | > one |
|
22 | 22 | > two |
|
23 | 23 | > three |
|
24 | 24 | > EOF |
|
25 | 25 | $ hg commit -m "Numbers as words" |
|
26 | 26 | |
|
27 | 27 | change test-b |
|
28 | 28 | $ cd ../test-b |
|
29 | 29 | $ cat >test.txt <<"EOF" |
|
30 | 30 | > 1 |
|
31 | 31 | > 2.5 |
|
32 | 32 | > 3 |
|
33 | 33 | > EOF |
|
34 | 34 | $ hg commit -m "2 -> 2.5" |
|
35 | 35 | |
|
36 | 36 | now pull and merge from test-a |
|
37 | 37 | $ hg pull ../test-a |
|
38 | 38 | pulling from ../test-a |
|
39 | 39 | searching for changes |
|
40 | 40 | adding changesets |
|
41 | 41 | adding manifests |
|
42 | 42 | adding file changes |
|
43 | 43 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
44 | 44 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
45 | 45 | $ hg merge |
|
46 | 46 | merging test.txt |
|
47 | 47 | warning: conflicts during merge. |
|
48 | 48 | merging test.txt incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
49 | 49 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
50 | 50 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
51 | 51 | [1] |
|
52 | 52 | resolve conflict |
|
53 | 53 | $ cat >test.txt <<"EOF" |
|
54 | 54 | > one |
|
55 | 55 | > two-point-five |
|
56 | 56 | > three |
|
57 | 57 | > EOF |
|
58 | 58 | $ rm -f *.orig |
|
59 | 59 | $ hg resolve -m test.txt |
|
60 | 60 | $ hg commit -m "Merge 1" |
|
61 | 61 | |
|
62 | 62 | change test-a again |
|
63 | 63 | $ cd ../test-a |
|
64 | 64 | $ cat >test.txt <<"EOF" |
|
65 | 65 | > one |
|
66 | 66 | > two-point-one |
|
67 | 67 | > three |
|
68 | 68 | > EOF |
|
69 | 69 | $ hg commit -m "two -> two-point-one" |
|
70 | 70 | |
|
71 | 71 | pull and merge from test-a again |
|
72 | 72 | $ cd ../test-b |
|
73 | 73 | $ hg pull ../test-a |
|
74 | 74 | pulling from ../test-a |
|
75 | 75 | searching for changes |
|
76 | 76 | adding changesets |
|
77 | 77 | adding manifests |
|
78 | 78 | adding file changes |
|
79 | 79 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
80 | 80 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
81 | 81 | $ hg merge --debug |
|
82 | 82 | searching for copies back to rev 1 |
|
83 | 83 | resolving manifests |
|
84 | 84 | overwrite: False, partial: False |
|
85 | 85 | ancestor: 96b70246a118, local: 50c3a7e29886+, remote: 40d11a4173a8 |
|
86 | 86 | test.txt: versions differ -> m |
|
87 | preserving test.txt for resolve of test.txt | |
|
87 | preserving test.txt for resolve of test.txt | |
|
88 | 88 | updating: test.txt 1/1 files (100.00%) |
|
89 | 89 | picked tool 'internal:merge' for test.txt (binary False symlink False) |
|
90 | 90 | merging test.txt |
|
91 | 91 | my test.txt@50c3a7e29886+ other test.txt@40d11a4173a8 ancestor test.txt@96b70246a118 |
|
92 | 92 | warning: conflicts during merge. |
|
93 | 93 | merging test.txt incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
94 | 94 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
95 | 95 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
96 | 96 | [1] |
|
97 | 97 | |
|
98 | 98 | $ cat test.txt |
|
99 | 99 | one |
|
100 | 100 | <<<<<<< local |
|
101 | 101 | two-point-five |
|
102 | 102 | ======= |
|
103 | 103 | two-point-one |
|
104 | 104 | >>>>>>> other |
|
105 | 105 | three |
|
106 | 106 | |
|
107 | 107 | $ hg debugindex test.txt |
|
108 | 108 | rev offset length ..... linkrev nodeid p1 p2 (re) |
|
109 | 109 | 0 0 7 ..... 0 01365c4cca56 000000000000 000000000000 (re) |
|
110 | 110 | 1 7 9 ..... 1 7b013192566a 01365c4cca56 000000000000 (re) |
|
111 | 111 | 2 16 15 ..... 2 8fe46a3eb557 01365c4cca56 000000000000 (re) |
|
112 | 112 | 3 31 2. ..... 3 fc3148072371 7b013192566a 8fe46a3eb557 (re) |
|
113 | 113 | 4 5. 25 ..... 4 d40249267ae3 8fe46a3eb557 000000000000 (re) |
|
114 | 114 | |
|
115 | 115 | $ hg log |
|
116 | 116 | changeset: 4:40d11a4173a8 |
|
117 | 117 | tag: tip |
|
118 | 118 | parent: 2:96b70246a118 |
|
119 | 119 | user: test |
|
120 | 120 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
121 | 121 | summary: two -> two-point-one |
|
122 | 122 | |
|
123 | 123 | changeset: 3:50c3a7e29886 |
|
124 | 124 | parent: 1:d1e159716d41 |
|
125 | 125 | parent: 2:96b70246a118 |
|
126 | 126 | user: test |
|
127 | 127 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
128 | 128 | summary: Merge 1 |
|
129 | 129 | |
|
130 | 130 | changeset: 2:96b70246a118 |
|
131 | 131 | parent: 0:b1832b9d912a |
|
132 | 132 | user: test |
|
133 | 133 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
134 | 134 | summary: Numbers as words |
|
135 | 135 | |
|
136 | 136 | changeset: 1:d1e159716d41 |
|
137 | 137 | user: test |
|
138 | 138 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
139 | 139 | summary: 2 -> 2.5 |
|
140 | 140 | |
|
141 | 141 | changeset: 0:b1832b9d912a |
|
142 | 142 | user: test |
|
143 | 143 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
144 | 144 | summary: Initial |
|
145 | 145 | |
|
146 | 146 | |
|
147 | 147 | $ cd .. |
@@ -1,195 +1,195 b'' | |||
|
1 | 1 | $ hg init |
|
2 | 2 | |
|
3 | 3 | $ echo "[merge]" >> .hg/hgrc |
|
4 | 4 | $ echo "followcopies = 1" >> .hg/hgrc |
|
5 | 5 | |
|
6 | 6 | $ echo foo > a |
|
7 | 7 | $ echo foo > a2 |
|
8 | 8 | $ hg add a a2 |
|
9 | 9 | $ hg ci -m "start" |
|
10 | 10 | |
|
11 | 11 | $ hg mv a b |
|
12 | 12 | $ hg mv a2 b2 |
|
13 | 13 | $ hg ci -m "rename" |
|
14 | 14 | |
|
15 | 15 | $ hg co 0 |
|
16 | 16 | 2 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
17 | 17 | |
|
18 | 18 | $ echo blahblah > a |
|
19 | 19 | $ echo blahblah > a2 |
|
20 | 20 | $ hg mv a2 c2 |
|
21 | 21 | $ hg ci -m "modify" |
|
22 | 22 | created new head |
|
23 | 23 | |
|
24 | 24 | $ hg merge -y --debug |
|
25 | 25 | searching for copies back to rev 1 |
|
26 | 26 | unmatched files in local: |
|
27 | 27 | c2 |
|
28 | 28 | unmatched files in other: |
|
29 | 29 | b |
|
30 | 30 | b2 |
|
31 | 31 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
32 | 32 | src: 'a' -> dst: 'b' * |
|
33 | 33 | src: 'a2' -> dst: 'b2' ! |
|
34 | 34 | src: 'a2' -> dst: 'c2' ! |
|
35 | 35 | checking for directory renames |
|
36 | a2: divergent renames -> dr | |
|
37 | 36 | resolving manifests |
|
38 | 37 | overwrite: False, partial: False |
|
39 | 38 | ancestor: af1939970a1c, local: 044f8520aeeb+, remote: 85c198ef2f6c |
|
40 | 39 | a: remote moved to b -> m |
|
40 | preserving a for resolve of b | |
|
41 | a2: divergent renames -> dr | |
|
41 | 42 | b2: remote created -> g |
|
42 | preserving a for resolve of b | |
|
43 | 43 | removing a |
|
44 | 44 | updating: a 1/3 files (33.33%) |
|
45 | 45 | picked tool 'internal:merge' for b (binary False symlink False) |
|
46 | 46 | merging a and b to b |
|
47 | 47 | my b@044f8520aeeb+ other b@85c198ef2f6c ancestor a@af1939970a1c |
|
48 | 48 | premerge successful |
|
49 | 49 | updating: a2 2/3 files (66.67%) |
|
50 | 50 | note: possible conflict - a2 was renamed multiple times to: |
|
51 | 51 | c2 |
|
52 | 52 | b2 |
|
53 | 53 | updating: b2 3/3 files (100.00%) |
|
54 | 54 | getting b2 |
|
55 | 55 | 1 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
56 | 56 | (branch merge, don't forget to commit) |
|
57 | 57 | |
|
58 | 58 | $ hg status -AC |
|
59 | 59 | M b |
|
60 | 60 | a |
|
61 | 61 | M b2 |
|
62 | 62 | R a |
|
63 | 63 | C c2 |
|
64 | 64 | |
|
65 | 65 | $ cat b |
|
66 | 66 | blahblah |
|
67 | 67 | |
|
68 | 68 | $ hg ci -m "merge" |
|
69 | 69 | |
|
70 | 70 | $ hg debugindex b |
|
71 | 71 | rev offset length ..... linkrev nodeid p1 p2 (re) |
|
72 | 72 | 0 0 67 ..... 1 57eacc201a7f 000000000000 000000000000 (re) |
|
73 | 73 | 1 67 72 ..... 3 4727ba907962 000000000000 57eacc201a7f (re) |
|
74 | 74 | |
|
75 | 75 | $ hg debugrename b |
|
76 | 76 | b renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66 |
|
77 | 77 | |
|
78 | 78 | This used to trigger a "divergent renames" warning, despite no renames |
|
79 | 79 | |
|
80 | 80 | $ hg cp b b3 |
|
81 | 81 | $ hg cp b b4 |
|
82 | 82 | $ hg ci -A -m 'copy b twice' |
|
83 | 83 | $ hg up eb92d88a9712 |
|
84 | 84 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
85 | 85 | $ hg up |
|
86 | 86 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
87 | 87 | $ hg rm b3 b4 |
|
88 | 88 | $ hg ci -m 'clean up a bit of our mess' |
|
89 | 89 | |
|
90 | 90 | We'd rather not warn on divergent renames done in the same changeset (issue2113) |
|
91 | 91 | |
|
92 | 92 | $ hg cp b b3 |
|
93 | 93 | $ hg mv b b4 |
|
94 | 94 | $ hg ci -A -m 'divergent renames in same changeset' |
|
95 | 95 | $ hg up c761c6948de0 |
|
96 | 96 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
97 | 97 | $ hg up |
|
98 | 98 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
99 | 99 | |
|
100 | 100 | Check for issue2642 |
|
101 | 101 | |
|
102 | 102 | $ hg init t |
|
103 | 103 | $ cd t |
|
104 | 104 | |
|
105 | 105 | $ echo c0 > f1 |
|
106 | 106 | $ hg ci -Aqm0 |
|
107 | 107 | |
|
108 | 108 | $ hg up null -q |
|
109 | 109 | $ echo c1 > f1 # backport |
|
110 | 110 | $ hg ci -Aqm1 |
|
111 | 111 | $ hg mv f1 f2 |
|
112 | 112 | $ hg ci -qm2 |
|
113 | 113 | |
|
114 | 114 | $ hg up 0 -q |
|
115 | 115 | $ hg merge 1 -q --tool internal:local |
|
116 | 116 | $ hg ci -qm3 |
|
117 | 117 | |
|
118 | 118 | $ hg merge 2 |
|
119 | 119 | merging f1 and f2 to f2 |
|
120 | 120 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
121 | 121 | (branch merge, don't forget to commit) |
|
122 | 122 | |
|
123 | 123 | $ cat f2 |
|
124 | 124 | c0 |
|
125 | 125 | |
|
126 | 126 | $ cd .. |
|
127 | 127 | |
|
128 | 128 | Check for issue2089 |
|
129 | 129 | |
|
130 | 130 | $ hg init repo2089 |
|
131 | 131 | $ cd repo2089 |
|
132 | 132 | |
|
133 | 133 | $ echo c0 > f1 |
|
134 | 134 | $ hg ci -Aqm0 |
|
135 | 135 | |
|
136 | 136 | $ hg up null -q |
|
137 | 137 | $ echo c1 > f1 |
|
138 | 138 | $ hg ci -Aqm1 |
|
139 | 139 | |
|
140 | 140 | $ hg up 0 -q |
|
141 | 141 | $ hg merge 1 -q --tool internal:local |
|
142 | 142 | $ echo c2 > f1 |
|
143 | 143 | $ hg ci -qm2 |
|
144 | 144 | |
|
145 | 145 | $ hg up 1 -q |
|
146 | 146 | $ hg mv f1 f2 |
|
147 | 147 | $ hg ci -Aqm3 |
|
148 | 148 | |
|
149 | 149 | $ hg up 2 -q |
|
150 | 150 | $ hg merge 3 |
|
151 | 151 | merging f1 and f2 to f2 |
|
152 | 152 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
153 | 153 | (branch merge, don't forget to commit) |
|
154 | 154 | |
|
155 | 155 | $ cat f2 |
|
156 | 156 | c2 |
|
157 | 157 | |
|
158 | 158 | $ cd .. |
|
159 | 159 | |
|
160 | 160 | Check for issue3074 |
|
161 | 161 | |
|
162 | 162 | $ hg init repo3074 |
|
163 | 163 | $ cd repo3074 |
|
164 | 164 | $ echo foo > file |
|
165 | 165 | $ hg add file |
|
166 | 166 | $ hg commit -m "added file" |
|
167 | 167 | $ hg mv file newfile |
|
168 | 168 | $ hg commit -m "renamed file" |
|
169 | 169 | $ hg update 0 |
|
170 | 170 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
171 | 171 | $ hg rm file |
|
172 | 172 | $ hg commit -m "deleted file" |
|
173 | 173 | created new head |
|
174 | 174 | $ hg merge --debug |
|
175 | 175 | searching for copies back to rev 1 |
|
176 | 176 | unmatched files in other: |
|
177 | 177 | newfile |
|
178 | 178 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
179 | 179 | src: 'file' -> dst: 'newfile' % |
|
180 | 180 | checking for directory renames |
|
181 | file: rename and delete -> rd | |
|
182 | 181 | resolving manifests |
|
183 | 182 | overwrite: False, partial: False |
|
184 | 183 | ancestor: 19d7f95df299, local: 0084274f6b67+, remote: 5d32493049f0 |
|
184 | file: rename and delete -> rd | |
|
185 | 185 | newfile: remote created -> g |
|
186 | 186 | updating: file 1/2 files (50.00%) |
|
187 | 187 | note: possible conflict - file was deleted and renamed to: |
|
188 | 188 | newfile |
|
189 | 189 | updating: newfile 2/2 files (100.00%) |
|
190 | 190 | getting newfile |
|
191 | 191 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
192 | 192 | (branch merge, don't forget to commit) |
|
193 | 193 | $ hg status |
|
194 | 194 | M newfile |
|
195 | 195 | $ cd .. |
@@ -1,754 +1,754 b'' | |||
|
1 | 1 | |
|
2 | 2 | $ mkdir -p t |
|
3 | 3 | $ cd t |
|
4 | 4 | $ cat <<EOF > merge |
|
5 | 5 | > import sys, os |
|
6 | 6 | > f = open(sys.argv[1], "wb") |
|
7 | 7 | > f.write("merge %s %s %s" % (sys.argv[1], sys.argv[2], sys.argv[3])) |
|
8 | 8 | > f.close() |
|
9 | 9 | > EOF |
|
10 | 10 | |
|
11 | 11 | perform a test merge with possible renaming |
|
12 | 12 | args: |
|
13 | 13 | $1 = action in local branch |
|
14 | 14 | $2 = action in remote branch |
|
15 | 15 | $3 = action in working dir |
|
16 | 16 | $4 = expected result |
|
17 | 17 | |
|
18 | 18 | $ tm() |
|
19 | 19 | > { |
|
20 | 20 | > hg init t |
|
21 | 21 | > cd t |
|
22 | 22 | > echo "[merge]" >> .hg/hgrc |
|
23 | 23 | > echo "followcopies = 1" >> .hg/hgrc |
|
24 | 24 | > |
|
25 | 25 | > # base |
|
26 | 26 | > echo base > a |
|
27 | 27 | > echo base > rev # used to force commits |
|
28 | 28 | > hg add a rev |
|
29 | 29 | > hg ci -m "base" |
|
30 | 30 | > |
|
31 | 31 | > # remote |
|
32 | 32 | > echo remote > rev |
|
33 | 33 | > if [ "$2" != "" ] ; then $2 ; fi |
|
34 | 34 | > hg ci -m "remote" |
|
35 | 35 | > |
|
36 | 36 | > # local |
|
37 | 37 | > hg co -q 0 |
|
38 | 38 | > echo local > rev |
|
39 | 39 | > if [ "$1" != "" ] ; then $1 ; fi |
|
40 | 40 | > hg ci -m "local" |
|
41 | 41 | > |
|
42 | 42 | > # working dir |
|
43 | 43 | > echo local > rev |
|
44 | 44 | > if [ "$3" != "" ] ; then $3 ; fi |
|
45 | 45 | > |
|
46 | 46 | > # merge |
|
47 | 47 | > echo "--------------" |
|
48 | 48 | > echo "test L:$1 R:$2 W:$3 - $4" |
|
49 | 49 | > echo "--------------" |
|
50 | 50 | > hg merge -y --debug --traceback --tool="python ../merge" |
|
51 | 51 | > |
|
52 | 52 | > echo "--------------" |
|
53 | 53 | > hg status -camC -X rev |
|
54 | 54 | > |
|
55 | 55 | > hg ci -m "merge" |
|
56 | 56 | > |
|
57 | 57 | > echo "--------------" |
|
58 | 58 | > echo |
|
59 | 59 | > |
|
60 | 60 | > cd .. |
|
61 | 61 | > rm -r t |
|
62 | 62 | > } |
|
63 | 63 | $ up() { |
|
64 | 64 | > cp rev $1 |
|
65 | 65 | > hg add $1 2> /dev/null |
|
66 | 66 | > if [ "$2" != "" ] ; then |
|
67 | 67 | > cp rev $2 |
|
68 | 68 | > hg add $2 2> /dev/null |
|
69 | 69 | > fi |
|
70 | 70 | > } |
|
71 | 71 | $ uc() { up $1; hg cp $1 $2; } # update + copy |
|
72 | 72 | $ um() { up $1; hg mv $1 $2; } |
|
73 | 73 | $ nc() { hg cp $1 $2; } # just copy |
|
74 | 74 | $ nm() { hg mv $1 $2; } # just move |
|
75 | 75 | $ tm "up a " "nc a b" " " "1 get local a to b" |
|
76 | 76 | created new head |
|
77 | 77 | -------------- |
|
78 | 78 | test L:up a R:nc a b W: - 1 get local a to b |
|
79 | 79 | -------------- |
|
80 | 80 | searching for copies back to rev 1 |
|
81 | 81 | unmatched files in other: |
|
82 | 82 | b |
|
83 | 83 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
84 | 84 | src: 'a' -> dst: 'b' * |
|
85 | 85 | checking for directory renames |
|
86 | 86 | resolving manifests |
|
87 | 87 | overwrite: False, partial: False |
|
88 | 88 | ancestor: 924404dff337, local: e300d1c794ec+, remote: 4ce40f5aca24 |
|
89 | a: remote copied to b -> m | |
|
90 | preserving a for resolve of b | |
|
89 | 91 | rev: versions differ -> m |
|
90 | a: remote copied to b -> m | |
|
91 | preserving a for resolve of b | |
|
92 | preserving rev for resolve of rev | |
|
92 | preserving rev for resolve of rev | |
|
93 | 93 | updating: a 1/2 files (50.00%) |
|
94 | 94 | picked tool 'python ../merge' for b (binary False symlink False) |
|
95 | 95 | merging a and b to b |
|
96 | 96 | my b@e300d1c794ec+ other b@4ce40f5aca24 ancestor a@924404dff337 |
|
97 | 97 | premerge successful |
|
98 | 98 | updating: rev 2/2 files (100.00%) |
|
99 | 99 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
100 | 100 | merging rev |
|
101 | 101 | my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337 |
|
102 | 102 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
103 | 103 | (branch merge, don't forget to commit) |
|
104 | 104 | -------------- |
|
105 | 105 | M b |
|
106 | 106 | a |
|
107 | 107 | C a |
|
108 | 108 | -------------- |
|
109 | 109 | |
|
110 | 110 | $ tm "nc a b" "up a " " " "2 get rem change to a and b" |
|
111 | 111 | created new head |
|
112 | 112 | -------------- |
|
113 | 113 | test L:nc a b R:up a W: - 2 get rem change to a and b |
|
114 | 114 | -------------- |
|
115 | 115 | searching for copies back to rev 1 |
|
116 | 116 | unmatched files in local: |
|
117 | 117 | b |
|
118 | 118 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
119 | 119 | src: 'a' -> dst: 'b' * |
|
120 | 120 | checking for directory renames |
|
121 | 121 | resolving manifests |
|
122 | 122 | overwrite: False, partial: False |
|
123 | 123 | ancestor: 924404dff337, local: 86a2aa42fc76+, remote: f4db7e329e71 |
|
124 | 124 | a: remote is newer -> g |
|
125 | 125 | b: local copied/moved to a -> m |
|
126 | preserving b for resolve of b | |
|
126 | 127 | rev: versions differ -> m |
|
127 |
preserving |
|
|
128 | preserving rev for resolve of rev | |
|
128 | preserving rev for resolve of rev | |
|
129 | 129 | updating: a 1/3 files (33.33%) |
|
130 | 130 | getting a |
|
131 | 131 | updating: b 2/3 files (66.67%) |
|
132 | 132 | picked tool 'python ../merge' for b (binary False symlink False) |
|
133 | 133 | merging b and a to b |
|
134 | 134 | my b@86a2aa42fc76+ other a@f4db7e329e71 ancestor a@924404dff337 |
|
135 | 135 | premerge successful |
|
136 | 136 | updating: rev 3/3 files (100.00%) |
|
137 | 137 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
138 | 138 | merging rev |
|
139 | 139 | my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337 |
|
140 | 140 | 1 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
141 | 141 | (branch merge, don't forget to commit) |
|
142 | 142 | -------------- |
|
143 | 143 | M a |
|
144 | 144 | M b |
|
145 | 145 | a |
|
146 | 146 | -------------- |
|
147 | 147 | |
|
148 | 148 | $ tm "up a " "nm a b" " " "3 get local a change to b, remove a" |
|
149 | 149 | created new head |
|
150 | 150 | -------------- |
|
151 | 151 | test L:up a R:nm a b W: - 3 get local a change to b, remove a |
|
152 | 152 | -------------- |
|
153 | 153 | searching for copies back to rev 1 |
|
154 | 154 | unmatched files in other: |
|
155 | 155 | b |
|
156 | 156 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
157 | 157 | src: 'a' -> dst: 'b' * |
|
158 | 158 | checking for directory renames |
|
159 | 159 | resolving manifests |
|
160 | 160 | overwrite: False, partial: False |
|
161 | 161 | ancestor: 924404dff337, local: e300d1c794ec+, remote: bdb19105162a |
|
162 | a: remote moved to b -> m | |
|
163 | preserving a for resolve of b | |
|
162 | 164 | rev: versions differ -> m |
|
163 | a: remote moved to b -> m | |
|
164 | preserving a for resolve of b | |
|
165 | preserving rev for resolve of rev | |
|
165 | preserving rev for resolve of rev | |
|
166 | 166 | removing a |
|
167 | 167 | updating: a 1/2 files (50.00%) |
|
168 | 168 | picked tool 'python ../merge' for b (binary False symlink False) |
|
169 | 169 | merging a and b to b |
|
170 | 170 | my b@e300d1c794ec+ other b@bdb19105162a ancestor a@924404dff337 |
|
171 | 171 | premerge successful |
|
172 | 172 | updating: rev 2/2 files (100.00%) |
|
173 | 173 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
174 | 174 | merging rev |
|
175 | 175 | my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337 |
|
176 | 176 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
177 | 177 | (branch merge, don't forget to commit) |
|
178 | 178 | -------------- |
|
179 | 179 | M b |
|
180 | 180 | a |
|
181 | 181 | -------------- |
|
182 | 182 | |
|
183 | 183 | $ tm "nm a b" "up a " " " "4 get remote change to b" |
|
184 | 184 | created new head |
|
185 | 185 | -------------- |
|
186 | 186 | test L:nm a b R:up a W: - 4 get remote change to b |
|
187 | 187 | -------------- |
|
188 | 188 | searching for copies back to rev 1 |
|
189 | 189 | unmatched files in local: |
|
190 | 190 | b |
|
191 | 191 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
192 | 192 | src: 'a' -> dst: 'b' * |
|
193 | 193 | checking for directory renames |
|
194 | 194 | resolving manifests |
|
195 | 195 | overwrite: False, partial: False |
|
196 | 196 | ancestor: 924404dff337, local: 02963e448370+, remote: f4db7e329e71 |
|
197 | 197 | b: local copied/moved to a -> m |
|
198 | preserving b for resolve of b | |
|
198 | 199 | rev: versions differ -> m |
|
199 |
preserving |
|
|
200 | preserving rev for resolve of rev | |
|
200 | preserving rev for resolve of rev | |
|
201 | 201 | updating: b 1/2 files (50.00%) |
|
202 | 202 | picked tool 'python ../merge' for b (binary False symlink False) |
|
203 | 203 | merging b and a to b |
|
204 | 204 | my b@02963e448370+ other a@f4db7e329e71 ancestor a@924404dff337 |
|
205 | 205 | premerge successful |
|
206 | 206 | updating: rev 2/2 files (100.00%) |
|
207 | 207 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
208 | 208 | merging rev |
|
209 | 209 | my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337 |
|
210 | 210 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
211 | 211 | (branch merge, don't forget to commit) |
|
212 | 212 | -------------- |
|
213 | 213 | M b |
|
214 | 214 | a |
|
215 | 215 | -------------- |
|
216 | 216 | |
|
217 | 217 | $ tm " " "nc a b" " " "5 get b" |
|
218 | 218 | created new head |
|
219 | 219 | -------------- |
|
220 | 220 | test L: R:nc a b W: - 5 get b |
|
221 | 221 | -------------- |
|
222 | 222 | searching for copies back to rev 1 |
|
223 | 223 | unmatched files in other: |
|
224 | 224 | b |
|
225 | 225 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
226 | 226 | src: 'a' -> dst: 'b' |
|
227 | 227 | checking for directory renames |
|
228 | 228 | resolving manifests |
|
229 | 229 | overwrite: False, partial: False |
|
230 | 230 | ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: 4ce40f5aca24 |
|
231 | b: remote created -> g | |
|
231 | 232 | rev: versions differ -> m |
|
232 | b: remote created -> g | |
|
233 | preserving rev for resolve of rev | |
|
233 | preserving rev for resolve of rev | |
|
234 | 234 | updating: b 1/2 files (50.00%) |
|
235 | 235 | getting b |
|
236 | 236 | updating: rev 2/2 files (100.00%) |
|
237 | 237 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
238 | 238 | merging rev |
|
239 | 239 | my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337 |
|
240 | 240 | 1 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
241 | 241 | (branch merge, don't forget to commit) |
|
242 | 242 | -------------- |
|
243 | 243 | M b |
|
244 | 244 | C a |
|
245 | 245 | -------------- |
|
246 | 246 | |
|
247 | 247 | $ tm "nc a b" " " " " "6 nothing" |
|
248 | 248 | created new head |
|
249 | 249 | -------------- |
|
250 | 250 | test L:nc a b R: W: - 6 nothing |
|
251 | 251 | -------------- |
|
252 | 252 | searching for copies back to rev 1 |
|
253 | 253 | unmatched files in local: |
|
254 | 254 | b |
|
255 | 255 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
256 | 256 | src: 'a' -> dst: 'b' |
|
257 | 257 | checking for directory renames |
|
258 | 258 | resolving manifests |
|
259 | 259 | overwrite: False, partial: False |
|
260 | 260 | ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 97c705ade336 |
|
261 | 261 | rev: versions differ -> m |
|
262 | preserving rev for resolve of rev | |
|
262 | preserving rev for resolve of rev | |
|
263 | 263 | updating: rev 1/1 files (100.00%) |
|
264 | 264 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
265 | 265 | merging rev |
|
266 | 266 | my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337 |
|
267 | 267 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
268 | 268 | (branch merge, don't forget to commit) |
|
269 | 269 | -------------- |
|
270 | 270 | C a |
|
271 | 271 | C b |
|
272 | 272 | -------------- |
|
273 | 273 | |
|
274 | 274 | $ tm " " "nm a b" " " "7 get b" |
|
275 | 275 | created new head |
|
276 | 276 | -------------- |
|
277 | 277 | test L: R:nm a b W: - 7 get b |
|
278 | 278 | -------------- |
|
279 | 279 | searching for copies back to rev 1 |
|
280 | 280 | unmatched files in other: |
|
281 | 281 | b |
|
282 | 282 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
283 | 283 | src: 'a' -> dst: 'b' |
|
284 | 284 | checking for directory renames |
|
285 | 285 | resolving manifests |
|
286 | 286 | overwrite: False, partial: False |
|
287 | 287 | ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: bdb19105162a |
|
288 | 288 | a: other deleted -> r |
|
289 | b: remote created -> g | |
|
289 | 290 | rev: versions differ -> m |
|
290 | b: remote created -> g | |
|
291 | preserving rev for resolve of rev | |
|
291 | preserving rev for resolve of rev | |
|
292 | 292 | updating: a 1/3 files (33.33%) |
|
293 | 293 | removing a |
|
294 | 294 | updating: b 2/3 files (66.67%) |
|
295 | 295 | getting b |
|
296 | 296 | updating: rev 3/3 files (100.00%) |
|
297 | 297 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
298 | 298 | merging rev |
|
299 | 299 | my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337 |
|
300 | 300 | 1 files updated, 1 files merged, 1 files removed, 0 files unresolved |
|
301 | 301 | (branch merge, don't forget to commit) |
|
302 | 302 | -------------- |
|
303 | 303 | M b |
|
304 | 304 | -------------- |
|
305 | 305 | |
|
306 | 306 | $ tm "nm a b" " " " " "8 nothing" |
|
307 | 307 | created new head |
|
308 | 308 | -------------- |
|
309 | 309 | test L:nm a b R: W: - 8 nothing |
|
310 | 310 | -------------- |
|
311 | 311 | searching for copies back to rev 1 |
|
312 | 312 | unmatched files in local: |
|
313 | 313 | b |
|
314 | 314 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
315 | 315 | src: 'a' -> dst: 'b' |
|
316 | 316 | checking for directory renames |
|
317 | 317 | resolving manifests |
|
318 | 318 | overwrite: False, partial: False |
|
319 | 319 | ancestor: 924404dff337, local: 02963e448370+, remote: 97c705ade336 |
|
320 | 320 | rev: versions differ -> m |
|
321 | preserving rev for resolve of rev | |
|
321 | preserving rev for resolve of rev | |
|
322 | 322 | updating: rev 1/1 files (100.00%) |
|
323 | 323 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
324 | 324 | merging rev |
|
325 | 325 | my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337 |
|
326 | 326 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
327 | 327 | (branch merge, don't forget to commit) |
|
328 | 328 | -------------- |
|
329 | 329 | C b |
|
330 | 330 | -------------- |
|
331 | 331 | |
|
332 | 332 | $ tm "um a b" "um a b" " " "9 do merge with ancestor in a" |
|
333 | 333 | created new head |
|
334 | 334 | -------------- |
|
335 | 335 | test L:um a b R:um a b W: - 9 do merge with ancestor in a |
|
336 | 336 | -------------- |
|
337 | 337 | searching for copies back to rev 1 |
|
338 | 338 | resolving manifests |
|
339 | 339 | overwrite: False, partial: False |
|
340 | 340 | ancestor: 924404dff337, local: 62e7bf090eba+, remote: 49b6d8032493 |
|
341 | 341 | b: versions differ -> m |
|
342 | preserving b for resolve of b | |
|
342 | 343 | rev: versions differ -> m |
|
343 |
preserving |
|
|
344 | preserving rev for resolve of rev | |
|
344 | preserving rev for resolve of rev | |
|
345 | 345 | updating: b 1/2 files (50.00%) |
|
346 | 346 | picked tool 'python ../merge' for b (binary False symlink False) |
|
347 | 347 | merging b |
|
348 | 348 | my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337 |
|
349 | 349 | updating: rev 2/2 files (100.00%) |
|
350 | 350 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
351 | 351 | merging rev |
|
352 | 352 | my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337 |
|
353 | 353 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
354 | 354 | (branch merge, don't forget to commit) |
|
355 | 355 | -------------- |
|
356 | 356 | M b |
|
357 | 357 | -------------- |
|
358 | 358 | |
|
359 | 359 | |
|
360 | 360 | m "um a c" "um x c" " " "10 do merge with no ancestor" |
|
361 | 361 | |
|
362 | 362 | $ tm "nm a b" "nm a c" " " "11 get c, keep b" |
|
363 | 363 | created new head |
|
364 | 364 | -------------- |
|
365 | 365 | test L:nm a b R:nm a c W: - 11 get c, keep b |
|
366 | 366 | -------------- |
|
367 | 367 | searching for copies back to rev 1 |
|
368 | 368 | unmatched files in local: |
|
369 | 369 | b |
|
370 | 370 | unmatched files in other: |
|
371 | 371 | c |
|
372 | 372 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
373 | 373 | src: 'a' -> dst: 'b' ! |
|
374 | 374 | src: 'a' -> dst: 'c' ! |
|
375 | 375 | checking for directory renames |
|
376 | a: divergent renames -> dr | |
|
377 | 376 | resolving manifests |
|
378 | 377 | overwrite: False, partial: False |
|
379 | 378 | ancestor: 924404dff337, local: 02963e448370+, remote: fe905ef2c33e |
|
380 | rev: versions differ -> m | |
|
379 | a: divergent renames -> dr | |
|
381 | 380 | c: remote created -> g |
|
382 | preserving rev for resolve of rev | |
|
381 | rev: versions differ -> m | |
|
382 | preserving rev for resolve of rev | |
|
383 | 383 | updating: a 1/3 files (33.33%) |
|
384 | 384 | note: possible conflict - a was renamed multiple times to: |
|
385 | 385 | b |
|
386 | 386 | c |
|
387 | 387 | updating: c 2/3 files (66.67%) |
|
388 | 388 | getting c |
|
389 | 389 | updating: rev 3/3 files (100.00%) |
|
390 | 390 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
391 | 391 | merging rev |
|
392 | 392 | my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337 |
|
393 | 393 | 1 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
394 | 394 | (branch merge, don't forget to commit) |
|
395 | 395 | -------------- |
|
396 | 396 | M c |
|
397 | 397 | C b |
|
398 | 398 | -------------- |
|
399 | 399 | |
|
400 | 400 | $ tm "nc a b" "up b " " " "12 merge b no ancestor" |
|
401 | 401 | created new head |
|
402 | 402 | -------------- |
|
403 | 403 | test L:nc a b R:up b W: - 12 merge b no ancestor |
|
404 | 404 | -------------- |
|
405 | 405 | searching for copies back to rev 1 |
|
406 | 406 | resolving manifests |
|
407 | 407 | overwrite: False, partial: False |
|
408 | 408 | ancestor: 924404dff337, local: 86a2aa42fc76+, remote: af30c7647fc7 |
|
409 | 409 | b: versions differ -> m |
|
410 | preserving b for resolve of b | |
|
410 | 411 | rev: versions differ -> m |
|
411 |
preserving |
|
|
412 | preserving rev for resolve of rev | |
|
412 | preserving rev for resolve of rev | |
|
413 | 413 | updating: b 1/2 files (50.00%) |
|
414 | 414 | picked tool 'python ../merge' for b (binary False symlink False) |
|
415 | 415 | merging b |
|
416 | 416 | my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000 |
|
417 | 417 | updating: rev 2/2 files (100.00%) |
|
418 | 418 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
419 | 419 | merging rev |
|
420 | 420 | my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337 |
|
421 | 421 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
422 | 422 | (branch merge, don't forget to commit) |
|
423 | 423 | -------------- |
|
424 | 424 | M b |
|
425 | 425 | C a |
|
426 | 426 | -------------- |
|
427 | 427 | |
|
428 | 428 | $ tm "up b " "nm a b" " " "13 merge b no ancestor" |
|
429 | 429 | created new head |
|
430 | 430 | -------------- |
|
431 | 431 | test L:up b R:nm a b W: - 13 merge b no ancestor |
|
432 | 432 | -------------- |
|
433 | 433 | searching for copies back to rev 1 |
|
434 | 434 | resolving manifests |
|
435 | 435 | overwrite: False, partial: False |
|
436 | 436 | ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a |
|
437 | 437 | a: other deleted -> r |
|
438 | 438 | b: versions differ -> m |
|
439 | preserving b for resolve of b | |
|
439 | 440 | rev: versions differ -> m |
|
440 |
preserving |
|
|
441 | preserving rev for resolve of rev | |
|
441 | preserving rev for resolve of rev | |
|
442 | 442 | updating: a 1/3 files (33.33%) |
|
443 | 443 | removing a |
|
444 | 444 | updating: b 2/3 files (66.67%) |
|
445 | 445 | picked tool 'python ../merge' for b (binary False symlink False) |
|
446 | 446 | merging b |
|
447 | 447 | my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000 |
|
448 | 448 | updating: rev 3/3 files (100.00%) |
|
449 | 449 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
450 | 450 | merging rev |
|
451 | 451 | my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337 |
|
452 | 452 | 0 files updated, 2 files merged, 1 files removed, 0 files unresolved |
|
453 | 453 | (branch merge, don't forget to commit) |
|
454 | 454 | -------------- |
|
455 | 455 | M b |
|
456 | 456 | -------------- |
|
457 | 457 | |
|
458 | 458 | $ tm "nc a b" "up a b" " " "14 merge b no ancestor" |
|
459 | 459 | created new head |
|
460 | 460 | -------------- |
|
461 | 461 | test L:nc a b R:up a b W: - 14 merge b no ancestor |
|
462 | 462 | -------------- |
|
463 | 463 | searching for copies back to rev 1 |
|
464 | 464 | resolving manifests |
|
465 | 465 | overwrite: False, partial: False |
|
466 | 466 | ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a |
|
467 | 467 | a: remote is newer -> g |
|
468 | 468 | b: versions differ -> m |
|
469 | preserving b for resolve of b | |
|
469 | 470 | rev: versions differ -> m |
|
470 |
preserving |
|
|
471 | preserving rev for resolve of rev | |
|
471 | preserving rev for resolve of rev | |
|
472 | 472 | updating: a 1/3 files (33.33%) |
|
473 | 473 | getting a |
|
474 | 474 | updating: b 2/3 files (66.67%) |
|
475 | 475 | picked tool 'python ../merge' for b (binary False symlink False) |
|
476 | 476 | merging b |
|
477 | 477 | my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000 |
|
478 | 478 | updating: rev 3/3 files (100.00%) |
|
479 | 479 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
480 | 480 | merging rev |
|
481 | 481 | my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337 |
|
482 | 482 | 1 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
483 | 483 | (branch merge, don't forget to commit) |
|
484 | 484 | -------------- |
|
485 | 485 | M a |
|
486 | 486 | M b |
|
487 | 487 | -------------- |
|
488 | 488 | |
|
489 | 489 | $ tm "up b " "nm a b" " " "15 merge b no ancestor, remove a" |
|
490 | 490 | created new head |
|
491 | 491 | -------------- |
|
492 | 492 | test L:up b R:nm a b W: - 15 merge b no ancestor, remove a |
|
493 | 493 | -------------- |
|
494 | 494 | searching for copies back to rev 1 |
|
495 | 495 | resolving manifests |
|
496 | 496 | overwrite: False, partial: False |
|
497 | 497 | ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a |
|
498 | 498 | a: other deleted -> r |
|
499 | 499 | b: versions differ -> m |
|
500 | preserving b for resolve of b | |
|
500 | 501 | rev: versions differ -> m |
|
501 |
preserving |
|
|
502 | preserving rev for resolve of rev | |
|
502 | preserving rev for resolve of rev | |
|
503 | 503 | updating: a 1/3 files (33.33%) |
|
504 | 504 | removing a |
|
505 | 505 | updating: b 2/3 files (66.67%) |
|
506 | 506 | picked tool 'python ../merge' for b (binary False symlink False) |
|
507 | 507 | merging b |
|
508 | 508 | my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000 |
|
509 | 509 | updating: rev 3/3 files (100.00%) |
|
510 | 510 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
511 | 511 | merging rev |
|
512 | 512 | my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337 |
|
513 | 513 | 0 files updated, 2 files merged, 1 files removed, 0 files unresolved |
|
514 | 514 | (branch merge, don't forget to commit) |
|
515 | 515 | -------------- |
|
516 | 516 | M b |
|
517 | 517 | -------------- |
|
518 | 518 | |
|
519 | 519 | $ tm "nc a b" "up a b" " " "16 get a, merge b no ancestor" |
|
520 | 520 | created new head |
|
521 | 521 | -------------- |
|
522 | 522 | test L:nc a b R:up a b W: - 16 get a, merge b no ancestor |
|
523 | 523 | -------------- |
|
524 | 524 | searching for copies back to rev 1 |
|
525 | 525 | resolving manifests |
|
526 | 526 | overwrite: False, partial: False |
|
527 | 527 | ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a |
|
528 | 528 | a: remote is newer -> g |
|
529 | 529 | b: versions differ -> m |
|
530 | preserving b for resolve of b | |
|
530 | 531 | rev: versions differ -> m |
|
531 |
preserving |
|
|
532 | preserving rev for resolve of rev | |
|
532 | preserving rev for resolve of rev | |
|
533 | 533 | updating: a 1/3 files (33.33%) |
|
534 | 534 | getting a |
|
535 | 535 | updating: b 2/3 files (66.67%) |
|
536 | 536 | picked tool 'python ../merge' for b (binary False symlink False) |
|
537 | 537 | merging b |
|
538 | 538 | my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000 |
|
539 | 539 | updating: rev 3/3 files (100.00%) |
|
540 | 540 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
541 | 541 | merging rev |
|
542 | 542 | my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337 |
|
543 | 543 | 1 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
544 | 544 | (branch merge, don't forget to commit) |
|
545 | 545 | -------------- |
|
546 | 546 | M a |
|
547 | 547 | M b |
|
548 | 548 | -------------- |
|
549 | 549 | |
|
550 | 550 | $ tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor" |
|
551 | 551 | created new head |
|
552 | 552 | -------------- |
|
553 | 553 | test L:up a b R:nc a b W: - 17 keep a, merge b no ancestor |
|
554 | 554 | -------------- |
|
555 | 555 | searching for copies back to rev 1 |
|
556 | 556 | resolving manifests |
|
557 | 557 | overwrite: False, partial: False |
|
558 | 558 | ancestor: 924404dff337, local: 0b76e65c8289+, remote: 4ce40f5aca24 |
|
559 | 559 | b: versions differ -> m |
|
560 | preserving b for resolve of b | |
|
560 | 561 | rev: versions differ -> m |
|
561 |
preserving |
|
|
562 | preserving rev for resolve of rev | |
|
562 | preserving rev for resolve of rev | |
|
563 | 563 | updating: b 1/2 files (50.00%) |
|
564 | 564 | picked tool 'python ../merge' for b (binary False symlink False) |
|
565 | 565 | merging b |
|
566 | 566 | my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000 |
|
567 | 567 | updating: rev 2/2 files (100.00%) |
|
568 | 568 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
569 | 569 | merging rev |
|
570 | 570 | my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337 |
|
571 | 571 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
572 | 572 | (branch merge, don't forget to commit) |
|
573 | 573 | -------------- |
|
574 | 574 | M b |
|
575 | 575 | C a |
|
576 | 576 | -------------- |
|
577 | 577 | |
|
578 | 578 | $ tm "nm a b" "up a b" " " "18 merge b no ancestor" |
|
579 | 579 | created new head |
|
580 | 580 | -------------- |
|
581 | 581 | test L:nm a b R:up a b W: - 18 merge b no ancestor |
|
582 | 582 | -------------- |
|
583 | 583 | searching for copies back to rev 1 |
|
584 | 584 | resolving manifests |
|
585 | 585 | overwrite: False, partial: False |
|
586 | 586 | ancestor: 924404dff337, local: 02963e448370+, remote: 8dbce441892a |
|
587 | b: versions differ -> m | |
|
588 | rev: versions differ -> m | |
|
589 | 587 | remote changed a which local deleted |
|
590 | 588 | use (c)hanged version or leave (d)eleted? c |
|
591 | 589 | a: prompt recreating -> g |
|
592 | preserving b for resolve of b | |
|
593 |
preserving |
|
|
590 | b: versions differ -> m | |
|
591 | preserving b for resolve of b | |
|
592 | rev: versions differ -> m | |
|
593 | preserving rev for resolve of rev | |
|
594 | 594 | updating: a 1/3 files (33.33%) |
|
595 | 595 | getting a |
|
596 | 596 | updating: b 2/3 files (66.67%) |
|
597 | 597 | picked tool 'python ../merge' for b (binary False symlink False) |
|
598 | 598 | merging b |
|
599 | 599 | my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000 |
|
600 | 600 | updating: rev 3/3 files (100.00%) |
|
601 | 601 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
602 | 602 | merging rev |
|
603 | 603 | my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337 |
|
604 | 604 | 1 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
605 | 605 | (branch merge, don't forget to commit) |
|
606 | 606 | -------------- |
|
607 | 607 | M a |
|
608 | 608 | M b |
|
609 | 609 | -------------- |
|
610 | 610 | |
|
611 | 611 | $ tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a" |
|
612 | 612 | created new head |
|
613 | 613 | -------------- |
|
614 | 614 | test L:up a b R:nm a b W: - 19 merge b no ancestor, prompt remove a |
|
615 | 615 | -------------- |
|
616 | 616 | searching for copies back to rev 1 |
|
617 | 617 | resolving manifests |
|
618 | 618 | overwrite: False, partial: False |
|
619 | 619 | ancestor: 924404dff337, local: 0b76e65c8289+, remote: bdb19105162a |
|
620 | b: versions differ -> m | |
|
621 | rev: versions differ -> m | |
|
622 | 620 | local changed a which remote deleted |
|
623 | 621 | use (c)hanged version or (d)elete? c |
|
624 | 622 | a: prompt keep -> a |
|
625 | preserving b for resolve of b | |
|
626 |
preserving |
|
|
623 | b: versions differ -> m | |
|
624 | preserving b for resolve of b | |
|
625 | rev: versions differ -> m | |
|
626 | preserving rev for resolve of rev | |
|
627 | 627 | updating: a 1/3 files (33.33%) |
|
628 | 628 | updating: b 2/3 files (66.67%) |
|
629 | 629 | picked tool 'python ../merge' for b (binary False symlink False) |
|
630 | 630 | merging b |
|
631 | 631 | my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000 |
|
632 | 632 | updating: rev 3/3 files (100.00%) |
|
633 | 633 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
634 | 634 | merging rev |
|
635 | 635 | my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337 |
|
636 | 636 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
637 | 637 | (branch merge, don't forget to commit) |
|
638 | 638 | -------------- |
|
639 | 639 | M b |
|
640 | 640 | C a |
|
641 | 641 | -------------- |
|
642 | 642 | |
|
643 | 643 | $ tm "up a " "um a b" " " "20 merge a and b to b, remove a" |
|
644 | 644 | created new head |
|
645 | 645 | -------------- |
|
646 | 646 | test L:up a R:um a b W: - 20 merge a and b to b, remove a |
|
647 | 647 | -------------- |
|
648 | 648 | searching for copies back to rev 1 |
|
649 | 649 | unmatched files in other: |
|
650 | 650 | b |
|
651 | 651 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
652 | 652 | src: 'a' -> dst: 'b' * |
|
653 | 653 | checking for directory renames |
|
654 | 654 | resolving manifests |
|
655 | 655 | overwrite: False, partial: False |
|
656 | 656 | ancestor: 924404dff337, local: e300d1c794ec+, remote: 49b6d8032493 |
|
657 | a: remote moved to b -> m | |
|
658 | preserving a for resolve of b | |
|
657 | 659 | rev: versions differ -> m |
|
658 | a: remote moved to b -> m | |
|
659 | preserving a for resolve of b | |
|
660 | preserving rev for resolve of rev | |
|
660 | preserving rev for resolve of rev | |
|
661 | 661 | removing a |
|
662 | 662 | updating: a 1/2 files (50.00%) |
|
663 | 663 | picked tool 'python ../merge' for b (binary False symlink False) |
|
664 | 664 | merging a and b to b |
|
665 | 665 | my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337 |
|
666 | 666 | updating: rev 2/2 files (100.00%) |
|
667 | 667 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
668 | 668 | merging rev |
|
669 | 669 | my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337 |
|
670 | 670 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
671 | 671 | (branch merge, don't forget to commit) |
|
672 | 672 | -------------- |
|
673 | 673 | M b |
|
674 | 674 | a |
|
675 | 675 | -------------- |
|
676 | 676 | |
|
677 | 677 | $ tm "um a b" "up a " " " "21 merge a and b to b" |
|
678 | 678 | created new head |
|
679 | 679 | -------------- |
|
680 | 680 | test L:um a b R:up a W: - 21 merge a and b to b |
|
681 | 681 | -------------- |
|
682 | 682 | searching for copies back to rev 1 |
|
683 | 683 | unmatched files in local: |
|
684 | 684 | b |
|
685 | 685 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
686 | 686 | src: 'a' -> dst: 'b' * |
|
687 | 687 | checking for directory renames |
|
688 | 688 | resolving manifests |
|
689 | 689 | overwrite: False, partial: False |
|
690 | 690 | ancestor: 924404dff337, local: 62e7bf090eba+, remote: f4db7e329e71 |
|
691 | 691 | b: local copied/moved to a -> m |
|
692 | preserving b for resolve of b | |
|
692 | 693 | rev: versions differ -> m |
|
693 |
preserving |
|
|
694 | preserving rev for resolve of rev | |
|
694 | preserving rev for resolve of rev | |
|
695 | 695 | updating: b 1/2 files (50.00%) |
|
696 | 696 | picked tool 'python ../merge' for b (binary False symlink False) |
|
697 | 697 | merging b and a to b |
|
698 | 698 | my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337 |
|
699 | 699 | updating: rev 2/2 files (100.00%) |
|
700 | 700 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
701 | 701 | merging rev |
|
702 | 702 | my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337 |
|
703 | 703 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
704 | 704 | (branch merge, don't forget to commit) |
|
705 | 705 | -------------- |
|
706 | 706 | M b |
|
707 | 707 | a |
|
708 | 708 | -------------- |
|
709 | 709 | |
|
710 | 710 | |
|
711 | 711 | m "nm a b" "um x a" " " "22 get a, keep b" |
|
712 | 712 | |
|
713 | 713 | $ tm "nm a b" "up a c" " " "23 get c, keep b" |
|
714 | 714 | created new head |
|
715 | 715 | -------------- |
|
716 | 716 | test L:nm a b R:up a c W: - 23 get c, keep b |
|
717 | 717 | -------------- |
|
718 | 718 | searching for copies back to rev 1 |
|
719 | 719 | unmatched files in local: |
|
720 | 720 | b |
|
721 | 721 | unmatched files in other: |
|
722 | 722 | c |
|
723 | 723 | all copies found (* = to merge, ! = divergent, % = renamed and deleted): |
|
724 | 724 | src: 'a' -> dst: 'b' * |
|
725 | 725 | checking for directory renames |
|
726 | 726 | resolving manifests |
|
727 | 727 | overwrite: False, partial: False |
|
728 | 728 | ancestor: 924404dff337, local: 02963e448370+, remote: 2b958612230f |
|
729 | 729 | b: local copied/moved to a -> m |
|
730 | rev: versions differ -> m | |
|
730 | preserving b for resolve of b | |
|
731 | 731 | c: remote created -> g |
|
732 | preserving b for resolve of b | |
|
733 | preserving rev for resolve of rev | |
|
732 | rev: versions differ -> m | |
|
733 | preserving rev for resolve of rev | |
|
734 | 734 | updating: b 1/3 files (33.33%) |
|
735 | 735 | picked tool 'python ../merge' for b (binary False symlink False) |
|
736 | 736 | merging b and a to b |
|
737 | 737 | my b@02963e448370+ other a@2b958612230f ancestor a@924404dff337 |
|
738 | 738 | premerge successful |
|
739 | 739 | updating: c 2/3 files (66.67%) |
|
740 | 740 | getting c |
|
741 | 741 | updating: rev 3/3 files (100.00%) |
|
742 | 742 | picked tool 'python ../merge' for rev (binary False symlink False) |
|
743 | 743 | merging rev |
|
744 | 744 | my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337 |
|
745 | 745 | 1 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
746 | 746 | (branch merge, don't forget to commit) |
|
747 | 747 | -------------- |
|
748 | 748 | M b |
|
749 | 749 | a |
|
750 | 750 | M c |
|
751 | 751 | -------------- |
|
752 | 752 | |
|
753 | 753 | |
|
754 | 754 | $ cd .. |
@@ -1,1088 +1,1088 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 ci -Ams0 |
|
29 | 29 | adding a |
|
30 | 30 | $ hg sum |
|
31 | 31 | parent: 0:f7b1eb17ad24 tip |
|
32 | 32 | 0 |
|
33 | 33 | branch: default |
|
34 | 34 | commit: 1 added, 1 subrepos |
|
35 | 35 | update: (current) |
|
36 | 36 | $ hg ci -m1 |
|
37 | 37 | |
|
38 | 38 | Revert subrepo and test subrepo fileset keyword: |
|
39 | 39 | |
|
40 | 40 | $ echo b > s/a |
|
41 | 41 | $ hg revert "set:subrepo('glob:s*')" |
|
42 | 42 | reverting subrepo s |
|
43 | 43 | reverting s/a (glob) |
|
44 | 44 | $ rm s/a.orig |
|
45 | 45 | |
|
46 | 46 | Revert subrepo with no backup. The "reverting s/a" line is gone since |
|
47 | 47 | we're really running 'hg update' in the subrepo: |
|
48 | 48 | |
|
49 | 49 | $ echo b > s/a |
|
50 | 50 | $ hg revert --no-backup s |
|
51 | 51 | reverting subrepo s |
|
52 | 52 | |
|
53 | 53 | Issue2022: update -C |
|
54 | 54 | |
|
55 | 55 | $ echo b > s/a |
|
56 | 56 | $ hg sum |
|
57 | 57 | parent: 1:7cf8cfea66e4 tip |
|
58 | 58 | 1 |
|
59 | 59 | branch: default |
|
60 | 60 | commit: 1 subrepos |
|
61 | 61 | update: (current) |
|
62 | 62 | $ hg co -C 1 |
|
63 | 63 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
64 | 64 | $ hg sum |
|
65 | 65 | parent: 1:7cf8cfea66e4 tip |
|
66 | 66 | 1 |
|
67 | 67 | branch: default |
|
68 | 68 | commit: (clean) |
|
69 | 69 | update: (current) |
|
70 | 70 | |
|
71 | 71 | commands that require a clean repo should respect subrepos |
|
72 | 72 | |
|
73 | 73 | $ echo b >> s/a |
|
74 | 74 | $ hg backout tip |
|
75 | 75 | abort: uncommitted changes in subrepo s |
|
76 | 76 | [255] |
|
77 | 77 | $ hg revert -C -R s s/a |
|
78 | 78 | |
|
79 | 79 | add sub sub |
|
80 | 80 | |
|
81 | 81 | $ echo ss = ss > s/.hgsub |
|
82 | 82 | $ hg init s/ss |
|
83 | 83 | $ echo a > s/ss/a |
|
84 | 84 | $ hg -R s add s/.hgsub |
|
85 | 85 | $ hg -R s/ss add s/ss/a |
|
86 | 86 | $ hg sum |
|
87 | 87 | parent: 1:7cf8cfea66e4 tip |
|
88 | 88 | 1 |
|
89 | 89 | branch: default |
|
90 | 90 | commit: 1 subrepos |
|
91 | 91 | update: (current) |
|
92 | 92 | $ hg ci -m2 |
|
93 | 93 | committing subrepository s |
|
94 | 94 | committing subrepository s/ss (glob) |
|
95 | 95 | $ hg sum |
|
96 | 96 | parent: 2:df30734270ae tip |
|
97 | 97 | 2 |
|
98 | 98 | branch: default |
|
99 | 99 | commit: (clean) |
|
100 | 100 | update: (current) |
|
101 | 101 | |
|
102 | 102 | bump sub rev (and check it is ignored by ui.commitsubrepos) |
|
103 | 103 | |
|
104 | 104 | $ echo b > s/a |
|
105 | 105 | $ hg -R s ci -ms1 |
|
106 | 106 | $ hg --config ui.commitsubrepos=no ci -m3 |
|
107 | 107 | |
|
108 | 108 | leave sub dirty (and check ui.commitsubrepos=no aborts the commit) |
|
109 | 109 | |
|
110 | 110 | $ echo c > s/a |
|
111 | 111 | $ hg --config ui.commitsubrepos=no ci -m4 |
|
112 | 112 | abort: uncommitted changes in subrepo s |
|
113 | 113 | (use --subrepos for recursive commit) |
|
114 | 114 | [255] |
|
115 | 115 | $ hg id |
|
116 | 116 | f6affe3fbfaa+ tip |
|
117 | 117 | $ hg -R s ci -mc |
|
118 | 118 | $ hg id |
|
119 | 119 | f6affe3fbfaa+ tip |
|
120 | 120 | $ echo d > s/a |
|
121 | 121 | $ hg ci -m4 |
|
122 | 122 | committing subrepository s |
|
123 | 123 | $ hg tip -R s |
|
124 | 124 | changeset: 4:02dcf1d70411 |
|
125 | 125 | tag: tip |
|
126 | 126 | user: test |
|
127 | 127 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
128 | 128 | summary: 4 |
|
129 | 129 | |
|
130 | 130 | |
|
131 | 131 | check caching |
|
132 | 132 | |
|
133 | 133 | $ hg co 0 |
|
134 | 134 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
135 | 135 | $ hg debugsub |
|
136 | 136 | |
|
137 | 137 | restore |
|
138 | 138 | |
|
139 | 139 | $ hg co |
|
140 | 140 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
141 | 141 | $ hg debugsub |
|
142 | 142 | path s |
|
143 | 143 | source s |
|
144 | 144 | revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef |
|
145 | 145 | |
|
146 | 146 | new branch for merge tests |
|
147 | 147 | |
|
148 | 148 | $ hg co 1 |
|
149 | 149 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
150 | 150 | $ echo t = t >> .hgsub |
|
151 | 151 | $ hg init t |
|
152 | 152 | $ echo t > t/t |
|
153 | 153 | $ hg -R t add t |
|
154 | 154 | adding t/t (glob) |
|
155 | 155 | |
|
156 | 156 | 5 |
|
157 | 157 | |
|
158 | 158 | $ hg ci -m5 # add sub |
|
159 | 159 | committing subrepository t |
|
160 | 160 | created new head |
|
161 | 161 | $ echo t2 > t/t |
|
162 | 162 | |
|
163 | 163 | 6 |
|
164 | 164 | |
|
165 | 165 | $ hg st -R s |
|
166 | 166 | $ hg ci -m6 # change sub |
|
167 | 167 | committing subrepository t |
|
168 | 168 | $ hg debugsub |
|
169 | 169 | path s |
|
170 | 170 | source s |
|
171 | 171 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
172 | 172 | path t |
|
173 | 173 | source t |
|
174 | 174 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
175 | 175 | $ echo t3 > t/t |
|
176 | 176 | |
|
177 | 177 | 7 |
|
178 | 178 | |
|
179 | 179 | $ hg ci -m7 # change sub again for conflict test |
|
180 | 180 | committing subrepository t |
|
181 | 181 | $ hg rm .hgsub |
|
182 | 182 | |
|
183 | 183 | 8 |
|
184 | 184 | |
|
185 | 185 | $ hg ci -m8 # remove sub |
|
186 | 186 | |
|
187 | 187 | merge tests |
|
188 | 188 | |
|
189 | 189 | $ hg co -C 3 |
|
190 | 190 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
191 | 191 | $ hg merge 5 # test adding |
|
192 | 192 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
193 | 193 | (branch merge, don't forget to commit) |
|
194 | 194 | $ hg debugsub |
|
195 | 195 | path s |
|
196 | 196 | source s |
|
197 | 197 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
198 | 198 | path t |
|
199 | 199 | source t |
|
200 | 200 | revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382 |
|
201 | 201 | $ hg ci -m9 |
|
202 | 202 | created new head |
|
203 | 203 | $ hg merge 6 --debug # test change |
|
204 | 204 | searching for copies back to rev 2 |
|
205 | 205 | resolving manifests |
|
206 | 206 | overwrite: False, partial: False |
|
207 | 207 | ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4 |
|
208 | 208 | .hgsubstate: versions differ -> m |
|
209 | 209 | updating: .hgsubstate 1/1 files (100.00%) |
|
210 | 210 | subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec |
|
211 | 211 | subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg |
|
212 | 212 | getting subrepo t |
|
213 | 213 | searching for copies back to rev 1 |
|
214 | 214 | resolving manifests |
|
215 | 215 | overwrite: False, partial: False |
|
216 | 216 | ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a |
|
217 | 217 | t: remote is newer -> g |
|
218 | 218 | updating: t 1/1 files (100.00%) |
|
219 | 219 | getting t |
|
220 | 220 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
221 | 221 | (branch merge, don't forget to commit) |
|
222 | 222 | $ hg debugsub |
|
223 | 223 | path s |
|
224 | 224 | source s |
|
225 | 225 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
226 | 226 | path t |
|
227 | 227 | source t |
|
228 | 228 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
229 | 229 | $ echo conflict > t/t |
|
230 | 230 | $ hg ci -m10 |
|
231 | 231 | committing subrepository t |
|
232 | 232 | $ HGMERGE=internal:merge hg merge --debug 7 # test conflict |
|
233 | 233 | searching for copies back to rev 2 |
|
234 | 234 | resolving manifests |
|
235 | 235 | overwrite: False, partial: False |
|
236 | 236 | ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf |
|
237 | 237 | .hgsubstate: versions differ -> m |
|
238 | 238 | updating: .hgsubstate 1/1 files (100.00%) |
|
239 | 239 | subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4 |
|
240 | 240 | subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg |
|
241 | 241 | merging subrepo t |
|
242 | 242 | searching for copies back to rev 2 |
|
243 | 243 | resolving manifests |
|
244 | 244 | overwrite: False, partial: False |
|
245 | 245 | ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198 |
|
246 | 246 | t: versions differ -> m |
|
247 | preserving t for resolve of t | |
|
247 | preserving t for resolve of t | |
|
248 | 248 | updating: t 1/1 files (100.00%) |
|
249 | 249 | picked tool 'internal:merge' for t (binary False symlink False) |
|
250 | 250 | merging t |
|
251 | 251 | my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a |
|
252 | 252 | warning: conflicts during merge. |
|
253 | 253 | merging t incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
254 | 254 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
255 | 255 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
256 | 256 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
257 | 257 | (branch merge, don't forget to commit) |
|
258 | 258 | |
|
259 | 259 | should conflict |
|
260 | 260 | |
|
261 | 261 | $ cat t/t |
|
262 | 262 | <<<<<<< local |
|
263 | 263 | conflict |
|
264 | 264 | ======= |
|
265 | 265 | t3 |
|
266 | 266 | >>>>>>> other |
|
267 | 267 | |
|
268 | 268 | clone |
|
269 | 269 | |
|
270 | 270 | $ cd .. |
|
271 | 271 | $ hg clone t tc |
|
272 | 272 | updating to branch default |
|
273 | 273 | cloning subrepo s from $TESTTMP/t/s (glob) |
|
274 | 274 | cloning subrepo s/ss from $TESTTMP/t/s/ss (glob) |
|
275 | 275 | cloning subrepo t from $TESTTMP/t/t (glob) |
|
276 | 276 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
277 | 277 | $ cd tc |
|
278 | 278 | $ hg debugsub |
|
279 | 279 | path s |
|
280 | 280 | source s |
|
281 | 281 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
282 | 282 | path t |
|
283 | 283 | source t |
|
284 | 284 | revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e |
|
285 | 285 | |
|
286 | 286 | push |
|
287 | 287 | |
|
288 | 288 | $ echo bah > t/t |
|
289 | 289 | $ hg ci -m11 |
|
290 | 290 | committing subrepository t |
|
291 | 291 | $ hg push |
|
292 | 292 | pushing to $TESTTMP/t (glob) |
|
293 | 293 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
294 | 294 | searching for changes |
|
295 | 295 | no changes found |
|
296 | 296 | pushing subrepo s to $TESTTMP/t/s (glob) |
|
297 | 297 | searching for changes |
|
298 | 298 | no changes found |
|
299 | 299 | pushing subrepo t to $TESTTMP/t/t (glob) |
|
300 | 300 | searching for changes |
|
301 | 301 | adding changesets |
|
302 | 302 | adding manifests |
|
303 | 303 | adding file changes |
|
304 | 304 | added 1 changesets with 1 changes to 1 files |
|
305 | 305 | searching for changes |
|
306 | 306 | adding changesets |
|
307 | 307 | adding manifests |
|
308 | 308 | adding file changes |
|
309 | 309 | added 1 changesets with 1 changes to 1 files |
|
310 | 310 | |
|
311 | 311 | push -f |
|
312 | 312 | |
|
313 | 313 | $ echo bah > s/a |
|
314 | 314 | $ hg ci -m12 |
|
315 | 315 | committing subrepository s |
|
316 | 316 | $ hg push |
|
317 | 317 | pushing to $TESTTMP/t (glob) |
|
318 | 318 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
319 | 319 | searching for changes |
|
320 | 320 | no changes found |
|
321 | 321 | pushing subrepo s to $TESTTMP/t/s (glob) |
|
322 | 322 | searching for changes |
|
323 | 323 | abort: push creates new remote head 12a213df6fa9! (in subrepo s) |
|
324 | 324 | (did you forget to merge? use push -f to force) |
|
325 | 325 | [255] |
|
326 | 326 | $ hg push -f |
|
327 | 327 | pushing to $TESTTMP/t (glob) |
|
328 | 328 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
329 | 329 | searching for changes |
|
330 | 330 | no changes found |
|
331 | 331 | pushing subrepo s to $TESTTMP/t/s (glob) |
|
332 | 332 | searching for changes |
|
333 | 333 | adding changesets |
|
334 | 334 | adding manifests |
|
335 | 335 | adding file changes |
|
336 | 336 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
337 | 337 | pushing subrepo t to $TESTTMP/t/t (glob) |
|
338 | 338 | searching for changes |
|
339 | 339 | no changes found |
|
340 | 340 | searching for changes |
|
341 | 341 | adding changesets |
|
342 | 342 | adding manifests |
|
343 | 343 | adding file changes |
|
344 | 344 | added 1 changesets with 1 changes to 1 files |
|
345 | 345 | |
|
346 | 346 | update |
|
347 | 347 | |
|
348 | 348 | $ cd ../t |
|
349 | 349 | $ hg up -C # discard our earlier merge |
|
350 | 350 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
351 | 351 | $ echo blah > t/t |
|
352 | 352 | $ hg ci -m13 |
|
353 | 353 | committing subrepository t |
|
354 | 354 | |
|
355 | 355 | pull |
|
356 | 356 | |
|
357 | 357 | $ cd ../tc |
|
358 | 358 | $ hg pull |
|
359 | 359 | pulling from $TESTTMP/t (glob) |
|
360 | 360 | searching for changes |
|
361 | 361 | adding changesets |
|
362 | 362 | adding manifests |
|
363 | 363 | adding file changes |
|
364 | 364 | added 1 changesets with 1 changes to 1 files |
|
365 | 365 | (run 'hg update' to get a working copy) |
|
366 | 366 | |
|
367 | 367 | should pull t |
|
368 | 368 | |
|
369 | 369 | $ hg up |
|
370 | 370 | pulling subrepo t from $TESTTMP/t/t (glob) |
|
371 | 371 | searching for changes |
|
372 | 372 | adding changesets |
|
373 | 373 | adding manifests |
|
374 | 374 | adding file changes |
|
375 | 375 | added 1 changesets with 1 changes to 1 files |
|
376 | 376 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
377 | 377 | $ cat t/t |
|
378 | 378 | blah |
|
379 | 379 | |
|
380 | 380 | bogus subrepo path aborts |
|
381 | 381 | |
|
382 | 382 | $ echo 'bogus=[boguspath' >> .hgsub |
|
383 | 383 | $ hg ci -m 'bogus subrepo path' |
|
384 | 384 | abort: missing ] in subrepo source |
|
385 | 385 | [255] |
|
386 | 386 | |
|
387 | 387 | Issue1986: merge aborts when trying to merge a subrepo that |
|
388 | 388 | shouldn't need merging |
|
389 | 389 | |
|
390 | 390 | # subrepo layout |
|
391 | 391 | # |
|
392 | 392 | # o 5 br |
|
393 | 393 | # /| |
|
394 | 394 | # o | 4 default |
|
395 | 395 | # | | |
|
396 | 396 | # | o 3 br |
|
397 | 397 | # |/| |
|
398 | 398 | # o | 2 default |
|
399 | 399 | # | | |
|
400 | 400 | # | o 1 br |
|
401 | 401 | # |/ |
|
402 | 402 | # o 0 default |
|
403 | 403 | |
|
404 | 404 | $ cd .. |
|
405 | 405 | $ rm -rf sub |
|
406 | 406 | $ hg init main |
|
407 | 407 | $ cd main |
|
408 | 408 | $ hg init s |
|
409 | 409 | $ cd s |
|
410 | 410 | $ echo a > a |
|
411 | 411 | $ hg ci -Am1 |
|
412 | 412 | adding a |
|
413 | 413 | $ hg branch br |
|
414 | 414 | marked working directory as branch br |
|
415 | 415 | (branches are permanent and global, did you want a bookmark?) |
|
416 | 416 | $ echo a >> a |
|
417 | 417 | $ hg ci -m1 |
|
418 | 418 | $ hg up default |
|
419 | 419 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
420 | 420 | $ echo b > b |
|
421 | 421 | $ hg ci -Am1 |
|
422 | 422 | adding b |
|
423 | 423 | $ hg up br |
|
424 | 424 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
425 | 425 | $ hg merge tip |
|
426 | 426 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
427 | 427 | (branch merge, don't forget to commit) |
|
428 | 428 | $ hg ci -m1 |
|
429 | 429 | $ hg up 2 |
|
430 | 430 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
431 | 431 | $ echo c > c |
|
432 | 432 | $ hg ci -Am1 |
|
433 | 433 | adding c |
|
434 | 434 | $ hg up 3 |
|
435 | 435 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
436 | 436 | $ hg merge 4 |
|
437 | 437 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
438 | 438 | (branch merge, don't forget to commit) |
|
439 | 439 | $ hg ci -m1 |
|
440 | 440 | |
|
441 | 441 | # main repo layout: |
|
442 | 442 | # |
|
443 | 443 | # * <-- try to merge default into br again |
|
444 | 444 | # .`| |
|
445 | 445 | # . o 5 br --> substate = 5 |
|
446 | 446 | # . | |
|
447 | 447 | # o | 4 default --> substate = 4 |
|
448 | 448 | # | | |
|
449 | 449 | # | o 3 br --> substate = 2 |
|
450 | 450 | # |/| |
|
451 | 451 | # o | 2 default --> substate = 2 |
|
452 | 452 | # | | |
|
453 | 453 | # | o 1 br --> substate = 3 |
|
454 | 454 | # |/ |
|
455 | 455 | # o 0 default --> substate = 2 |
|
456 | 456 | |
|
457 | 457 | $ cd .. |
|
458 | 458 | $ echo 's = s' > .hgsub |
|
459 | 459 | $ hg -R s up 2 |
|
460 | 460 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
461 | 461 | $ hg ci -Am1 |
|
462 | 462 | adding .hgsub |
|
463 | 463 | $ hg branch br |
|
464 | 464 | marked working directory as branch br |
|
465 | 465 | (branches are permanent and global, did you want a bookmark?) |
|
466 | 466 | $ echo b > b |
|
467 | 467 | $ hg -R s up 3 |
|
468 | 468 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
469 | 469 | $ hg ci -Am1 |
|
470 | 470 | adding b |
|
471 | 471 | $ hg up default |
|
472 | 472 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
473 | 473 | $ echo c > c |
|
474 | 474 | $ hg ci -Am1 |
|
475 | 475 | adding c |
|
476 | 476 | $ hg up 1 |
|
477 | 477 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
478 | 478 | $ hg merge 2 |
|
479 | 479 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
480 | 480 | (branch merge, don't forget to commit) |
|
481 | 481 | $ hg ci -m1 |
|
482 | 482 | $ hg up 2 |
|
483 | 483 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
484 | 484 | $ hg -R s up 4 |
|
485 | 485 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
486 | 486 | $ echo d > d |
|
487 | 487 | $ hg ci -Am1 |
|
488 | 488 | adding d |
|
489 | 489 | $ hg up 3 |
|
490 | 490 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
491 | 491 | $ hg -R s up 5 |
|
492 | 492 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
493 | 493 | $ echo e > e |
|
494 | 494 | $ hg ci -Am1 |
|
495 | 495 | adding e |
|
496 | 496 | |
|
497 | 497 | $ hg up 5 |
|
498 | 498 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
499 | 499 | $ hg merge 4 # try to merge default into br again |
|
500 | 500 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
501 | 501 | (branch merge, don't forget to commit) |
|
502 | 502 | $ cd .. |
|
503 | 503 | |
|
504 | 504 | test subrepo delete from .hgsubstate |
|
505 | 505 | |
|
506 | 506 | $ hg init testdelete |
|
507 | 507 | $ mkdir testdelete/nested testdelete/nested2 |
|
508 | 508 | $ hg init testdelete/nested |
|
509 | 509 | $ hg init testdelete/nested2 |
|
510 | 510 | $ echo test > testdelete/nested/foo |
|
511 | 511 | $ echo test > testdelete/nested2/foo |
|
512 | 512 | $ hg -R testdelete/nested add |
|
513 | 513 | adding testdelete/nested/foo (glob) |
|
514 | 514 | $ hg -R testdelete/nested2 add |
|
515 | 515 | adding testdelete/nested2/foo (glob) |
|
516 | 516 | $ hg -R testdelete/nested ci -m test |
|
517 | 517 | $ hg -R testdelete/nested2 ci -m test |
|
518 | 518 | $ echo nested = nested > testdelete/.hgsub |
|
519 | 519 | $ echo nested2 = nested2 >> testdelete/.hgsub |
|
520 | 520 | $ hg -R testdelete add |
|
521 | 521 | adding testdelete/.hgsub (glob) |
|
522 | 522 | $ hg -R testdelete ci -m "nested 1 & 2 added" |
|
523 | 523 | $ echo nested = nested > testdelete/.hgsub |
|
524 | 524 | $ hg -R testdelete ci -m "nested 2 deleted" |
|
525 | 525 | $ cat testdelete/.hgsubstate |
|
526 | 526 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested |
|
527 | 527 | $ hg -R testdelete remove testdelete/.hgsub |
|
528 | 528 | $ hg -R testdelete ci -m ".hgsub deleted" |
|
529 | 529 | $ cat testdelete/.hgsubstate |
|
530 | 530 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested |
|
531 | 531 | |
|
532 | 532 | test repository cloning |
|
533 | 533 | |
|
534 | 534 | $ mkdir mercurial mercurial2 |
|
535 | 535 | $ hg init nested_absolute |
|
536 | 536 | $ echo test > nested_absolute/foo |
|
537 | 537 | $ hg -R nested_absolute add |
|
538 | 538 | adding nested_absolute/foo (glob) |
|
539 | 539 | $ hg -R nested_absolute ci -mtest |
|
540 | 540 | $ cd mercurial |
|
541 | 541 | $ hg init nested_relative |
|
542 | 542 | $ echo test2 > nested_relative/foo2 |
|
543 | 543 | $ hg -R nested_relative add |
|
544 | 544 | adding nested_relative/foo2 (glob) |
|
545 | 545 | $ hg -R nested_relative ci -mtest2 |
|
546 | 546 | $ hg init main |
|
547 | 547 | $ echo "nested_relative = ../nested_relative" > main/.hgsub |
|
548 | 548 | $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub |
|
549 | 549 | $ hg -R main add |
|
550 | 550 | adding main/.hgsub (glob) |
|
551 | 551 | $ hg -R main ci -m "add subrepos" |
|
552 | 552 | $ cd .. |
|
553 | 553 | $ hg clone mercurial/main mercurial2/main |
|
554 | 554 | updating to branch default |
|
555 | 555 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
556 | 556 | $ cat mercurial2/main/nested_absolute/.hg/hgrc \ |
|
557 | 557 | > mercurial2/main/nested_relative/.hg/hgrc |
|
558 | 558 | [paths] |
|
559 | 559 | default = $TESTTMP/mercurial/nested_absolute |
|
560 | 560 | [paths] |
|
561 | 561 | default = $TESTTMP/mercurial/nested_relative |
|
562 | 562 | $ rm -rf mercurial mercurial2 |
|
563 | 563 | |
|
564 | 564 | Issue1977: multirepo push should fail if subrepo push fails |
|
565 | 565 | |
|
566 | 566 | $ hg init repo |
|
567 | 567 | $ hg init repo/s |
|
568 | 568 | $ echo a > repo/s/a |
|
569 | 569 | $ hg -R repo/s ci -Am0 |
|
570 | 570 | adding a |
|
571 | 571 | $ echo s = s > repo/.hgsub |
|
572 | 572 | $ hg -R repo ci -Am1 |
|
573 | 573 | adding .hgsub |
|
574 | 574 | $ hg clone repo repo2 |
|
575 | 575 | updating to branch default |
|
576 | 576 | cloning subrepo s from $TESTTMP/repo/s (glob) |
|
577 | 577 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
578 | 578 | $ hg -q -R repo2 pull -u |
|
579 | 579 | $ echo 1 > repo2/s/a |
|
580 | 580 | $ hg -R repo2/s ci -m2 |
|
581 | 581 | $ hg -q -R repo2/s push |
|
582 | 582 | $ hg -R repo2/s up -C 0 |
|
583 | 583 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
584 | 584 | $ echo 2 > repo2/s/b |
|
585 | 585 | $ hg -R repo2/s ci -m3 -A |
|
586 | 586 | adding b |
|
587 | 587 | created new head |
|
588 | 588 | $ hg -R repo2 ci -m3 |
|
589 | 589 | $ hg -q -R repo2 push |
|
590 | 590 | abort: push creates new remote head cc505f09a8b2! (in subrepo s) |
|
591 | 591 | (did you forget to merge? use push -f to force) |
|
592 | 592 | [255] |
|
593 | 593 | $ hg -R repo update |
|
594 | 594 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
595 | 595 | |
|
596 | 596 | test if untracked file is not overwritten |
|
597 | 597 | |
|
598 | 598 | $ echo issue3276_ok > repo/s/b |
|
599 | 599 | $ hg -R repo2 push -f -q |
|
600 | 600 | $ hg -R repo update |
|
601 | 601 | b: untracked file differs |
|
602 | 602 | abort: untracked files in working directory differ from files in requested revision (in subrepo s) |
|
603 | 603 | [255] |
|
604 | 604 | |
|
605 | 605 | $ cat repo/s/b |
|
606 | 606 | issue3276_ok |
|
607 | 607 | $ rm repo/s/b |
|
608 | 608 | $ hg -R repo revert --all |
|
609 | 609 | reverting repo/.hgsubstate (glob) |
|
610 | 610 | reverting subrepo s |
|
611 | 611 | $ hg -R repo update |
|
612 | 612 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
613 | 613 | $ cat repo/s/b |
|
614 | 614 | 2 |
|
615 | 615 | $ rm -rf repo2 repo |
|
616 | 616 | |
|
617 | 617 | |
|
618 | 618 | Issue1852 subrepos with relative paths always push/pull relative to default |
|
619 | 619 | |
|
620 | 620 | Prepare a repo with subrepo |
|
621 | 621 | |
|
622 | 622 | $ hg init issue1852a |
|
623 | 623 | $ cd issue1852a |
|
624 | 624 | $ hg init sub/repo |
|
625 | 625 | $ echo test > sub/repo/foo |
|
626 | 626 | $ hg -R sub/repo add sub/repo/foo |
|
627 | 627 | $ echo sub/repo = sub/repo > .hgsub |
|
628 | 628 | $ hg add .hgsub |
|
629 | 629 | $ hg ci -mtest |
|
630 | 630 | committing subrepository sub/repo (glob) |
|
631 | 631 | $ echo test >> sub/repo/foo |
|
632 | 632 | $ hg ci -mtest |
|
633 | 633 | committing subrepository sub/repo (glob) |
|
634 | 634 | $ cd .. |
|
635 | 635 | |
|
636 | 636 | Create repo without default path, pull top repo, and see what happens on update |
|
637 | 637 | |
|
638 | 638 | $ hg init issue1852b |
|
639 | 639 | $ hg -R issue1852b pull issue1852a |
|
640 | 640 | pulling from issue1852a |
|
641 | 641 | requesting all changes |
|
642 | 642 | adding changesets |
|
643 | 643 | adding manifests |
|
644 | 644 | adding file changes |
|
645 | 645 | added 2 changesets with 3 changes to 2 files |
|
646 | 646 | (run 'hg update' to get a working copy) |
|
647 | 647 | $ hg -R issue1852b update |
|
648 | 648 | abort: default path for subrepository not found (in subrepo sub/repo) (glob) |
|
649 | 649 | [255] |
|
650 | 650 | |
|
651 | 651 | Pull -u now doesn't help |
|
652 | 652 | |
|
653 | 653 | $ hg -R issue1852b pull -u issue1852a |
|
654 | 654 | pulling from issue1852a |
|
655 | 655 | searching for changes |
|
656 | 656 | no changes found |
|
657 | 657 | |
|
658 | 658 | Try the same, but with pull -u |
|
659 | 659 | |
|
660 | 660 | $ hg init issue1852c |
|
661 | 661 | $ hg -R issue1852c pull -r0 -u issue1852a |
|
662 | 662 | pulling from issue1852a |
|
663 | 663 | adding changesets |
|
664 | 664 | adding manifests |
|
665 | 665 | adding file changes |
|
666 | 666 | added 1 changesets with 2 changes to 2 files |
|
667 | 667 | cloning subrepo sub/repo from issue1852a/sub/repo (glob) |
|
668 | 668 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
669 | 669 | |
|
670 | 670 | Try to push from the other side |
|
671 | 671 | |
|
672 | 672 | $ hg -R issue1852a push `pwd`/issue1852c |
|
673 | 673 | pushing to $TESTTMP/issue1852c |
|
674 | 674 | pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob) |
|
675 | 675 | searching for changes |
|
676 | 676 | no changes found |
|
677 | 677 | searching for changes |
|
678 | 678 | adding changesets |
|
679 | 679 | adding manifests |
|
680 | 680 | adding file changes |
|
681 | 681 | added 1 changesets with 1 changes to 1 files |
|
682 | 682 | |
|
683 | 683 | Incoming and outgoing should not use the default path: |
|
684 | 684 | |
|
685 | 685 | $ hg clone -q issue1852a issue1852d |
|
686 | 686 | $ hg -R issue1852d outgoing --subrepos issue1852c |
|
687 | 687 | comparing with issue1852c |
|
688 | 688 | searching for changes |
|
689 | 689 | no changes found |
|
690 | 690 | comparing with issue1852c/sub/repo |
|
691 | 691 | searching for changes |
|
692 | 692 | no changes found |
|
693 | 693 | [1] |
|
694 | 694 | $ hg -R issue1852d incoming --subrepos issue1852c |
|
695 | 695 | comparing with issue1852c |
|
696 | 696 | searching for changes |
|
697 | 697 | no changes found |
|
698 | 698 | comparing with issue1852c/sub/repo |
|
699 | 699 | searching for changes |
|
700 | 700 | no changes found |
|
701 | 701 | [1] |
|
702 | 702 | |
|
703 | 703 | Check status of files when none of them belong to the first |
|
704 | 704 | subrepository: |
|
705 | 705 | |
|
706 | 706 | $ hg init subrepo-status |
|
707 | 707 | $ cd subrepo-status |
|
708 | 708 | $ hg init subrepo-1 |
|
709 | 709 | $ hg init subrepo-2 |
|
710 | 710 | $ cd subrepo-2 |
|
711 | 711 | $ touch file |
|
712 | 712 | $ hg add file |
|
713 | 713 | $ cd .. |
|
714 | 714 | $ echo subrepo-1 = subrepo-1 > .hgsub |
|
715 | 715 | $ echo subrepo-2 = subrepo-2 >> .hgsub |
|
716 | 716 | $ hg add .hgsub |
|
717 | 717 | $ hg ci -m 'Added subrepos' |
|
718 | 718 | committing subrepository subrepo-2 |
|
719 | 719 | $ hg st subrepo-2/file |
|
720 | 720 | |
|
721 | 721 | Check that share works with subrepo |
|
722 | 722 | $ hg --config extensions.share= share . ../shared |
|
723 | 723 | updating working directory |
|
724 | 724 | cloning subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2 |
|
725 | 725 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
726 | 726 | $ test -f ../shared/subrepo-1/.hg/sharedpath |
|
727 | 727 | [1] |
|
728 | 728 | $ hg -R ../shared in |
|
729 | 729 | abort: repository default not found! |
|
730 | 730 | [255] |
|
731 | 731 | $ hg -R ../shared/subrepo-2 showconfig paths |
|
732 | 732 | paths.default=$TESTTMP/subrepo-status/subrepo-2 |
|
733 | 733 | $ hg -R ../shared/subrepo-1 sum --remote |
|
734 | 734 | parent: -1:000000000000 tip (empty repository) |
|
735 | 735 | branch: default |
|
736 | 736 | commit: (clean) |
|
737 | 737 | update: (current) |
|
738 | 738 | remote: (synced) |
|
739 | 739 | |
|
740 | 740 | Check hg update --clean |
|
741 | 741 | $ cd $TESTTMP/t |
|
742 | 742 | $ rm -r t/t.orig |
|
743 | 743 | $ hg status -S --all |
|
744 | 744 | C .hgsub |
|
745 | 745 | C .hgsubstate |
|
746 | 746 | C a |
|
747 | 747 | C s/.hgsub |
|
748 | 748 | C s/.hgsubstate |
|
749 | 749 | C s/a |
|
750 | 750 | C s/ss/a |
|
751 | 751 | C t/t |
|
752 | 752 | $ echo c1 > s/a |
|
753 | 753 | $ cd s |
|
754 | 754 | $ echo c1 > b |
|
755 | 755 | $ echo c1 > c |
|
756 | 756 | $ hg add b |
|
757 | 757 | $ cd .. |
|
758 | 758 | $ hg status -S |
|
759 | 759 | M s/a |
|
760 | 760 | A s/b |
|
761 | 761 | ? s/c |
|
762 | 762 | $ hg update -C |
|
763 | 763 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
764 | 764 | $ hg status -S |
|
765 | 765 | ? s/b |
|
766 | 766 | ? s/c |
|
767 | 767 | |
|
768 | 768 | Sticky subrepositories, no changes |
|
769 | 769 | $ cd $TESTTMP/t |
|
770 | 770 | $ hg id |
|
771 | 771 | 925c17564ef8 tip |
|
772 | 772 | $ hg -R s id |
|
773 | 773 | 12a213df6fa9 tip |
|
774 | 774 | $ hg -R t id |
|
775 | 775 | 52c0adc0515a tip |
|
776 | 776 | $ hg update 11 |
|
777 | 777 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
778 | 778 | $ hg id |
|
779 | 779 | 365661e5936a |
|
780 | 780 | $ hg -R s id |
|
781 | 781 | fc627a69481f |
|
782 | 782 | $ hg -R t id |
|
783 | 783 | e95bcfa18a35 |
|
784 | 784 | |
|
785 | 785 | Sticky subrepositorys, file changes |
|
786 | 786 | $ touch s/f1 |
|
787 | 787 | $ touch t/f1 |
|
788 | 788 | $ hg add -S s/f1 |
|
789 | 789 | $ hg add -S t/f1 |
|
790 | 790 | $ hg id |
|
791 | 791 | 365661e5936a+ |
|
792 | 792 | $ hg -R s id |
|
793 | 793 | fc627a69481f+ |
|
794 | 794 | $ hg -R t id |
|
795 | 795 | e95bcfa18a35+ |
|
796 | 796 | $ hg update tip |
|
797 | 797 | subrepository sources for s differ |
|
798 | 798 | use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? |
|
799 | 799 | l |
|
800 | 800 | subrepository sources for t differ |
|
801 | 801 | use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? |
|
802 | 802 | l |
|
803 | 803 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
804 | 804 | $ hg id |
|
805 | 805 | 925c17564ef8+ tip |
|
806 | 806 | $ hg -R s id |
|
807 | 807 | fc627a69481f+ |
|
808 | 808 | $ hg -R t id |
|
809 | 809 | e95bcfa18a35+ |
|
810 | 810 | $ hg update --clean tip |
|
811 | 811 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
812 | 812 | |
|
813 | 813 | Sticky subrepository, revision updates |
|
814 | 814 | $ hg id |
|
815 | 815 | 925c17564ef8 tip |
|
816 | 816 | $ hg -R s id |
|
817 | 817 | 12a213df6fa9 tip |
|
818 | 818 | $ hg -R t id |
|
819 | 819 | 52c0adc0515a tip |
|
820 | 820 | $ cd s |
|
821 | 821 | $ hg update -r -2 |
|
822 | 822 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
823 | 823 | $ cd ../t |
|
824 | 824 | $ hg update -r 2 |
|
825 | 825 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
826 | 826 | $ cd .. |
|
827 | 827 | $ hg update 10 |
|
828 | 828 | subrepository sources for t differ (in checked out version) |
|
829 | 829 | use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? |
|
830 | 830 | l |
|
831 | 831 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
832 | 832 | $ hg id |
|
833 | 833 | e45c8b14af55+ |
|
834 | 834 | $ hg -R s id |
|
835 | 835 | 02dcf1d70411 |
|
836 | 836 | $ hg -R t id |
|
837 | 837 | 7af322bc1198 |
|
838 | 838 | |
|
839 | 839 | Sticky subrepository, file changes and revision updates |
|
840 | 840 | $ touch s/f1 |
|
841 | 841 | $ touch t/f1 |
|
842 | 842 | $ hg add -S s/f1 |
|
843 | 843 | $ hg add -S t/f1 |
|
844 | 844 | $ hg id |
|
845 | 845 | e45c8b14af55+ |
|
846 | 846 | $ hg -R s id |
|
847 | 847 | 02dcf1d70411+ |
|
848 | 848 | $ hg -R t id |
|
849 | 849 | 7af322bc1198+ |
|
850 | 850 | $ hg update tip |
|
851 | 851 | subrepository sources for s differ |
|
852 | 852 | use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? |
|
853 | 853 | l |
|
854 | 854 | subrepository sources for t differ |
|
855 | 855 | use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? |
|
856 | 856 | l |
|
857 | 857 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
858 | 858 | $ hg id |
|
859 | 859 | 925c17564ef8+ tip |
|
860 | 860 | $ hg -R s id |
|
861 | 861 | 02dcf1d70411+ |
|
862 | 862 | $ hg -R t id |
|
863 | 863 | 7af322bc1198+ |
|
864 | 864 | |
|
865 | 865 | Sticky repository, update --clean |
|
866 | 866 | $ hg update --clean tip |
|
867 | 867 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
868 | 868 | $ hg id |
|
869 | 869 | 925c17564ef8 tip |
|
870 | 870 | $ hg -R s id |
|
871 | 871 | 12a213df6fa9 tip |
|
872 | 872 | $ hg -R t id |
|
873 | 873 | 52c0adc0515a tip |
|
874 | 874 | |
|
875 | 875 | Test subrepo already at intended revision: |
|
876 | 876 | $ cd s |
|
877 | 877 | $ hg update fc627a69481f |
|
878 | 878 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
879 | 879 | $ cd .. |
|
880 | 880 | $ hg update 11 |
|
881 | 881 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
882 | 882 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
883 | 883 | $ hg id -n |
|
884 | 884 | 11+ |
|
885 | 885 | $ hg -R s id |
|
886 | 886 | fc627a69481f |
|
887 | 887 | $ hg -R t id |
|
888 | 888 | e95bcfa18a35 |
|
889 | 889 | |
|
890 | 890 | Test that removing .hgsubstate doesn't break anything: |
|
891 | 891 | |
|
892 | 892 | $ hg rm -f .hgsubstate |
|
893 | 893 | $ hg ci -mrm |
|
894 | 894 | nothing changed |
|
895 | 895 | [1] |
|
896 | 896 | $ hg log -vr tip |
|
897 | 897 | changeset: 13:925c17564ef8 |
|
898 | 898 | tag: tip |
|
899 | 899 | user: test |
|
900 | 900 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
901 | 901 | files: .hgsubstate |
|
902 | 902 | description: |
|
903 | 903 | 13 |
|
904 | 904 | |
|
905 | 905 | |
|
906 | 906 | |
|
907 | 907 | Test that removing .hgsub removes .hgsubstate: |
|
908 | 908 | |
|
909 | 909 | $ hg rm .hgsub |
|
910 | 910 | $ hg ci -mrm2 |
|
911 | 911 | created new head |
|
912 | 912 | $ hg log -vr tip |
|
913 | 913 | changeset: 14:2400bccd50af |
|
914 | 914 | tag: tip |
|
915 | 915 | parent: 11:365661e5936a |
|
916 | 916 | user: test |
|
917 | 917 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
918 | 918 | files: .hgsub .hgsubstate |
|
919 | 919 | description: |
|
920 | 920 | rm2 |
|
921 | 921 | |
|
922 | 922 | |
|
923 | 923 | Test issue3153: diff -S with deleted subrepos |
|
924 | 924 | |
|
925 | 925 | $ hg diff --nodates -S -c . |
|
926 | 926 | diff -r 365661e5936a -r 2400bccd50af .hgsub |
|
927 | 927 | --- a/.hgsub |
|
928 | 928 | +++ /dev/null |
|
929 | 929 | @@ -1,2 +0,0 @@ |
|
930 | 930 | -s = s |
|
931 | 931 | -t = t |
|
932 | 932 | diff -r 365661e5936a -r 2400bccd50af .hgsubstate |
|
933 | 933 | --- a/.hgsubstate |
|
934 | 934 | +++ /dev/null |
|
935 | 935 | @@ -1,2 +0,0 @@ |
|
936 | 936 | -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s |
|
937 | 937 | -e95bcfa18a358dc4936da981ebf4147b4cad1362 t |
|
938 | 938 | |
|
939 | 939 | Test behavior of add for explicit path in subrepo: |
|
940 | 940 | $ cd .. |
|
941 | 941 | $ hg init explicit |
|
942 | 942 | $ cd explicit |
|
943 | 943 | $ echo s = s > .hgsub |
|
944 | 944 | $ hg add .hgsub |
|
945 | 945 | $ hg init s |
|
946 | 946 | $ hg ci -m0 |
|
947 | 947 | Adding with an explicit path in a subrepo adds the file |
|
948 | 948 | $ echo c1 > f1 |
|
949 | 949 | $ echo c2 > s/f2 |
|
950 | 950 | $ hg st -S |
|
951 | 951 | ? f1 |
|
952 | 952 | ? s/f2 |
|
953 | 953 | $ hg add s/f2 |
|
954 | 954 | $ hg st -S |
|
955 | 955 | A s/f2 |
|
956 | 956 | ? f1 |
|
957 | 957 | $ hg ci -R s -m0 |
|
958 | 958 | $ hg ci -Am1 |
|
959 | 959 | adding f1 |
|
960 | 960 | Adding with an explicit path in a subrepo with -S has the same behavior |
|
961 | 961 | $ echo c3 > f3 |
|
962 | 962 | $ echo c4 > s/f4 |
|
963 | 963 | $ hg st -S |
|
964 | 964 | ? f3 |
|
965 | 965 | ? s/f4 |
|
966 | 966 | $ hg add -S s/f4 |
|
967 | 967 | $ hg st -S |
|
968 | 968 | A s/f4 |
|
969 | 969 | ? f3 |
|
970 | 970 | $ hg ci -R s -m1 |
|
971 | 971 | $ hg ci -Ama2 |
|
972 | 972 | adding f3 |
|
973 | 973 | Adding without a path or pattern silently ignores subrepos |
|
974 | 974 | $ echo c5 > f5 |
|
975 | 975 | $ echo c6 > s/f6 |
|
976 | 976 | $ echo c7 > s/f7 |
|
977 | 977 | $ hg st -S |
|
978 | 978 | ? f5 |
|
979 | 979 | ? s/f6 |
|
980 | 980 | ? s/f7 |
|
981 | 981 | $ hg add |
|
982 | 982 | adding f5 |
|
983 | 983 | $ hg st -S |
|
984 | 984 | A f5 |
|
985 | 985 | ? s/f6 |
|
986 | 986 | ? s/f7 |
|
987 | 987 | $ hg ci -R s -Am2 |
|
988 | 988 | adding f6 |
|
989 | 989 | adding f7 |
|
990 | 990 | $ hg ci -m3 |
|
991 | 991 | Adding without a path or pattern with -S also adds files in subrepos |
|
992 | 992 | $ echo c8 > f8 |
|
993 | 993 | $ echo c9 > s/f9 |
|
994 | 994 | $ echo c10 > s/f10 |
|
995 | 995 | $ hg st -S |
|
996 | 996 | ? f8 |
|
997 | 997 | ? s/f10 |
|
998 | 998 | ? s/f9 |
|
999 | 999 | $ hg add -S |
|
1000 | 1000 | adding f8 |
|
1001 | 1001 | adding s/f10 (glob) |
|
1002 | 1002 | adding s/f9 (glob) |
|
1003 | 1003 | $ hg st -S |
|
1004 | 1004 | A f8 |
|
1005 | 1005 | A s/f10 |
|
1006 | 1006 | A s/f9 |
|
1007 | 1007 | $ hg ci -R s -m3 |
|
1008 | 1008 | $ hg ci -m4 |
|
1009 | 1009 | Adding with a pattern silently ignores subrepos |
|
1010 | 1010 | $ echo c11 > fm11 |
|
1011 | 1011 | $ echo c12 > fn12 |
|
1012 | 1012 | $ echo c13 > s/fm13 |
|
1013 | 1013 | $ echo c14 > s/fn14 |
|
1014 | 1014 | $ hg st -S |
|
1015 | 1015 | ? fm11 |
|
1016 | 1016 | ? fn12 |
|
1017 | 1017 | ? s/fm13 |
|
1018 | 1018 | ? s/fn14 |
|
1019 | 1019 | $ hg add 'glob:**fm*' |
|
1020 | 1020 | adding fm11 |
|
1021 | 1021 | $ hg st -S |
|
1022 | 1022 | A fm11 |
|
1023 | 1023 | ? fn12 |
|
1024 | 1024 | ? s/fm13 |
|
1025 | 1025 | ? s/fn14 |
|
1026 | 1026 | $ hg ci -R s -Am4 |
|
1027 | 1027 | adding fm13 |
|
1028 | 1028 | adding fn14 |
|
1029 | 1029 | $ hg ci -Am5 |
|
1030 | 1030 | adding fn12 |
|
1031 | 1031 | Adding with a pattern with -S also adds matches in subrepos |
|
1032 | 1032 | $ echo c15 > fm15 |
|
1033 | 1033 | $ echo c16 > fn16 |
|
1034 | 1034 | $ echo c17 > s/fm17 |
|
1035 | 1035 | $ echo c18 > s/fn18 |
|
1036 | 1036 | $ hg st -S |
|
1037 | 1037 | ? fm15 |
|
1038 | 1038 | ? fn16 |
|
1039 | 1039 | ? s/fm17 |
|
1040 | 1040 | ? s/fn18 |
|
1041 | 1041 | $ hg add -S 'glob:**fm*' |
|
1042 | 1042 | adding fm15 |
|
1043 | 1043 | adding s/fm17 (glob) |
|
1044 | 1044 | $ hg st -S |
|
1045 | 1045 | A fm15 |
|
1046 | 1046 | A s/fm17 |
|
1047 | 1047 | ? fn16 |
|
1048 | 1048 | ? s/fn18 |
|
1049 | 1049 | $ hg ci -R s -Am5 |
|
1050 | 1050 | adding fn18 |
|
1051 | 1051 | $ hg ci -Am6 |
|
1052 | 1052 | adding fn16 |
|
1053 | 1053 | |
|
1054 | 1054 | Test behavior of forget for explicit path in subrepo: |
|
1055 | 1055 | Forgetting an explicit path in a subrepo untracks the file |
|
1056 | 1056 | $ echo c19 > s/f19 |
|
1057 | 1057 | $ hg add s/f19 |
|
1058 | 1058 | $ hg st -S |
|
1059 | 1059 | A s/f19 |
|
1060 | 1060 | $ hg forget s/f19 |
|
1061 | 1061 | $ hg st -S |
|
1062 | 1062 | ? s/f19 |
|
1063 | 1063 | $ rm s/f19 |
|
1064 | 1064 | $ cd .. |
|
1065 | 1065 | |
|
1066 | 1066 | Courtesy phases synchronisation to publishing server does not block the push |
|
1067 | 1067 | (issue3781) |
|
1068 | 1068 | |
|
1069 | 1069 | $ cp -r main issue3781 |
|
1070 | 1070 | $ cp -r main issue3781-dest |
|
1071 | 1071 | $ cd issue3781-dest/s |
|
1072 | 1072 | $ hg phase tip # show we have draft changeset |
|
1073 | 1073 | 5: draft |
|
1074 | 1074 | $ chmod a-w .hg/store/phaseroots # prevent phase push |
|
1075 | 1075 | $ cd ../../issue3781 |
|
1076 | 1076 | $ cat >> .hg/hgrc << EOF |
|
1077 | 1077 | > [paths] |
|
1078 | 1078 | > default=../issue3781-dest/ |
|
1079 | 1079 | > EOF |
|
1080 | 1080 | $ hg push |
|
1081 | 1081 | pushing to $TESTTMP/issue3781-dest |
|
1082 | 1082 | pushing subrepo s to $TESTTMP/issue3781-dest/s |
|
1083 | 1083 | searching for changes |
|
1084 | 1084 | no changes found |
|
1085 | 1085 | searching for changes |
|
1086 | 1086 | no changes found |
|
1087 | 1087 | [1] |
|
1088 | 1088 |
@@ -1,238 +1,238 b'' | |||
|
1 | 1 | $ HGMERGE=true; export HGMERGE |
|
2 | 2 | |
|
3 | 3 | $ hg init r1 |
|
4 | 4 | $ cd r1 |
|
5 | 5 | $ echo a > a |
|
6 | 6 | $ hg addremove |
|
7 | 7 | adding a |
|
8 | 8 | $ hg commit -m "1" |
|
9 | 9 | |
|
10 | 10 | $ hg clone . ../r2 |
|
11 | 11 | updating to branch default |
|
12 | 12 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
13 | 13 | $ cd ../r2 |
|
14 | 14 | $ hg up |
|
15 | 15 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
16 | 16 | $ echo abc > a |
|
17 | 17 | $ hg diff --nodates |
|
18 | 18 | diff -r c19d34741b0a a |
|
19 | 19 | --- a/a |
|
20 | 20 | +++ b/a |
|
21 | 21 | @@ -1,1 +1,1 @@ |
|
22 | 22 | -a |
|
23 | 23 | +abc |
|
24 | 24 | |
|
25 | 25 | $ cd ../r1 |
|
26 | 26 | $ echo b > b |
|
27 | 27 | $ echo a2 > a |
|
28 | 28 | $ hg addremove |
|
29 | 29 | adding b |
|
30 | 30 | $ hg commit -m "2" |
|
31 | 31 | |
|
32 | 32 | $ cd ../r2 |
|
33 | 33 | $ hg -q pull ../r1 |
|
34 | 34 | $ hg status |
|
35 | 35 | M a |
|
36 | 36 | $ hg parents |
|
37 | 37 | changeset: 0:c19d34741b0a |
|
38 | 38 | user: test |
|
39 | 39 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
40 | 40 | summary: 1 |
|
41 | 41 | |
|
42 | 42 | $ hg --debug up |
|
43 | 43 | searching for copies back to rev 1 |
|
44 | 44 | unmatched files in other: |
|
45 | 45 | b |
|
46 | 46 | resolving manifests |
|
47 | 47 | overwrite: False, partial: False |
|
48 | 48 | ancestor: c19d34741b0a, local: c19d34741b0a+, remote: 1e71731e6fbb |
|
49 | 49 | a: versions differ -> m |
|
50 | preserving a for resolve of a | |
|
50 | 51 | b: remote created -> g |
|
51 | preserving a for resolve of a | |
|
52 | 52 | updating: a 1/2 files (50.00%) |
|
53 | 53 | picked tool 'true' for a (binary False symlink False) |
|
54 | 54 | merging a |
|
55 | 55 | my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a |
|
56 | 56 | updating: b 2/2 files (100.00%) |
|
57 | 57 | getting b |
|
58 | 58 | 1 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
59 | 59 | $ hg parents |
|
60 | 60 | changeset: 1:1e71731e6fbb |
|
61 | 61 | tag: tip |
|
62 | 62 | user: test |
|
63 | 63 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
64 | 64 | summary: 2 |
|
65 | 65 | |
|
66 | 66 | $ hg --debug up 0 |
|
67 | 67 | resolving manifests |
|
68 | 68 | overwrite: False, partial: False |
|
69 | 69 | ancestor: 1e71731e6fbb, local: 1e71731e6fbb+, remote: c19d34741b0a |
|
70 | b: other deleted -> r | |
|
70 | 71 | a: versions differ -> m |
|
71 | b: other deleted -> r | |
|
72 | preserving a for resolve of a | |
|
72 | preserving a for resolve of a | |
|
73 | 73 | updating: b 1/2 files (50.00%) |
|
74 | 74 | removing b |
|
75 | 75 | updating: a 2/2 files (100.00%) |
|
76 | 76 | picked tool 'true' for a (binary False symlink False) |
|
77 | 77 | merging a |
|
78 | 78 | my a@1e71731e6fbb+ other a@c19d34741b0a ancestor a@1e71731e6fbb |
|
79 | 79 | 0 files updated, 1 files merged, 1 files removed, 0 files unresolved |
|
80 | 80 | $ hg parents |
|
81 | 81 | changeset: 0:c19d34741b0a |
|
82 | 82 | user: test |
|
83 | 83 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
84 | 84 | summary: 1 |
|
85 | 85 | |
|
86 | 86 | $ hg --debug merge |
|
87 | 87 | abort: nothing to merge |
|
88 | 88 | (use 'hg update' instead) |
|
89 | 89 | [255] |
|
90 | 90 | $ hg parents |
|
91 | 91 | changeset: 0:c19d34741b0a |
|
92 | 92 | user: test |
|
93 | 93 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
94 | 94 | summary: 1 |
|
95 | 95 | |
|
96 | 96 | $ hg --debug up |
|
97 | 97 | searching for copies back to rev 1 |
|
98 | 98 | unmatched files in other: |
|
99 | 99 | b |
|
100 | 100 | resolving manifests |
|
101 | 101 | overwrite: False, partial: False |
|
102 | 102 | ancestor: c19d34741b0a, local: c19d34741b0a+, remote: 1e71731e6fbb |
|
103 | 103 | a: versions differ -> m |
|
104 | preserving a for resolve of a | |
|
104 | 105 | b: remote created -> g |
|
105 | preserving a for resolve of a | |
|
106 | 106 | updating: a 1/2 files (50.00%) |
|
107 | 107 | picked tool 'true' for a (binary False symlink False) |
|
108 | 108 | merging a |
|
109 | 109 | my a@c19d34741b0a+ other a@1e71731e6fbb ancestor a@c19d34741b0a |
|
110 | 110 | updating: b 2/2 files (100.00%) |
|
111 | 111 | getting b |
|
112 | 112 | 1 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
113 | 113 | $ hg parents |
|
114 | 114 | changeset: 1:1e71731e6fbb |
|
115 | 115 | tag: tip |
|
116 | 116 | user: test |
|
117 | 117 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
118 | 118 | summary: 2 |
|
119 | 119 | |
|
120 | 120 | $ hg -v history |
|
121 | 121 | changeset: 1:1e71731e6fbb |
|
122 | 122 | tag: tip |
|
123 | 123 | user: test |
|
124 | 124 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
125 | 125 | files: a b |
|
126 | 126 | description: |
|
127 | 127 | 2 |
|
128 | 128 | |
|
129 | 129 | |
|
130 | 130 | changeset: 0:c19d34741b0a |
|
131 | 131 | user: test |
|
132 | 132 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
133 | 133 | files: a |
|
134 | 134 | description: |
|
135 | 135 | 1 |
|
136 | 136 | |
|
137 | 137 | |
|
138 | 138 | $ hg diff --nodates |
|
139 | 139 | diff -r 1e71731e6fbb a |
|
140 | 140 | --- a/a |
|
141 | 141 | +++ b/a |
|
142 | 142 | @@ -1,1 +1,1 @@ |
|
143 | 143 | -a2 |
|
144 | 144 | +abc |
|
145 | 145 | |
|
146 | 146 | |
|
147 | 147 | create a second head |
|
148 | 148 | |
|
149 | 149 | $ cd ../r1 |
|
150 | 150 | $ hg up 0 |
|
151 | 151 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
152 | 152 | $ echo b2 > b |
|
153 | 153 | $ echo a3 > a |
|
154 | 154 | $ hg addremove |
|
155 | 155 | adding b |
|
156 | 156 | $ hg commit -m "3" |
|
157 | 157 | created new head |
|
158 | 158 | |
|
159 | 159 | $ cd ../r2 |
|
160 | 160 | $ hg -q pull ../r1 |
|
161 | 161 | $ hg status |
|
162 | 162 | M a |
|
163 | 163 | $ hg parents |
|
164 | 164 | changeset: 1:1e71731e6fbb |
|
165 | 165 | user: test |
|
166 | 166 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
167 | 167 | summary: 2 |
|
168 | 168 | |
|
169 | 169 | $ hg --debug up |
|
170 | 170 | abort: crosses branches (merge branches or use --clean to discard changes) |
|
171 | 171 | [255] |
|
172 | 172 | $ hg --debug merge |
|
173 | 173 | abort: outstanding uncommitted changes |
|
174 | 174 | (use 'hg status' to list changes) |
|
175 | 175 | [255] |
|
176 | 176 | $ hg --debug merge -f |
|
177 | 177 | searching for copies back to rev 1 |
|
178 | 178 | resolving manifests |
|
179 | 179 | overwrite: False, partial: False |
|
180 | 180 | ancestor: c19d34741b0a, local: 1e71731e6fbb+, remote: 83c51d0caff4 |
|
181 | 181 | a: versions differ -> m |
|
182 | preserving a for resolve of a | |
|
182 | 183 | b: versions differ -> m |
|
183 |
preserving |
|
|
184 | preserving b for resolve of b | |
|
184 | preserving b for resolve of b | |
|
185 | 185 | updating: a 1/2 files (50.00%) |
|
186 | 186 | picked tool 'true' for a (binary False symlink False) |
|
187 | 187 | merging a |
|
188 | 188 | my a@1e71731e6fbb+ other a@83c51d0caff4 ancestor a@c19d34741b0a |
|
189 | 189 | updating: b 2/2 files (100.00%) |
|
190 | 190 | picked tool 'true' for b (binary False symlink False) |
|
191 | 191 | merging b |
|
192 | 192 | my b@1e71731e6fbb+ other b@83c51d0caff4 ancestor b@000000000000 |
|
193 | 193 | 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
|
194 | 194 | (branch merge, don't forget to commit) |
|
195 | 195 | $ hg parents |
|
196 | 196 | changeset: 1:1e71731e6fbb |
|
197 | 197 | user: test |
|
198 | 198 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
199 | 199 | summary: 2 |
|
200 | 200 | |
|
201 | 201 | changeset: 2:83c51d0caff4 |
|
202 | 202 | tag: tip |
|
203 | 203 | parent: 0:c19d34741b0a |
|
204 | 204 | user: test |
|
205 | 205 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
206 | 206 | summary: 3 |
|
207 | 207 | |
|
208 | 208 | $ hg diff --nodates |
|
209 | 209 | diff -r 1e71731e6fbb a |
|
210 | 210 | --- a/a |
|
211 | 211 | +++ b/a |
|
212 | 212 | @@ -1,1 +1,1 @@ |
|
213 | 213 | -a2 |
|
214 | 214 | +abc |
|
215 | 215 | |
|
216 | 216 | |
|
217 | 217 | test a local add |
|
218 | 218 | |
|
219 | 219 | $ cd .. |
|
220 | 220 | $ hg init a |
|
221 | 221 | $ hg init b |
|
222 | 222 | $ echo a > a/a |
|
223 | 223 | $ echo a > b/a |
|
224 | 224 | $ hg --cwd a commit -A -m a |
|
225 | 225 | adding a |
|
226 | 226 | $ cd b |
|
227 | 227 | $ hg add a |
|
228 | 228 | $ hg pull -u ../a |
|
229 | 229 | pulling from ../a |
|
230 | 230 | requesting all changes |
|
231 | 231 | adding changesets |
|
232 | 232 | adding manifests |
|
233 | 233 | adding file changes |
|
234 | 234 | added 1 changesets with 1 changes to 1 files |
|
235 | 235 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
236 | 236 | $ hg st |
|
237 | 237 | |
|
238 | 238 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now