##// END OF EJS Templates
Make rm --after simply mark files as removed, unless --force is also given
Brendan Cully -
r4392:9770d260 default
parent child Browse files
Show More
@@ -527,7 +527,7 b' def docopy(ui, repo, pats, opts, wlock):'
527 527 restore = False
528 528 finally:
529 529 if restore:
530 repo.remove([abstarget], wlock)
530 repo.remove([abstarget], wlock=wlock)
531 531 except IOError, inst:
532 532 if inst.errno == errno.ENOENT:
533 533 ui.warn(_('%s: deleted in working copy\n') % relsrc)
@@ -2082,7 +2082,8 b' def remove(ui, repo, *pats, **opts):'
2082 2082 This only removes files from the current branch, not from the
2083 2083 entire project history. If the files still exist in the working
2084 2084 directory, they will be deleted from it. If invoked with --after,
2085 files that have been manually deleted are marked as removed.
2085 files are marked as removed, but not actually unlinked unless --force
2086 is also given.
2086 2087
2087 2088 This command schedules the files to be removed at the next commit.
2088 2089 To undo a remove before that, see hg revert.
@@ -2100,9 +2101,7 b' def remove(ui, repo, *pats, **opts):'
2100 2101 remove, forget = [], []
2101 2102 for src, abs, rel, exact in cmdutil.walk(repo, pats, opts):
2102 2103 reason = None
2103 if abs not in deleted and opts['after']:
2104 reason = _('is still present')
2105 elif abs in modified and not opts['force']:
2104 if abs in modified and not opts['force']:
2106 2105 reason = _('is modified (use -f to force removal)')
2107 2106 elif abs in added:
2108 2107 if opts['force']:
@@ -2121,7 +2120,7 b' def remove(ui, repo, *pats, **opts):'
2121 2120 ui.status(_('removing %s\n') % rel)
2122 2121 remove.append(abs)
2123 2122 repo.forget(forget)
2124 repo.remove(remove, unlink=not opts['after'])
2123 repo.remove(remove, unlink=opts['force'] or not opts['after'])
2125 2124
2126 2125 def rename(ui, repo, *pats, **opts):
2127 2126 """rename files; equivalent of copy + remove
@@ -2145,7 +2144,7 b' def rename(ui, repo, *pats, **opts):'
2145 2144 ui.status(_('removing %s\n') % rel)
2146 2145 names.append(abs)
2147 2146 if not opts.get('dry_run'):
2148 repo.remove(names, True, wlock)
2147 repo.remove(names, True, wlock=wlock)
2149 2148 return errs
2150 2149
2151 2150 def revert(ui, repo, *pats, **opts):
@@ -1031,8 +1031,7 b' class localrepository(repo.repository):'
1031 1031 if not wlock:
1032 1032 wlock = self.wlock()
1033 1033 for f in list:
1034 p = self.wjoin(f)
1035 if os.path.exists(p):
1034 if unlink and os.path.exists(self.wjoin(f)):
1036 1035 self.ui.warn(_("%s still exists!\n") % f)
1037 1036 elif self.dirstate.state(f) == 'a':
1038 1037 self.dirstate.forget([f])
@@ -23,10 +23,13 b' hg add a'
23 23 hg rm a
24 24 hg rm -f a
25 25 echo b > b
26 echo c > c
26 27 hg ci -A -m 3 -d "1000001 0"
27 28 echo c >> b
28 29 hg rm b
29 30 hg rm -f b
31 hg rm -A c
32 cat c
30 33
31 34 cd ..
32 35 hg clone a b
@@ -52,5 +52,7 b' diff -r 8ba83d44753d -r a1fce69c50d9 foo'
52 52 not removing a: file has been marked for add (use -f to force removal)
53 53 adding a
54 54 adding b
55 adding c
55 56 not removing b: file is modified (use -f to force removal)
56 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
57 c
58 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
General Comments 0
You need to be logged in to leave comments. Login now