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 |
@@ -276,17 +276,23 b' def addremove(repo, pats=[], opts={}, dr' | |||||
276 | similarity = float(opts.get('similarity') or 0) |
|
276 | similarity = float(opts.get('similarity') or 0) | |
277 | add, remove = [], [] |
|
277 | add, remove = [], [] | |
278 | mapping = {} |
|
278 | mapping = {} | |
|
279 | audit_path = util.path_auditor(repo.root) | |||
279 | m = match(repo, pats, opts) |
|
280 | m = match(repo, pats, opts) | |
280 | for abs in repo.walk(m): |
|
281 | for abs in repo.walk(m): | |
281 | target = repo.wjoin(abs) |
|
282 | target = repo.wjoin(abs) | |
|
283 | good = True | |||
|
284 | try: | |||
|
285 | audit_path(abs) | |||
|
286 | except: | |||
|
287 | good = False | |||
282 | rel = m.rel(abs) |
|
288 | rel = m.rel(abs) | |
283 | exact = m.exact(abs) |
|
289 | exact = m.exact(abs) | |
284 | if abs not in repo.dirstate: |
|
290 | if good and abs not in repo.dirstate: | |
285 | add.append(abs) |
|
291 | add.append(abs) | |
286 | mapping[abs] = rel, m.exact(abs) |
|
292 | mapping[abs] = rel, m.exact(abs) | |
287 | if repo.ui.verbose or not exact: |
|
293 | if repo.ui.verbose or not exact: | |
288 | repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
|
294 | repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) | |
289 | if repo.dirstate[abs] != 'r' and (not util.lexists(target) |
|
295 | if repo.dirstate[abs] != 'r' and (not good or not util.lexists(target) | |
290 | or (os.path.isdir(target) and not os.path.islink(target))): |
|
296 | or (os.path.isdir(target) and not os.path.islink(target))): | |
291 | remove.append(abs) |
|
297 | remove.append(abs) | |
292 | mapping[abs] = rel, exact |
|
298 | mapping[abs] = rel, exact |
General Comments 0
You need to be logged in to leave comments.
Login now