# HG changeset patch # User Patrick Mezard # Date 1285018943 -7200 # Node ID d0a97814b7d7f7eb6790d00813848dfc9ea82193 # Parent f85338f509e41412eac5f627293a9b193179d13b# Parent cb59654c2c7a21e703a7ed85343b81c2319eb0d6 Merge with crew diff -r f85338f509e4 -r d0a97814b7d7 hgext/convert/gnuarch.py --- a/hgext/convert/gnuarch.py Mon Sep 20 15:50:36 2010 -0500 +++ b/hgext/convert/gnuarch.py Mon Sep 20 23:42:23 2010 +0200 @@ -138,7 +138,7 @@ raise util.Abort(_('internal calling inconsistency')) # Raise IOError if necessary (i.e. deleted files). - if not os.path.exists(os.path.join(self.tmppath, name)): + if not os.path.lexists(os.path.join(self.tmppath, name)): raise IOError return self._getfile(name, rev) diff -r f85338f509e4 -r d0a97814b7d7 hgext/convert/subversion.py --- a/hgext/convert/subversion.py Mon Sep 20 15:50:36 2010 -0500 +++ b/hgext/convert/subversion.py Mon Sep 20 23:42:23 2010 +0200 @@ -1037,7 +1037,7 @@ # our copyfile method expects to record a copy that has # already occurred. Cross the semantic gap. wdest = self.wjoin(dest) - exists = os.path.exists(wdest) + exists = os.path.lexists(wdest) if exists: fd, tempname = tempfile.mkstemp( prefix='hg-copy-', dir=os.path.dirname(wdest)) diff -r f85338f509e4 -r d0a97814b7d7 hgext/mq.py --- a/hgext/mq.py Mon Sep 20 15:50:36 2010 -0500 +++ b/hgext/mq.py Mon Sep 20 23:42:23 2010 +0200 @@ -674,7 +674,7 @@ removed = [] merged = [] for f in files: - if os.path.exists(repo.wjoin(f)): + if os.path.lexists(repo.wjoin(f)): merged.append(f) else: removed.append(f) diff -r f85338f509e4 -r d0a97814b7d7 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Mon Sep 20 15:50:36 2010 -0500 +++ b/mercurial/cmdutil.py Mon Sep 20 23:42:23 2010 +0200 @@ -363,7 +363,7 @@ islink, isexec = gp.mode dst = repo.wjoin(gp.path) # patch won't create empty files - if gp.op == 'ADD' and not os.path.exists(dst): + if gp.op == 'ADD' and not os.path.lexists(dst): flags = (isexec and 'x' or '') + (islink and 'l' or '') repo.wwrite(gp.path, '', flags) util.set_flags(dst, islink, isexec) @@ -422,7 +422,7 @@ return # check for overwrites - exists = os.path.exists(target) + exists = os.path.lexists(target) if not after and exists or after and state in 'mn': if not opts['force']: ui.warn(_('%s: not overwriting - file exists\n') % @@ -521,7 +521,7 @@ score = 0 for s in srcs: t = os.path.join(dest, util.localpath(s[0])[striplen:]) - if os.path.exists(t): + if os.path.lexists(t): score += 1 return score diff -r f85338f509e4 -r d0a97814b7d7 mercurial/context.py --- a/mercurial/context.py Mon Sep 20 15:50:36 2010 -0500 +++ b/mercurial/context.py Mon Sep 20 23:42:23 2010 +0200 @@ -825,7 +825,7 @@ wlock = self._repo.wlock() try: for f in list: - if unlink and os.path.exists(self._repo.wjoin(f)): + if unlink and os.path.lexists(self._repo.wjoin(f)): self._repo.ui.warn(_("%s still exists!\n") % f) elif self._repo.dirstate[f] == 'a': self._repo.dirstate.forget(f) @@ -853,7 +853,7 @@ def copy(self, source, dest): p = self._repo.wjoin(dest) - if not (os.path.exists(p) or os.path.islink(p)): + if not os.path.lexists(p): self._repo.ui.warn(_("%s does not exist!\n") % dest) elif not (os.path.isfile(p) or os.path.islink(p)): self._repo.ui.warn(_("copy failed: %s is not a file or a " diff -r f85338f509e4 -r d0a97814b7d7 mercurial/dirstate.py --- a/mercurial/dirstate.py Mon Sep 20 15:50:36 2010 -0500 +++ b/mercurial/dirstate.py Mon Sep 20 23:42:23 2010 +0200 @@ -362,7 +362,7 @@ norm_path = os.path.normcase(path) fold_path = self._foldmap.get(norm_path, None) if fold_path is None: - if knownpath or not os.path.exists(os.path.join(self._root, path)): + if knownpath or not os.path.lexists(os.path.join(self._root, path)): fold_path = path else: fold_path = self._foldmap.setdefault(norm_path, diff -r f85338f509e4 -r d0a97814b7d7 mercurial/patch.py --- a/mercurial/patch.py Mon Sep 20 15:50:36 2010 -0500 +++ b/mercurial/patch.py Mon Sep 20 23:42:23 2010 +0200 @@ -25,7 +25,7 @@ def copyfile(src, dst, basedir): abssrc, absdst = [util.canonpath(basedir, basedir, x) for x in [src, dst]] - if os.path.exists(absdst): + if os.path.lexists(absdst): raise util.Abort(_("cannot create %s: destination already exists") % dst) @@ -923,7 +923,7 @@ if afile == bfile: goodb = gooda else: - goodb = not nullb and os.path.exists(bfile) + goodb = not nullb and os.path.lexists(bfile) createfunc = hunk.createfile missing = not goodb and not gooda and not createfunc() diff -r f85338f509e4 -r d0a97814b7d7 mercurial/util.py --- a/mercurial/util.py Mon Sep 20 15:50:36 2010 -0500 +++ b/mercurial/util.py Mon Sep 20 23:42:23 2010 +0200 @@ -644,7 +644,7 @@ l = l + 1 name = name[l:] - if not os.path.exists(os.path.join(root, name)): + if not os.path.lexists(os.path.join(root, name)): return None seps = os.sep diff -r f85338f509e4 -r d0a97814b7d7 tests/test-convert-svn-sink --- a/tests/test-convert-svn-sink Mon Sep 20 15:50:36 2010 -0500 +++ b/tests/test-convert-svn-sink Mon Sep 20 23:42:23 2010 +0200 @@ -29,6 +29,7 @@ echo a > a/a mkdir -p a/d1/d2 echo b > a/d1/d2/b +ln -s a/missing a/link echo % add hg --cwd a ci -d '0 0' -A -m 'add a file' @@ -43,6 +44,7 @@ cmp a/a a-hg-wc/a && echo same || echo different hg --cwd a mv a b +hg --cwd a mv link newlink echo % rename hg --cwd a ci -d '2 0' -m 'rename a file' hg --cwd a tip -q diff -r f85338f509e4 -r d0a97814b7d7 tests/test-convert-svn-sink.out --- a/tests/test-convert-svn-sink.out Mon Sep 20 15:50:36 2010 -0500 +++ b/tests/test-convert-svn-sink.out Mon Sep 20 23:42:23 2010 +0200 @@ -1,8 +1,9 @@ % add adding a adding d1/d2/b +adding link % modify -1:e0e2b8a9156b +1:8231f652da37 assuming destination a-hg initializing svn repository 'a-hg' initializing svn working copy 'a-hg-wc' @@ -17,6 +18,7 @@ 2 1 test d1 2 1 test d1/d2 2 1 test d1/d2/b + 2 1 test link /d1/d2 /d1/d2/b +/link add a file @@ -49,13 +53,15 @@ a: a d1 +link a-hg-wc: a d1 +link same % rename -2:eb5169441d43 +2:a67e26ccec09 assuming destination a-hg initializing svn working copy 'a-hg-wc' scanning source... @@ -68,6 +74,7 @@ 3 1 test d1 3 1 test d1/d2 3 1 test d1/d2/b + 3 3 test newlink /b +/newlink +/link rename a file @@ -88,12 +101,14 @@ a: b d1 +newlink a-hg-wc: b d1 +newlink % copy -3:60effef6ab48 +3:0cf087b9ab02 assuming destination a-hg initializing svn working copy 'a-hg-wc' scanning source... @@ -107,6 +122,7 @@ 4 1 test d1 4 1 test d1/d2 4 1 test d1/d2/b + 4 3 test newlink linkb + +check patch does not overwrite untracked symlinks + + $ hg qpop + popping movelink + now at: link + $ ln -s linkbb linkb + $ hg qpush + applying movelink + patch failed, unable to continue (try -v) + patch failed, rejects left in working dir + errors during apply, please fix and refresh movelink + [2] diff -r f85338f509e4 -r d0a97814b7d7 tests/test-rename.t --- a/tests/test-rename.t Mon Sep 20 15:50:36 2010 -0500 +++ b/tests/test-rename.t Mon Sep 20 23:42:23 2010 +0200 @@ -372,6 +372,17 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ rm d1/ca +attempt to overwrite an existing broken symlink + + $ ln -s ba d1/ca + $ hg rename --traceback d1/ba d1/ca + d1/ca: not overwriting - file exists + $ hg status -C + ? d1/ca + $ hg update -C + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ rm d1/ca + replace a symlink with a file $ ln -s ba d1/ca