[PATCH] Fix addremove for symlinks to non-existent files

Giorgos Keramidas keramida at ceid.upatras.gr
Fri Jan 5 13:53:56 CST 2007


This is a continuation of the fix for issue309 by Alexis S. L. Carvalho.
It lets me use "hg addremove" in a working directory with symlinks.

Symlink rename & merge doesn't really work yet, so I'm going to give it
a shot next.

On 2007-01-05 21:51, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> # HG changeset patch
> # User Giorgos Keramidas <keramida at ceid.upatras.gr>
> # Date 1168025329 -7200
> # Node ID 19c0fe2a4c8db94e775423c21144f1f517209611
> # Parent  d8fead5407c1b09fb02a41abbff14df8357e68e8
> Fix addremove for symlinks to non-existent files
> 
> diff -r d8fead5407c1 -r 19c0fe2a4c8d mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py	Fri Jan 05 17:11:21 2007 +0200
> +++ b/mercurial/cmdutil.py	Fri Jan 05 21:28:49 2007 +0200
> @@ -174,7 +174,8 @@ def addremove(repo, pats=[], opts={}, wl
>              mapping[abs] = rel, exact
>              if repo.ui.verbose or not exact:
>                  repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
> -        if repo.dirstate.state(abs) != 'r' and not os.path.exists(rel):
> +        islink = os.path.islink(rel)
> +        if repo.dirstate.state(abs) != 'r' and not islink and not os.path.exists(rel):
>              remove.append(abs)
>              mapping[abs] = rel, exact
>              if repo.ui.verbose or not exact:


More information about the Mercurial-devel mailing list