Show More
@@ -0,0 +1,15 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | "$TESTDIR/hghave" symlink || exit 80 | |||
|
4 | ||||
|
5 | hg init a | |||
|
6 | cd a | |||
|
7 | ||||
|
8 | echo '% directory moved and symlinked' | |||
|
9 | mkdir foo | |||
|
10 | touch foo/a | |||
|
11 | hg ci -Ama | |||
|
12 | mv foo bar | |||
|
13 | ln -s bar foo | |||
|
14 | echo '% now addremove should remove old files' | |||
|
15 | hg addremove |
@@ -0,0 +1,6 b'' | |||||
|
1 | % directory moved and symlinked | |||
|
2 | adding foo/a | |||
|
3 | % now addremove should remove old files | |||
|
4 | adding bar/a | |||
|
5 | adding foo | |||
|
6 | removing foo/a |
@@ -274,14 +274,20 b' def addremove(repo, pats=[], opts={}, dr' | |||||
274 | similarity = float(opts.get('similarity') or 0) |
|
274 | similarity = float(opts.get('similarity') or 0) | |
275 | add, remove = [], [] |
|
275 | add, remove = [], [] | |
276 | mapping = {} |
|
276 | mapping = {} | |
|
277 | audit_path = util.path_auditor(repo.root) | |||
277 | for src, abs, rel, exact in walk(repo, pats, opts): |
|
278 | for src, abs, rel, exact in walk(repo, pats, opts): | |
278 | target = repo.wjoin(abs) |
|
279 | target = repo.wjoin(abs) | |
279 | if src == 'f' and abs not in repo.dirstate: |
|
280 | good = True | |
|
281 | try: | |||
|
282 | audit_path(abs) | |||
|
283 | except: | |||
|
284 | good = False | |||
|
285 | if src == 'f' and good and abs not in repo.dirstate: | |||
280 | add.append(abs) |
|
286 | add.append(abs) | |
281 | mapping[abs] = rel, exact |
|
287 | mapping[abs] = rel, exact | |
282 | if repo.ui.verbose or not exact: |
|
288 | if repo.ui.verbose or not exact: | |
283 | repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
|
289 | repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) | |
284 | if repo.dirstate[abs] != 'r' and (not util.lexists(target) |
|
290 | if repo.dirstate[abs] != 'r' and (not good or not util.lexists(target) | |
285 | or (os.path.isdir(target) and not os.path.islink(target))): |
|
291 | or (os.path.isdir(target) and not os.path.islink(target))): | |
286 | remove.append(abs) |
|
292 | remove.append(abs) | |
287 | mapping[abs] = rel, exact |
|
293 | mapping[abs] = rel, exact |
General Comments 0
You need to be logged in to leave comments.
Login now