##// END OF EJS Templates
remove: work directly off status...
Matt Mackall -
r6761:cb981fc9 default
parent child Browse files
Show More
@@ -2197,46 +2197,29 b' def remove(ui, repo, *pats, **opts):'
2197 raise util.Abort(_('no files specified'))
2197 raise util.Abort(_('no files specified'))
2198
2198
2199 m = cmdutil.match(repo, pats, opts)
2199 m = cmdutil.match(repo, pats, opts)
2200 mardu = map(dict.fromkeys, repo.status(match=m, unknown=True))[:5]
2200 s = repo.status(match=m, clean=True)
2201 modified, added, removed, deleted, unknown = mardu
2201 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
2202
2202
2203 remove, forget = [], []
2203 def warn(files, reason):
2204 for abs in repo.walk(m):
2204 for f in files:
2205
2205 ui.warn(_('not removing %s: file %s (use -f to force removal)\n')
2206 reason = None
2206 % (m.rel(f), reason))
2207 if abs in removed or abs in unknown:
2207
2208 continue
2208 if force:
2209
2209 remove, forget = modified + deleted + clean, added
2210 # last column
2210 elif after:
2211 elif abs in deleted:
2211 remove, forget = deleted, []
2212 remove.append(abs)
2212 warn(modified + added + clean, _('still exists'))
2213
2213 else:
2214 # rest of the third row
2214 remove, forget = deleted + clean, []
2215 elif after and not force:
2215 warn(modified, _('is modified'))
2216 reason = _('still exists (use -f to force removal)')
2216 warn(added, _('has been marked for add'))
2217
2217
2218 # rest of the first column
2218 files = remove + forget
2219 elif abs in added:
2219 files.sort()
2220 if not force:
2220 for f in files:
2221 reason = _('has been marked for add (use -f to force removal)')
2221 if ui.verbose or not m.exact(f):
2222 else:
2222 ui.status(_('removing %s\n') % m.rel(f))
2223 forget.append(abs)
2224
2225 # rest of the third column
2226 elif abs in modified:
2227 if not force:
2228 reason = _('is modified (use -f to force removal)')
2229 else:
2230 remove.append(abs)
2231
2232 # rest of the second column
2233 elif not reason:
2234 remove.append(abs)
2235
2236 if reason:
2237 ui.warn(_('not removing %s: file %s\n') % (m.rel(abs), reason))
2238 elif ui.verbose or not m.exact(abs):
2239 ui.status(_('removing %s\n') % m.rel(abs))
2240
2223
2241 repo.forget(forget)
2224 repo.forget(forget)
2242 repo.remove(remove, unlink=not after)
2225 repo.remove(remove, unlink=not after)
@@ -70,15 +70,15 b' 1 files updated, 0 files merged, 0 files'
70 adding test/bar
70 adding test/bar
71 adding test/foo
71 adding test/foo
72 % dir, options none
72 % dir, options none
73 removing test/bar
73 removing test/foo
74 removing test/foo
74 removing test/bar
75 R test/bar
75 R test/bar
76 R test/foo
76 R test/foo
77 ./foo
77 ./foo
78 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 % dir, options -f
79 % dir, options -f
80 removing test/bar
80 removing test/foo
81 removing test/foo
81 removing test/bar
82 R test/bar
82 R test/bar
83 R test/foo
83 R test/foo
84 ./foo
84 ./foo
@@ -91,8 +91,8 b' R test/bar'
91 ./test/foo
91 ./test/foo
92 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 % dir, options -Af
93 % dir, options -Af
94 removing test/bar
94 removing test/foo
95 removing test/foo
95 removing test/bar
96 R test/bar
96 R test/bar
97 R test/foo
97 R test/foo
98 ./foo
98 ./foo
General Comments 0
You need to be logged in to leave comments. Login now