##// END OF EJS Templates
addremove: build lists of already added and removed files too (issue1696)
Matt Mackall -
r8990:62739933 default
parent child Browse files
Show More
@@ -298,7 +298,8 b' def addremove(repo, pats=[], opts={}, dr'
298 298 dry_run = opts.get('dry_run')
299 299 if similarity is None:
300 300 similarity = float(opts.get('similarity') or 0)
301 unknown, deleted = [], []
301 # we'd use status here, except handling of symlinks and ignore is tricky
302 added, unknown, deleted, removed = [], [], [], []
302 303 audit_path = util.path_auditor(repo.root)
303 304 m = match(repo, pats, opts)
304 305 for abs in repo.walk(m):
@@ -314,16 +315,22 b' def addremove(repo, pats=[], opts={}, dr'
314 315 unknown.append(abs)
315 316 if repo.ui.verbose or not exact:
316 317 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
317 if repo.dirstate[abs] != 'r' and (not good or not util.lexists(target)
318 elif repo.dirstate[abs] != 'r' and (not good or not util.lexists(target)
318 319 or (os.path.isdir(target) and not os.path.islink(target))):
319 320 deleted.append(abs)
320 321 if repo.ui.verbose or not exact:
321 322 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
323 # for finding renames
324 elif repo.dirstate[abs] == 'r':
325 removed.append(abs)
326 elif repo.dirstate[abs] == 'a':
327 added.append(abs)
322 328 if not dry_run:
323 329 repo.remove(deleted)
324 330 repo.add(unknown)
325 331 if similarity > 0:
326 for old, new, score in findrenames(repo, unknown, deleted, similarity):
332 for old, new, score in findrenames(repo, added + unknown,
333 removed + deleted, similarity):
327 334 if repo.ui.verbose or not m.exact(old) or not m.exact(new):
328 335 repo.ui.status(_('recording removal of %s as rename to %s '
329 336 '(%d%% similar)\n') %
@@ -22,5 +22,6 b' hg commit -Ama'
22 22 mv a b
23 23 rm c
24 24 echo d > d
25 hg addremove -n -s 50 # issue 1696
25 26 hg addremove -s 50
26 27 hg commit -mb
@@ -15,3 +15,8 b' adding b'
15 15 removing c
16 16 adding d
17 17 recording removal of a as rename to b (100% similar)
18 removing a
19 adding b
20 removing c
21 adding d
22 recording removal of a as rename to b (100% similar)
General Comments 0
You need to be logged in to leave comments. Login now