changeset 2304:b3a08ccfb593

Merge with main
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 17 May 2006 21:52:51 +0200
parents 78e7fd16f472 (diff) 4be9a79b49b1 (current diff)
children e7de4dd43472
files
diffstat 6 files changed, 60 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Wed May 17 13:21:36 2006 -0500
+++ b/hgext/mq.py	Wed May 17 21:52:51 2006 +0200
@@ -102,6 +102,7 @@
         message = []
         comments = []
         user = None
+        date = None
         format = None
         subject = None
         diffstart = 0
@@ -119,6 +120,8 @@
                 # parse values when importing the result of an hg export
                 if line.startswith("# User "):
                     user = line[7:]
+                elif line.startswith("# Date "):
+                    date = line[7:]
                 elif not line.startswith("# ") and line:
                     message.append(line)
                     format = None
@@ -136,7 +139,7 @@
                 # when looking for tags (subject: from: etc) they
                 # end once you find a blank line in the source
                 format = "tagdone"
-            else:
+            elif message or line:
                 message.append(line)
             comments.append(line)
 
@@ -149,7 +152,7 @@
         if format and format.startswith("tag") and subject:
             message.insert(0, "")
             message.insert(0, subject)
-        return (message, comments, user, diffstart > 1)
+        return (message, comments, user, date, diffstart > 1)
 
     def mergeone(self, repo, mergeq, head, patch, rev, wlock):
         # first try just applying the patch
@@ -179,7 +182,7 @@
             self.ui.warn("repo commit failed\n")
             sys.exit(1)
         try:
-            message, comments, user, patchfound = mergeq.readheaders(patch)
+            message, comments, user, date, patchfound = mergeq.readheaders(patch)
         except:
             self.ui.warn("Unable to read %s\n" % patch)
             sys.exit(1)
@@ -267,7 +270,7 @@
             pf = os.path.join(patchdir, patch)
 
             try:
-                message, comments, user, patchfound = self.readheaders(patch)
+                message, comments, user, date, patchfound = self.readheaders(patch)
             except:
                 self.ui.warn("Unable to read %s\n" % pf)
                 err = 1
@@ -326,7 +329,7 @@
             if len(files) > 0:
                 commands.addremove_lock(self.ui, repo, files,
                                         opts={}, wlock=wlock)
