equal
deleted
inserted
replaced
2249 revert = ([], _('reverting %s\n')) |
2249 revert = ([], _('reverting %s\n')) |
2250 add = ([], _('adding %s\n')) |
2250 add = ([], _('adding %s\n')) |
2251 remove = ([], _('removing %s\n')) |
2251 remove = ([], _('removing %s\n')) |
2252 forget = ([], _('forgetting %s\n')) |
2252 forget = ([], _('forgetting %s\n')) |
2253 undelete = ([], _('undeleting %s\n')) |
2253 undelete = ([], _('undeleting %s\n')) |
2254 update = {} |
|
2255 |
2254 |
2256 disptable = ( |
2255 disptable = ( |
2257 # dispatch table: |
2256 # dispatch table: |
2258 # file state |
2257 # file state |
2259 # action if in target manifest |
2258 # action if in target manifest |
2272 for abs, (rel, exact) in entries: |
2271 for abs, (rel, exact) in entries: |
2273 mfentry = mf.get(abs) |
2272 mfentry = mf.get(abs) |
2274 target = repo.wjoin(abs) |
2273 target = repo.wjoin(abs) |
2275 def handle(xlist, dobackup): |
2274 def handle(xlist, dobackup): |
2276 xlist[0].append(abs) |
2275 xlist[0].append(abs) |
2277 update[abs] = 1 |
|
2278 if dobackup and not opts['no_backup'] and util.lexists(target): |
2276 if dobackup and not opts['no_backup'] and util.lexists(target): |
2279 bakname = "%s.orig" % rel |
2277 bakname = "%s.orig" % rel |
2280 ui.note(_('saving current version of %s as %s\n') % |
2278 ui.note(_('saving current version of %s as %s\n') % |
2281 (rel, bakname)) |
2279 (rel, bakname)) |
2282 if not opts.get('dry_run'): |
2280 if not opts.get('dry_run'): |
2315 handle(revert, False) |
2313 handle(revert, False) |
2316 else: |
2314 else: |
2317 handle(remove, False) |
2315 handle(remove, False) |
2318 |
2316 |
2319 if not opts.get('dry_run'): |
2317 if not opts.get('dry_run'): |
|
2318 def checkout(f): |
|
2319 fc = ctx[f] |
|
2320 repo.wwrite(f, fc.data(), fc.fileflags()) |
|
2321 |
2320 for f in forget[0]: |
2322 for f in forget[0]: |
2321 repo.dirstate.forget(f) |
2323 repo.dirstate.forget(f) |
2322 r = hg.revert(repo, node, update.has_key) |
2324 |
|
2325 for f in revert[0]: |
|
2326 checkout(f) |
|
2327 |
2323 for f in add[0]: |
2328 for f in add[0]: |
|
2329 checkout(f) |
2324 repo.dirstate.add(f) |
2330 repo.dirstate.add(f) |
|
2331 |
2325 for f in undelete[0]: |
2332 for f in undelete[0]: |
|
2333 checkout(f) |
2326 repo.dirstate.normal(f) |
2334 repo.dirstate.normal(f) |
|
2335 |
|
2336 audit_path = util.path_auditor(repo.root) |
2327 for f in remove[0]: |
2337 for f in remove[0]: |
|
2338 audit_path(f) |
|
2339 try: |
|
2340 util.unlink(repo.wjoin(f)) |
|
2341 except OSError: |
|
2342 pass |
2328 repo.dirstate.remove(f) |
2343 repo.dirstate.remove(f) |
2329 return r |
|
2330 finally: |
2344 finally: |
2331 del wlock |
2345 del wlock |
2332 |
2346 |
2333 def rollback(ui, repo): |
2347 def rollback(ui, repo): |
2334 """roll back the last transaction |
2348 """roll back the last transaction |