Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 2510:cbff06469488
merge with crew.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Tue, 27 Jun 2006 00:13:44 -0700 |
parents | 158d3d2ae070 37655f10ced6 |
children | f22e3e8fd457 |
comparison
equal
deleted
inserted
replaced
2509:6350b01d173f | 2510:cbff06469488 |
---|---|
648 ui.status(_('adding %s\n') % rel) | 648 ui.status(_('adding %s\n') % rel) |
649 names.append(abs) | 649 names.append(abs) |
650 elif repo.dirstate.state(abs) == '?': | 650 elif repo.dirstate.state(abs) == '?': |
651 ui.status(_('adding %s\n') % rel) | 651 ui.status(_('adding %s\n') % rel) |
652 names.append(abs) | 652 names.append(abs) |
653 if not opts['dry_run']: | 653 if not opts.get('dry_run'): |
654 repo.add(names) | 654 repo.add(names) |
655 | 655 |
656 def addremove(ui, repo, *pats, **opts): | 656 def addremove(ui, repo, *pats, **opts): |
657 """add all new files, delete all missing files (DEPRECATED) | 657 """add all new files, delete all missing files (DEPRECATED) |
658 | 658 |
1074 opts['after'] and repo.dirstate.state(abstarget) not in '?r'): | 1074 opts['after'] and repo.dirstate.state(abstarget) not in '?r'): |
1075 if not opts['force']: | 1075 if not opts['force']: |
1076 ui.warn(_('%s: not overwriting - file exists\n') % | 1076 ui.warn(_('%s: not overwriting - file exists\n') % |
1077 reltarget) | 1077 reltarget) |
1078 return | 1078 return |
1079 if not opts['after'] and not opts['dry_run']: | 1079 if not opts['after'] and not opts.get('dry_run'): |
1080 os.unlink(reltarget) | 1080 os.unlink(reltarget) |
1081 if opts['after']: | 1081 if opts['after']: |
1082 if not os.path.exists(reltarget): | 1082 if not os.path.exists(reltarget): |
1083 return | 1083 return |
1084 else: | 1084 else: |
1085 targetdir = os.path.dirname(reltarget) or '.' | 1085 targetdir = os.path.dirname(reltarget) or '.' |
1086 if not os.path.isdir(targetdir) and not opts['dry_run']: | 1086 if not os.path.isdir(targetdir) and not opts.get('dry_run'): |
1087 os.makedirs(targetdir) | 1087 os.makedirs(targetdir) |
1088 try: | 1088 try: |
1089 restore = repo.dirstate.state(abstarget) == 'r' | 1089 restore = repo.dirstate.state(abstarget) == 'r' |
1090 if restore and not opts['dry_run']: | 1090 if restore and not opts.get('dry_run'): |
1091 repo.undelete([abstarget], wlock) | 1091 repo.undelete([abstarget], wlock) |
1092 try: | 1092 try: |
1093 if not opts['dry_run']: | 1093 if not opts.get('dry_run'): |
1094 shutil.copyfile(relsrc, reltarget) | 1094 shutil.copyfile(relsrc, reltarget) |
1095 shutil.copymode(relsrc, reltarget) | 1095 shutil.copymode(relsrc, reltarget) |
1096 restore = False | 1096 restore = False |
1097 finally: | 1097 finally: |
1098 if restore: | 1098 if restore: |
1108 errors += 1 | 1108 errors += 1 |
1109 return | 1109 return |
1110 if ui.verbose or not exact: | 1110 if ui.verbose or not exact: |
1111 ui.status(_('copying %s to %s\n') % (relsrc, reltarget)) | 1111 ui.status(_('copying %s to %s\n') % (relsrc, reltarget)) |
1112 targets[abstarget] = abssrc | 1112 targets[abstarget] = abssrc |
1113 if abstarget != origsrc and not opts['dry_run']: | 1113 if abstarget != origsrc and not opts.get('dry_run'): |
1114 repo.copy(origsrc, abstarget, wlock) | 1114 repo.copy(origsrc, abstarget, wlock) |
1115 copied.append((abssrc, relsrc, exact)) | 1115 copied.append((abssrc, relsrc, exact)) |
1116 | 1116 |
1117 def targetpathfn(pat, dest, srcs): | 1117 def targetpathfn(pat, dest, srcs): |
1118 if os.path.isdir(pat): | 1118 if os.path.isdir(pat): |
2350 names = [] | 2350 names = [] |
2351 for abs, rel, exact in copied: | 2351 for abs, rel, exact in copied: |
2352 if ui.verbose or not exact: | 2352 if ui.verbose or not exact: |
2353 ui.status(_('removing %s\n') % rel) | 2353 ui.status(_('removing %s\n') % rel) |
2354 names.append(abs) | 2354 names.append(abs) |
2355 if not opts['dry_run']: | 2355 if not opts.get('dry_run'): |
2356 repo.remove(names, True, wlock) | 2356 repo.remove(names, True, wlock) |
2357 return errs | 2357 return errs |
2358 | 2358 |
2359 def revert(ui, repo, *pats, **opts): | 2359 def revert(ui, repo, *pats, **opts): |
2360 """revert files or dirs to their states as of some revision | 2360 """revert files or dirs to their states as of some revision |