-            n = repo.commit(files, message, user, force=1, lock=lock,
+            n = repo.commit(files, message, user, date, force=1, lock=lock,
                             wlock=wlock)
 
             if n == None:
@@ -716,7 +719,7 @@
         top = revlog.bin(top)
         cparents = repo.changelog.parents(top)
         patchparent = self.qparents(repo, top)
-        message, comments, user, patchfound = self.readheaders(patch)
+        message, comments, user, date, patchfound = self.readheaders(patch)
 
         patchf = self.opener(patch, "w")
         if comments:
--- a/mercurial/commands.py	Wed May 17 13:21:36 2006 -0500
+++ b/mercurial/commands.py	Wed May 17 21:52:51 2006 +0200
@@ -1392,6 +1392,7 @@
 
     fp.write("# HG changeset patch\n")
     fp.write("# User %s\n" % change[1])
+    fp.write("# Date %d %d\n" % change[2])
     fp.write("# Node ID %s\n" % hex(node))
     fp.write("# Parent  %s\n" % hex(prev))
     if len(parents) > 1:
@@ -1687,6 +1688,7 @@
 
         message = []
         user = None
+        date = None
         hgpatch = False
         for line in file(pf):
             line = line.rstrip()
@@ -1703,27 +1705,29 @@
                 if line.startswith("# User "):
                     user = line[7:]
                     ui.debug(_('User: %s\n') % user)
+                elif line.startswith("# Date "):
+                    date = line[7:]
                 elif not line.startswith("# ") and line:
                     message.append(line)
                     hgpatch = False
             elif line == '# HG changeset patch':
                 hgpatch = True
                 message = []       # We may have collected garbage
-            else:
+            elif message or line:
                 message.append(line)
 
         # make sure message isn't empty
         if not message:
             message = _("imported patch %s\n") % patch
         else:
-            message = "%s\n" % '\n'.join(message)
+            message = '\n'.join(message).rstrip()
         ui.debug(_('message:\n%s\n') % message)
 
         files = util.patch(strip, pf, ui)
 
         if len(files) > 0:
             addremove_lock(ui, repo, files, {})
-        repo.commit(files, message, user)
+        repo.commit(files, message, user, date)
 
 def incoming(ui, repo, source="default", **opts):
     """show new changesets found in source
--- a/mercurial/localrepo.py	Wed May 17 13:21:36 2006 -0500
+++ b/mercurial/localrepo.py	Wed May 17 21:52:51 2006 +0200
@@ -550,12 +550,15 @@
             # run editor in the repository root
             olddir = os.getcwd()
             os.chdir(self.root)
-            edittext = self.ui.edit("\n".join(edittext), user)
+            text = self.ui.edit("\n".join(edittext), user)
             os.chdir(olddir)
-            if not edittext.rstrip():
-                return None
-            text = edittext
 
+        lines = [line.rstrip() for line in text.rstrip().splitlines()]
+        while lines and not lines[0]:
+            del lines[0]
+        if not lines:
+            return None
+        text = '\n'.join(lines)
         n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date)
         self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
                   parent2=xp2)
--- a/tests/test-backout.out	Wed May 17 13:21:36 2006 -0500
+++ b/tests/test-backout.out	Wed May 17 21:52:51 2006 +0200
@@ -1,19 +1,19 @@
 # basic operation
 adding a
-changeset 2:c86754337410 backs out changeset 1:a820f4f40a57
+changeset 2:b38a34ddfd9f backs out changeset 1:a820f4f40a57
 a
 # file that was removed is recreated
 adding a
 adding a
-changeset 2:d2d961bd79f2 backs out changeset 1:76862dcce372
+changeset 2:44cd84c7349a backs out changeset 1:76862dcce372
 content
 # backout of backout is as if nothing happened
 removing a
-changeset 3:8a7eeb5ab5ce backs out changeset 2:d2d961bd79f2
+changeset 3:0dd8a0ed5e99 backs out changeset 2:44cd84c7349a
 cat: a: No such file or directory
 # backout with merge
 adding a
-changeset 3:3c9e845b409c backs out changeset 1:314f55b1bf23
+changeset 3:6c77ecc28460 backs out changeset 1:314f55b1bf23
 merging with changeset 2:b66ea5b77abb
 merging a
 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-command-template.out	Wed May 17 13:21:36 2006 -0500
+++ b/tests/test-command-template.out	Wed May 17 21:52:51 2006 +0200
@@ -6,40 +6,40 @@
 43a46
 > files:       
 # compact style works
-3[tip]   8c7f028fbabf   1970-01-16 01:06 +0000   person
+3[tip]   10e46f2dcbf4   1970-01-16 01:06 +0000   person
   no user, no domain
 
-2   259081bc29d1   1970-01-14 21:20 +0000   other
+2   97054abb4ab8   1970-01-14 21:20 +0000   other
   no person
 
-1   1c37ba774509   1970-01-13 17:33 +0000   other
+1   b608e9d1a3f0   1970-01-13 17:33 +0000   other
   other 1
 
-0   6eb5362d59ec   1970-01-12 13:46 +0000   user
+0   1e4e1b8f71e0   1970-01-12 13:46 +0000   user
   line 1
 
-3[tip]   8c7f028fbabf   1970-01-16 01:06 +0000   person
+3[tip]   10e46f2dcbf4   1970-01-16 01:06 +0000   person
   no user, no domain
 
-2   259081bc29d1   1970-01-14 21:20 +0000   other
+2   97054abb4ab8   1970-01-14 21:20 +0000   other
   no person
 
-1   1c37ba774509   1970-01-13 17:33 +0000   other
+1   b608e9d1a3f0   1970-01-13 17:33 +0000   other
   other 1
 
-0   6eb5362d59ec   1970-01-12 13:46 +0000   user
+0   1e4e1b8f71e0   1970-01-12 13:46 +0000   user
   line 1
 
-3[tip]:2,-1   8c7f028fbabf   1970-01-16 01:06 +0000   person
+3[tip]:2,-1   10e46f2dcbf4   1970-01-16 01:06 +0000   person
   no user, no domain
 
-2:1,-1   259081bc29d1   1970-01-14 21:20 +0000   other
+2:1,-1   97054abb4ab8   1970-01-14 21:20 +0000   other
   no person
 
-1:0,-1   1c37ba774509   1970-01-13 17:33 +0000   other
+1:0,-1   b608e9d1a3f0   1970-01-13 17:33 +0000   other
   other 1
 
-0:-1,-1   6eb5362d59ec   1970-01-12 13:46 +0000   user
+0:-1,-1   1e4e1b8f71e0   1970-01-12 13:46 +0000   user
   line 1
 
 # error if style not readable
@@ -103,30 +103,24 @@
 other 2
 
 other 3
-
 desc: line 1
 line 2
-
 desc--verbose: no user, no domain
 desc--verbose: no person
 desc--verbose: other 1
 other 2
 
 other 3
-
 desc--verbose: line 1
 line 2
-
 desc--debug: no user, no domain
 desc--debug: no person
 desc--debug: other 1
 other 2
 
 other 3
-
 desc--debug: line 1
 line 2
-
 file_adds: 
 file_adds: 
 file_adds: 
@@ -175,18 +169,18 @@
 manifest--debug: 2:6e0e82995c35
 manifest--debug: 1:4e8d705b1e53
 manifest--debug: 0:a0c8bcbbb45c
-node: 8c7f028fbabf93fde80ef788885370b36abeff33
-node: 259081bc29d176c6ae17af5dd01a3440b3288c97
-node: 1c37ba7745099d0f206b3a663abcfe127b037433
-node: 6eb5362d59ec784e4431d3e140c8cc6e1b77ce82
-node--verbose: 8c7f028fbabf93fde80ef788885370b36abeff33
-node--verbose: 259081bc29d176c6ae17af5dd01a3440b3288c97
-node--verbose: 1c37ba7745099d0f206b3a663abcfe127b037433
-node--verbose: 6eb5362d59ec784e4431d3e140c8cc6e1b77ce82
-node--debug: 8c7f028fbabf93fde80ef788885370b36abeff33
-node--debug: 259081bc29d176c6ae17af5dd01a3440b3288c97
-node--debug: 1c37ba7745099d0f206b3a663abcfe127b037433
-node--debug: 6eb5362d59ec784e4431d3e140c8cc6e1b77ce82
+node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
+node: 97054abb4ab824450e9164180baf491ae0078465
+node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
+node: 1e4e1b8f71e05681d422154f5421e385fec3454f
+node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
+node--verbose: 97054abb4ab824450e9164180baf491ae0078465
+node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
+node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
+node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
+node--debug: 97054abb4ab824450e9164180baf491ae0078465
+node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
+node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
 parents: 
 parents: 
 parents: 
@@ -195,9 +189,9 @@
 parents--verbose: 
 parents--verbose: 
 parents--verbose: 
-parents--debug: 2:259081bc29d1 -1:000000000000 
-parents--debug: 1:1c37ba774509 -1:000000000000 
-parents--debug: 0:6eb5362d59ec -1:000000000000 
+parents--debug: 2:97054abb4ab8 -1:000000000000 
+parents--debug: 1:b608e9d1a3f0 -1:000000000000 
+parents--debug: 0:1e4e1b8f71e0 -1:000000000000 
 parents--debug: -1:000000000000 -1:000000000000 
 rev: 3
 rev: 2
@@ -252,10 +246,10 @@
 no person
 other 1
 line 1
-8c7f028fbabf
-259081bc29d1
-1c37ba774509
-6eb5362d59ec
+10e46f2dcbf4
+97054abb4ab8
+b608e9d1a3f0
+1e4e1b8f71e0
 # error on syntax
 abort: t:3: unmatched quotes
 # done
--- a/tests/test-remove.out	Wed May 17 13:21:36 2006 -0500
+++ b/tests/test-remove.out	Wed May 17 21:52:51 2006 +0200
@@ -3,6 +3,7 @@
 removing foo
 # HG changeset patch
 # User test
+# Date 1000000 0
 # Node ID 8ba83d44753d6259db5ce6524974dd1174e90f47
 # Parent  0000000000000000000000000000000000000000
 1
@@ -14,6 +15,7 @@
 +a
 # HG changeset patch
 # User test
+# Date 1000000 0
 # Node ID a1fce69c50d97881c5c014ab23f580f720c78678
 # Parent  8ba83d44753d6259db5ce6524974dd1174e90f47
 2