changeset 15555:cea62936b39a

merge with stable
author Matt Mackall <mpm@selenic.com>
date Tue, 22 Nov 2011 17:34:22 -0600
parents 1fd126cd2d91 (current diff) 0c0ed2b3082d (diff)
children e5804c0f6576
files tests/test-largefiles.t tests/test-pull-http.t tests/test-pull.t
diffstat 7 files changed, 51 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Tue Nov 22 18:16:59 2011 +0100
+++ b/hgext/largefiles/lfutil.py	Tue Nov 22 17:34:22 2011 -0600
@@ -156,7 +156,7 @@
             hash = readstandin(repo, lfile)
             lfdirstate.normallookup(lfile)
             try:
-                if hash == hashfile(lfile):
+                if hash == hashfile(repo.wjoin(lfile)):
                     lfdirstate.normal(lfile)
             except OSError, err:
                 if err.errno != errno.ENOENT:
--- a/mercurial/dirstate.py	Tue Nov 22 18:16:59 2011 +0100
+++ b/mercurial/dirstate.py	Tue Nov 22 17:34:22 2011 -0600
@@ -68,7 +68,7 @@
     def _foldmap(self):
         f = {}
         for name in self._map:
-            f[os.path.normcase(name)] = name
+            f[util.normcase(name)] = name
         return f
 
     @propertycache
--- a/mercurial/hg.py	Tue Nov 22 18:16:59 2011 +0100
+++ b/mercurial/hg.py	Tue Nov 22 17:34:22 2011 -0600
@@ -356,10 +356,13 @@
         if destrepo.local():
             fp = destrepo.opener("hgrc", "w", text=True)
             fp.write("[paths]\n")
-            fp.write("default = %s\n" % abspath)
+            u = util.url(abspath)
+            u.passwd = None
+            defaulturl = str(u)
+            fp.write("default = %s\n" % defaulturl)
             fp.close()
 
-            destrepo.ui.setconfig('paths', 'default', abspath)
+            destrepo.ui.setconfig('paths', 'default', defaulturl)
 
             if update:
                 if update is not True:
--- a/mercurial/posix.py	Tue Nov 22 18:16:59 2011 +0100
+++ b/mercurial/posix.py	Tue Nov 22 17:34:22 2011 -0600
@@ -6,7 +6,7 @@
 # GNU General Public License version 2 or any later version.
 
 from i18n import _
-import os, sys, errno, stat, getpass, pwd, grp, tempfile
+import os, sys, errno, stat, getpass, pwd, grp, tempfile, unicodedata
 
 posixfile = open
 nulldev = '/dev/null'
@@ -170,6 +170,24 @@
 
 if sys.platform == 'darwin':
     import fcntl # only needed on darwin, missing on jython
+
+    def normcase(path):
+        try:
+            u = path.decode('utf-8')
+        except UnicodeDecodeError:
+            # percent-encode any characters that don't round-trip
+            p2 = path.decode('utf-8', 'replace').encode('utf-8')
+            s = ""
+            for a, b in zip(path, p2):
+                if a != b:
+                    s += "%%%02X" % ord(a)
+                else:
+                    s += a
+            u = s.decode('utf-8')
+
+        # Decompose then lowercase (HFS+ technote specifies lower)
+        return unicodedata.normalize('NFD', u).lower().encode('utf-8')
+
     def realpath(path):
         '''
         Returns the true, canonical file system path equivalent to the given
--- a/tests/test-largefiles.t	Tue Nov 22 18:16:59 2011 +0100
+++ b/tests/test-largefiles.t	Tue Nov 22 17:34:22 2011 -0600
@@ -259,6 +259,12 @@
   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
   getting changed largefiles
   3 largefiles updated, 0 removed
+  $ hg debugstate --nodates
+  n 644         41 .hglf/sub/large4
+  n   0         -1 .hglf/sub2/large6
+  n   0         -1 .hglf/sub2/large7
+  n 644          9 normal3
+  n 644          9 sub/normal4
   $ cd ../b
   $ hg log --template '{rev}:{node|short}  {desc|firstline}\n'
   7:daea875e9014  add/edit more largefiles
@@ -787,8 +793,6 @@
   [255]
   $ cd ..
 
-  $ cd ..
-
 Clone a local repository owned by another user
 We have to simulate that here by setting $HOME and removing write permissions
   $ ORIGHOME="$HOME"
--- a/tests/test-pull-http.t	Tue Nov 22 18:16:59 2011 +0100
+++ b/tests/test-pull-http.t	Tue Nov 22 17:34:22 2011 -0600
@@ -13,13 +13,30 @@
   $ echo a >> a
   $ hg ci -mb
 
+Cloning with a password in the URL should not save the password in .hg/hgrc:
+
+  $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+  $ hg clone http://foo:xyzzy@localhost:$HGPORT/ test3
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat test3/.hg/hgrc
+  [paths]
+  default = http://foo@localhost:$HGPORT/
+  $ "$TESTDIR/killdaemons.py"
+
 expect error, cloning not allowed
 
   $ echo '[web]' > .hg/hgrc
   $ echo 'allowpull = false' >> .hg/hgrc
   $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
   $ cat hg.pid >> $DAEMON_PIDS
-  $ hg clone http://localhost:$HGPORT/ test3
+  $ hg clone http://localhost:$HGPORT/ test4
   requesting all changes
   abort: authorization failed
   [255]
--- a/tests/test-pull.t	Tue Nov 22 18:16:59 2011 +0100
+++ b/tests/test-pull.t	Tue Nov 22 17:34:22 2011 -0600
@@ -45,7 +45,7 @@
   2ed2a3912a0b24502043eae84ee4b279c18b90dd 644   foo
 
   $ hg pull
-  pulling from http://foo:***@localhost:$HGPORT/
+  pulling from http://foo@localhost:$HGPORT/
   searching for changes
   no changes found