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

Alexis S. L. Carvalho alexis at cecm.usp.br
Fri Jan 5 14:48:11 CST 2007


Thus spake Giorgos Keramidas:
> Symlink rename & merge doesn't really work yet, so I'm going to give it
> a shot next.

Copying symlinks will require some slightly annoying work to make
commands.docopy and the copy functions in util.py symlink-aware.

> 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):

I'm thinking it'd be better to define a util.lexists function and just
use it instead of os.path.exists in the appropriate places.

We can't just use os.path.lexists since that doesn't exist in python 2.3

Alexis


More information about the Mercurial-devel mailing list