changeset 9575:5e44d9e562bc

merge with hg-stable
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Sat, 10 Oct 2009 12:19:58 +0200
parents 9e9f63d5c456 (diff) 7cea12e70129 (current diff)
children c156bf947e26 ea1935e2020a c358f3e78935
files
diffstat 7 files changed, 55 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/encoding.py	Thu Oct 08 01:17:24 2009 -0500
+++ b/mercurial/encoding.py	Sat Oct 10 12:19:58 2009 +0200
@@ -16,7 +16,9 @@
         # On darwin, getpreferredencoding ignores the locale environment and
         # always returns mac-roman. We override this if the environment is
         # not C (has been customized by the user).
-        locale.setlocale(locale.LC_CTYPE, '')
+        lc = locale.setlocale(locale.LC_CTYPE, '')
+        if lc == 'UTF-8':
+            locale.setlocale(locale.LC_CTYPE, 'en_US.UTF-8')
         encoding = locale.getlocale()[1]
     if not encoding:
         encoding = locale.getpreferredencoding() or 'ascii'
--- a/mercurial/patch.py	Thu Oct 08 01:17:24 2009 -0500
+++ b/mercurial/patch.py	Sat Oct 10 12:19:58 2009 +0200
@@ -63,6 +63,10 @@
 
         subject = msg['Subject']
         user = msg['From']
+        if not subject and not user:
+            # Not an email, restore parsed headers if any
+            subject = '\n'.join(': '.join(h) for h in msg.items()) + '\n'
+
         gitsendmail = 'git-send-email' in msg.get('X-Mailer', '')
         # should try to parse msg['Date']
         date = None
--- a/mercurial/windows.py	Thu Oct 08 01:17:24 2009 -0500
+++ b/mercurial/windows.py	Sat Oct 10 12:19:58 2009 +0200
@@ -258,7 +258,7 @@
         head, tail = os.path.split(head)
     while head and tail:
         try:
-            if osutil.listdir(name):
+            if osutil.listdir(head):
                 return
             os.rmdir(head)
         except:
--- a/tests/test-import	Thu Oct 08 01:17:24 2009 -0500
+++ b/tests/test-import	Sat Oct 10 12:19:58 2009 +0200
@@ -332,3 +332,23 @@
 EOF
 hg import --no-commit a.patch
 cd ..
+
+echo % 'first line mistaken for email headers (issue 1859)'
+hg init emailconfusion
+cd emailconfusion
+cat > a.patch <<EOF
+module: summary
+
+description
+
+
+diff -r 000000000000 -r 9b4c1e343b55 test.txt
+--- /dev/null
++++ b/a
+@@ -0,0 +1,1 @@
++a
+EOF
+hg import -d '0 0' a.patch
+hg parents -v
+cd ..
+
--- a/tests/test-import.out	Thu Oct 08 01:17:24 2009 -0500
+++ b/tests/test-import.out	Sat Oct 10 12:19:58 2009 +0200
@@ -292,3 +292,16 @@
 % add empty file from the end of patch (issue 1495)
 adding a
 applying a.patch
+% first line mistaken for email headers (issue 1859)
+applying a.patch
+changeset:   0:5a681217c0ad
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+files:       a
+description:
+module: summary
+
+description
+
+
--- a/tests/test-remove	Thu Oct 08 01:17:24 2009 -0500
+++ b/tests/test-remove	Sat Oct 10 12:19:58 2009 +0200
@@ -108,3 +108,12 @@
 echo % dir, options -Af
 rm test/bar
 remove -Af test
+
+echo 'test remove dropping empty trees (issue1861)'
+mkdir -p issue1861/b/c
+echo x > issue1861/x
+echo y > issue1861/b/c/y
+hg ci -Am add
+hg rm issue1861/b
+hg ci -m remove
+ls issue1861
--- a/tests/test-remove.out	Thu Oct 08 01:17:24 2009 -0500
+++ b/tests/test-remove.out	Sat Oct 10 12:19:58 2009 +0200
@@ -111,3 +111,8 @@
 ./foo
 ./test/foo
 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+test remove dropping empty trees (issue1861)
+adding issue1861/b/c/y
+adding issue1861/x
+removing issue1861/b/c/y
+x