Patchwork [4,of,9,PoC] mq2: update 'Node ID' for new patches

login
register
mail settings
Submitter Mads Kiilerich
Date Aug. 29, 2014, 8:59 a.m.
Message ID <45d9a0aa776748ca9ef1.1409302761@localhost.localdomain>
Download mbox | patch
Permalink /patch/5611/
State Changes Requested
Headers show

Comments

Mads Kiilerich - Aug. 29, 2014, 8:59 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1409301991 -7200
#      Fri Aug 29 10:46:31 2014 +0200
# Node ID 45d9a0aa776748ca9ef180e92ec525949eb2d5b1
# Parent  01873ea9fda12f58b90e8a3f720dfe30b84c24e6
mq2: update 'Node ID' for new patches

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1084,22 +1084,7 @@  class queue(object):
                 raise util.Abort(_('cannot write patch "%s": %s')
                                  % (patchfn, e.strerror))
             try:
-                if self.plainmode:
-                    if user:
-                        p.write("From: " + user + "\n")
-                        if not date:
-                            p.write("\n")
-                    if date:
-                        p.write("Date: %d %d\n\n" % date)
-                else:
-                    p.write("# HG changeset patch\n")
-                    p.write("# Parent "
-                            + hex(repo[None].p1().node()) + "\n")
-                    if user:
-                        p.write("# User " + user + "\n")
-                    if date:
-                        p.write("# Date %s %s\n\n" % date)
-
+                pnode = repo[None].p1().node()
                 defaultmsg = "[mq]: %s" % patchfn
                 editor = cmdutil.getcommiteditor(editform=editform)
                 if edit:
@@ -1127,6 +1112,23 @@  class queue(object):
                     self.parseseries()
                     self.seriesdirty = True
                     self.applieddirty = True
+
+                    if self.plainmode:
+                        if user:
+                            p.write("From: " + user + "\n")
+                            if not date:
+                                p.write("\n")
+                        if date:
+                            p.write("Date: %d %d\n\n" % date)
+                    else:
+                        p.write("# HG changeset patch\n")
+                        p.write("# Node ID " + hex(n) + "\n")
+                        p.write("# Parent " + hex(pnode) + "\n")
+                        if user:
+                            p.write("# User " + user + "\n")
+                        if date:
+                            p.write("# Date %s %s\n\n" % date)
+
                     nctx = repo[n]
                     if nctx.description() != defaultmsg.rstrip():
                         msg = nctx.description() + "\n\n"
diff --git a/tests/test-mq-git.t b/tests/test-mq-git.t
--- a/tests/test-mq-git.t
+++ b/tests/test-mq-git.t
@@ -17,6 +17,7 @@  git=auto: regular patch creation:
 
   $ cat .hg/patches/adda
   # HG changeset patch
+  # Node ID ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
   # Parent 0000000000000000000000000000000000000000
   # Date 0 0
   
@@ -33,6 +34,7 @@  git=auto: git patch creation with copy:
 
   $ cat .hg/patches/copy
   # HG changeset patch
+  # Node ID 99586d5f048c399e20f81cee41fbb3809c0e735d
   # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
   # Date 0 0
   
@@ -48,6 +50,7 @@  git=auto: git patch when using --git:
 
   $ cat .hg/patches/git
   # HG changeset patch
+  # Node ID 017ef854e040bb4a95a08313edf87d5b8923d8b0
   # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
   # Date 0 0
   
@@ -89,6 +92,7 @@  git=keep: git patch with --git:
 
   $ cat .hg/patches/git
   # HG changeset patch
+  # Node ID 55f6a91e22be7663f0ebcf4f0d56518f848cabab
   # Parent 0000000000000000000000000000000000000000
   # Date 0 0
   
@@ -132,6 +136,7 @@  git=yes: git patch:
 
   $ cat .hg/patches/git
   # HG changeset patch
+  # Node ID 55f6a91e22be7663f0ebcf4f0d56518f848cabab
   # Parent 0000000000000000000000000000000000000000
   # Date 0 0
   
@@ -179,6 +184,7 @@  git=no: regular patch with copy:
 
   $ cat .hg/patches/regular
   # HG changeset patch
+  # Node ID a70404f79ba36d9dfabc8b3fa5c596e664037c30
   # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
   # Date 0 0
   
diff --git a/tests/test-mq-header-date.t b/tests/test-mq-header-date.t
--- a/tests/test-mq-header-date.t
+++ b/tests/test-mq-header-date.t
@@ -553,6 +553,7 @@ 
   ==== init
   ==== qnew -d
   # HG changeset patch
+  # Node ID 758bd2596a39a2bd42410e338f93cf6b4099ef8c
   # Parent 
   # Date 3 0
   
@@ -613,6 +614,7 @@ 
   now at: 1.patch
   ==== qnew -d -m
   # HG changeset patch
+  # Node ID 2a9ef0bdefbad97d5a3ae294eef925639563ae80
   # Parent 
   # Date 6 0
   
diff --git a/tests/test-mq-header-from.t b/tests/test-mq-header-from.t
--- a/tests/test-mq-header-from.t
+++ b/tests/test-mq-header-from.t
@@ -434,6 +434,7 @@ 
   ==== init
   ==== qnew -U
   # HG changeset patch
+  # Node ID 59d4d47ace61907b273524e3b528a76c2abd953b
   # Parent 
   # User test
   # Date 1 0
@@ -496,6 +497,7 @@ 
   0: [mq]: 1.patch - mary
   ==== qnew -U -m
   # HG changeset patch
