changeset 12358:d0a97814b7d7

Merge with crew
author Patrick Mezard <pmezard@gmail.com>
date Mon, 20 Sep 2010 23:42:23 +0200
parents f85338f509e4 (current diff) cb59654c2c7a (diff)
children 3ee44b41b042
files
diffstat 12 files changed, 82 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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))
--- 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)
--- 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
 
--- 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 "
--- 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,
--- 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()
 
--- 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
--- 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
--- 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
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -42,6 +44,8 @@
    action="A">/d1/d2</path>
 <path
    action="A">/d1/d2/b</path>
+<path
+   action="A">/link</path>
 </paths>
 <msg>add a file</msg>
 </logentry>
@@ -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
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -81,6 +88,12 @@
    copyfrom-path="/a"
    copyfrom-rev="2"
    action="A">/b</path>
+<path
+   copyfrom-path="/link"
+   copyfrom-rev="2"
+   action="A">/newlink</path>
+<path
+   action="D">/link</path>
 </paths>
 <msg>rename a file</msg>
 </logentry>
@@ -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
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -126,13 +142,15 @@
 b
 c
 d1
+newlink
 
 a-hg-wc:
 b
 c
 d1
+newlink
 % remove
-4:87bbe3013fb6
+4:07b2e34a5b17
 assuming destination a-hg
 initializing svn working copy 'a-hg-wc'
 scanning source...
@@ -145,6 +163,7 @@
  5 1 test d1
  5 1 test d1/d2
  5 1 test d1/d2/b
+ 5 3 test newlink
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -161,12 +180,14 @@
 a:
 c
 d1
+newlink
 
 a-hg-wc:
 c
 d1
+newlink
 % executable
-5:ff42e473c340
+5:31093672760b
 assuming destination a-hg
 initializing svn working copy 'a-hg-wc'
 scanning source...
@@ -179,6 +200,7 @@
  6 1 test d1
  6 1 test d1/d2
  6 1 test d1/d2/b
+ 6 3 test newlink
 <?xml version="1.0"?>
 <log>
 <logentry
--- a/tests/test-mq-symlinks.t	Mon Sep 20 15:50:36 2010 -0500
+++ b/tests/test-mq-symlinks.t	Mon Sep 20 23:42:23 2010 +0200
@@ -88,3 +88,33 @@
   C b
   C c
   C s
+
+replace broken symlink with another broken symlink
+
+  $ ln -s linka linka
+  $ hg add linka
+  $ hg qnew link
+  $ hg mv linka linkb
+  $ ln -sf linkb linkb
+  $ hg qnew movelink
+  $ hg qpop
+  popping movelink
+  now at: link
+  $ hg qpush
+  applying movelink
+  now at: movelink
+  $ $TESTDIR/readlink.py linkb
+  linkb -> 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]
--- 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