Patchwork [2,of,2] rebase: preserve metadata from grafts of changes (issue4001)

login
register
mail settings
Submitter Augie Fackler
Date Oct. 1, 2013, 7:07 p.m.
Message ID <50a3ac7544ed119ad6d6.1380654429@augie-macbookair>
Download mbox | patch
Permalink /patch/2688/
State Accepted
Commit a69a77a80900eabe1257c935818d0910217e9702
Headers show

Comments

Augie Fackler - Oct. 1, 2013, 7:07 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1380653333 14400
#      Tue Oct 01 14:48:53 2013 -0400
# Node ID 50a3ac7544ed119ad6d63ccf9a93bb6d59cfbf5d
# Parent  d094382a3938b5eea8397780e73e2a12f0c074ea
rebase: preserve metadata from grafts of changes (issue4001)
Matt Mackall - Oct. 2, 2013, 12:43 a.m.
On Tue, 2013-10-01 at 15:07 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <raf@durin42.com>
> # Date 1380653333 14400
> #      Tue Oct 01 14:48:53 2013 -0400
> # Node ID 50a3ac7544ed119ad6d63ccf9a93bb6d59cfbf5d
> # Parent  d094382a3938b5eea8397780e73e2a12f0c074ea
> rebase: preserve metadata from grafts of changes (issue4001)

These are queued for default, thanks.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -29,6 +29,11 @@ 
 command = cmdutil.command(cmdtable)
 testedwith = 'internal'
 
+def _savegraft(ctx, extra):
+    s = ctx.extra().get('source', None)
+    if s is not None:
+        extra['source'] = s
+
 def _savebranch(ctx, extra):
     extra['branch'] = ctx.branch()
 
@@ -151,7 +156,7 @@ 
         collapsef = opts.get('collapse', False)
         collapsemsg = cmdutil.logmessage(ui, opts)
         e = opts.get('extrafn') # internal, used by e.g. hgsubversion
-        extrafns = []
+        extrafns = [_savegraft]
         if e:
             extrafns = [e]
         keepf = opts.get('keep', False)
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -178,9 +178,9 @@ 
   42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {'date': '*', 'user': 'test'} (glob)
   5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 {'date': '*', 'user': 'test'} (glob)
   32af7686d403cf45b5d95f2d70cebea587ac806a 0 {'date': '*', 'user': 'test'} (glob)
-  08483444fef91d6224f6655ee586a65d263ad34c cbc07f26687521cecfc9a141bf5ecfc0fd2b8531 0 {'date': '* *', 'user': 'test'} (glob)
+  08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 {'date': '* *', 'user': 'test'} (glob)
   $ hg log -G
-  @  11:cbc07f266875 D
+  @  11:4596109a6a43 D
   |
   | o  10:5ae4c968c6ac C
   | |
@@ -203,17 +203,17 @@ 
   42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {'date': '* *', 'user': 'test'} (glob)
   5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 {'date': '* *', 'user': 'test'} (glob)
   32af7686d403cf45b5d95f2d70cebea587ac806a 0 {'date': '* *', 'user': 'test'} (glob)
-  08483444fef91d6224f6655ee586a65d263ad34c cbc07f26687521cecfc9a141bf5ecfc0fd2b8531 0 {'date': '* *', 'user': 'test'} (glob)
-  8877864f1edb05d0e07dc4ba77b67a80a7b86672 b1861c79d66ec3aa1b607ac3c9fb819e38b12238 0 {'date': '* *', 'user': 'test'} (glob)
+  08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 {'date': '* *', 'user': 'test'} (glob)
+  8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 {'date': '* *', 'user': 'test'} (glob)
   08483444fef91d6224f6655ee586a65d263ad34c 0 {'date': '* *', 'user': 'test'} (glob)
-  5ae4c968c6aca831df823664e706c9d4aa34473d dd4be135457a404ce5541de427ae1d98a28f4acd 0 {'date': '* *', 'user': 'test'} (glob)
+  5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 {'date': '* *', 'user': 'test'} (glob)
   $ hg log --rev 'divergent()'
   $ hg log -G
-  @  13:dd4be135457a C
+  @  13:98f6af4ee953 C
   |
-  o  12:b1861c79d66e B
+  o  12:462a34d07e59 B
   |
-  o  11:cbc07f266875 D
+  o  11:4596109a6a43 D
   |
   o  7:02de42196ebe H
   |
@@ -225,7 +225,22 @@ 
   |/
   o  0:cd010b8cd998 A
   
-
+  $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
+  changeset:   11:4596109a6a4328c398bde3a4a3b6737cfade3003
+  phase:       draft
+  parent:      7:02de42196ebee42ef284b6780a87cdc96e8eaab6
+  parent:      -1:0000000000000000000000000000000000000000
+  manifest:    11:a91006e3a02f1edf631f7018e6e5684cf27dd905
+  user:        Nicolas Dumazet <nicdumz.commits@gmail.com>
+  date:        Sat Apr 30 15:24:48 2011 +0200
+  files+:      D
+  extra:       branch=default
+  extra:       rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
+  extra:       source=32af7686d403cf45b5d95f2d70cebea587ac806a
+  description:
+  D
+  
+  
   $ cd ..
 
 collapse rebase