+  # Node ID 35f253918fbc7af1ceefc27682137dd8e3d4c7e8
   # Parent 
   # User test
   # Date 1 0
@@ -763,6 +765,7 @@ 
   ==== init
   ==== qnew -U
   # HG changeset patch
+  # Node ID 59d4d47ace61907b273524e3b528a76c2abd953b
   # Parent 
   # User test
   # Date 1 0
@@ -825,6 +828,7 @@ 
   0: [mq]: 1.patch - mary
   ==== qnew -U -m
   # HG changeset patch
+  # Node ID 35f253918fbc7af1ceefc27682137dd8e3d4c7e8
   # Parent 
   # User test
   # Date 1 0
diff --git a/tests/test-mq-merge.t b/tests/test-mq-merge.t
--- a/tests/test-mq-merge.t
+++ b/tests/test-mq-merge.t
@@ -138,6 +138,7 @@  Check patcha is still a git patch:
 
   $ cat .hg/patches/patcha
   # HG changeset patch
+  # Node ID c2b5253e33f3a3a7e027e8eb7295cce2d9c2a4dd
   # Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
   # Date 0 0
   
@@ -161,10 +162,11 @@  Check patcha2 is still a regular patch:
 
   $ cat .hg/patches/patcha2
   # HG changeset patch
-  # Parent ???????????????????????????????????????? (glob)
+  # Node ID 6e49848d275fca1655e6cf3f7119e75621813017
+  # Parent c2b5253e33f3a3a7e027e8eb7295cce2d9c2a4dd
   # Date 0 0
   
-  diff -r ???????????? -r ???????????? a (glob)
+  diff -r c2b5253e33f3 -r 6e49848d275f a
   --- a/a
   +++ b/a
   @@ -1,2 +1,3 @@
diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t
--- a/tests/test-mq-qnew.t
+++ b/tests/test-mq-qnew.t
@@ -204,6 +204,7 @@  hg headers
   abort: missing: * (glob)
   % qnew -m
   # HG changeset patch
+  # Node ID 154482b81eb43ca72f6b0ac66d90de55262b25f7
   # Parent 
   # Date 1 0
   
@@ -220,6 +221,7 @@  hg headers
   adding d/b
   M d/b
   # HG changeset patch
+  # Node ID 59c3a3ccb3ed4f7be5da6cf407b050db5ce3070c
   # Parent 
   # Date 1 0
   
@@ -231,12 +233,14 @@  hg headers
   +b
   % qnew -u with no username configured
   # HG changeset patch
+  # Node ID a9a865812dc63f4056356eb84d718e15bc125020
   # Parent 
   # User blue
   # Date 1 0
   
   % qnew -e -u with no username configured
   # HG changeset patch
+  # Node ID 065ab9c357eb19d56aed44cbcf91569032f38cfc
   # Parent 
   # User chartreuse
   # Date 1 0
@@ -354,6 +358,7 @@  Test handling default message with the p
   ====
   $ cat ".hg/patches/patch "
   # HG changeset patch
+  # Node ID 176ba2d2de4edc45064e229bc606f64fe7f8117d
   # Parent 0000000000000000000000000000000000000000
   # Date 1 0
   
diff --git a/tests/test-mq-qrefresh.t b/tests/test-mq-qrefresh.t
--- a/tests/test-mq-qrefresh.t
+++ b/tests/test-mq-qrefresh.t
@@ -538,6 +538,7 @@  but only after writing the bad name into
   $ rm a
   $ cat .hg/patches/a
   # HG changeset patch
+  # Node ID 13feaf289b80d26b38f6395d6eaaf671c5a6c9a9
   # Parent 0000000000000000000000000000000000000000
   # Date 1 0
   
@@ -554,6 +555,7 @@  but only after writing the bad name into
   [255]
   $ cat .hg/patches/a
   # HG changeset patch
+  # Node ID 13feaf289b80d26b38f6395d6eaaf671c5a6c9a9
   # Parent 0000000000000000000000000000000000000000
   # Date 1 0
   
diff --git a/tests/test-mq-subrepo.t b/tests/test-mq-subrepo.t
--- a/tests/test-mq-subrepo.t
+++ b/tests/test-mq-subrepo.t
@@ -419,6 +419,7 @@  both into 'revision' and 'patch file und
   +b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
   $ cat .hg/patches/import-at-qnew
   # HG changeset patch
+  # Node ID f69e96d86e75a6d4fd88285dc9697acb23951041
   # Parent f499373e340cdca5d01dee904aeb42dd2a325e71
   # User test
   # Date 0 0
@@ -556,6 +557,7 @@  check whether qrefresh imports updated .
   +88ac1bef5ed43b689d1d200b59886b675dec474b sub
   $ cat .hg/patches/checkstate-at-qnew
   # HG changeset patch
+  # Node ID 1259c112d8846edba21f2388e678e139ab1be019
   # Parent 4d91eb2fa1d1b22ec513347b9cd06f6b49d470fa
   # User test
   # Date 0 0
diff --git a/tests/test-mq2.t b/tests/test-mq2.t
--- a/tests/test-mq2.t
+++ b/tests/test-mq2.t
@@ -25,6 +25,7 @@ 
   $ hg add b
   $ cat .hg/patches/b
   # HG changeset patch
+  # Node ID bcca569474cb9c7069f7b13045564d140d12cf26
   # Parent cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
   # Date 314159265 0