Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 13322:c19b9282d3a7 stable
subrepo: make update -C clean the working directory for svn subrepos
This makes 'hg update --clean' behave the same way for both kinds of
subrepositories. Before Subversion subrepos did not take the clean
parameter into account, but just updated to the given revision and
merged uncommitted changes into that.
author | Erik Zielke <ez@aragost.com> |
---|---|
date | Mon, 31 Jan 2011 13:33:41 +0100 |
parents | 62c8f7691bc3 |
children | d8d478f9ee0f |
comparison
equal
deleted
inserted
replaced
13314:8dc488dfcdb4 | 13322:c19b9282d3a7 |
---|---|
247 return action | 247 return action |
248 | 248 |
249 def actionkey(a): | 249 def actionkey(a): |
250 return a[1] == 'r' and -1 or 0, a | 250 return a[1] == 'r' and -1 or 0, a |
251 | 251 |
252 def applyupdates(repo, action, wctx, mctx, actx): | 252 def applyupdates(repo, action, wctx, mctx, actx, overwrite): |
253 """apply the merge action list to the working directory | 253 """apply the merge action list to the working directory |
254 | 254 |
255 wctx is the working copy context | 255 wctx is the working copy context |
256 mctx is the context to be merged into the working copy | 256 mctx is the context to be merged into the working copy |
257 actx is the context of the common ancestor | 257 actx is the context of the common ancestor |
305 continue | 305 continue |
306 if m == "r": # remove | 306 if m == "r": # remove |
307 repo.ui.note(_("removing %s\n") % f) | 307 repo.ui.note(_("removing %s\n") % f) |
308 audit_path(f) | 308 audit_path(f) |
309 if f == '.hgsubstate': # subrepo states need updating | 309 if f == '.hgsubstate': # subrepo states need updating |
310 subrepo.submerge(repo, wctx, mctx, wctx) | 310 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
311 try: | 311 try: |
312 util.unlink(repo.wjoin(f)) | 312 util.unlink(repo.wjoin(f)) |
313 except OSError, inst: | 313 except OSError, inst: |
314 if inst.errno != errno.ENOENT: | 314 if inst.errno != errno.ENOENT: |
315 repo.ui.warn(_("update failed to remove %s: %s!\n") % | 315 repo.ui.warn(_("update failed to remove %s: %s!\n") % |
316 (f, inst.strerror)) | 316 (f, inst.strerror)) |
317 removed += 1 | 317 removed += 1 |
318 elif m == "m": # merge | 318 elif m == "m": # merge |
319 if f == '.hgsubstate': # subrepo states need updating | 319 if f == '.hgsubstate': # subrepo states need updating |
320 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx)) | 320 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), overwrite) |
321 continue | 321 continue |
322 f2, fd, flags, move = a[2:] | 322 f2, fd, flags, move = a[2:] |
323 r = ms.resolve(fd, wctx, mctx) | 323 r = ms.resolve(fd, wctx, mctx) |
324 if r is not None and r > 0: | 324 if r is not None and r > 0: |
325 unresolved += 1 | 325 unresolved += 1 |
338 t = mctx.filectx(f).data() | 338 t = mctx.filectx(f).data() |
339 repo.wwrite(f, t, flags) | 339 repo.wwrite(f, t, flags) |
340 t = None | 340 t = None |
341 updated += 1 | 341 updated += 1 |
342 if f == '.hgsubstate': # subrepo states need updating | 342 if f == '.hgsubstate': # subrepo states need updating |
343 subrepo.submerge(repo, wctx, mctx, wctx) | 343 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
344 elif m == "d": # directory rename | 344 elif m == "d": # directory rename |
345 f2, fd, flags = a[2:] | 345 f2, fd, flags = a[2:] |
346 if f: | 346 if f: |
347 repo.ui.note(_("moving %s to %s\n") % (f, fd)) | 347 repo.ui.note(_("moving %s to %s\n") % (f, fd)) |
348 t = wctx.filectx(f).data() | 348 t = wctx.filectx(f).data() |
527 if not branchmerge: # just jump to the new rev | 527 if not branchmerge: # just jump to the new rev |
528 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' | 528 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' |
529 if not partial: | 529 if not partial: |
530 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) | 530 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) |
531 | 531 |
532 stats = applyupdates(repo, action, wc, p2, pa) | 532 stats = applyupdates(repo, action, wc, p2, pa, overwrite) |
533 | 533 |
534 if not partial: | 534 if not partial: |
535 repo.dirstate.setparents(fp1, fp2) | 535 repo.dirstate.setparents(fp1, fp2) |
536 recordupdates(repo, action, branchmerge) | 536 recordupdates(repo, action, branchmerge) |
537 if not branchmerge and not fastforward: | 537 if not branchmerge and not fastforward: |