Patchwork [v2] repair: setup hookargs when processing bundle2s

login
register
mail settings
Submitter Eric Sumner
Date Feb. 20, 2015, 10:07 p.m.
Message ID <05c41109ab939ce6b5f0.1424470071@dev911.prn1.facebook.com>
Download mbox | patch
Permalink /patch/7816/
State Accepted
Headers show

Comments

Eric Sumner - Feb. 20, 2015, 10:07 p.m.
# HG changeset patch
# User Eric Sumner <ericsumner@fb.com>
# Date 1424469301 28800
#      Fri Feb 20 13:55:01 2015 -0800
# Node ID 05c41109ab939ce6b5f09660ce0c1605af82aacb
# Parent  ff5caa8dfd993680d9602ca6ebb14da9de10d5f4
repair: setup hookargs when processing bundle2s

addchangegroup() modifies its behavior based on the transaction source.
This is incorrect for bundle2 repair files, causing rebases to abort when this
option is enabled.

This diff specifies the source type in the way recommended by comments in
bundle2.py and adds a test to ensure that rebases with the experimental option
work successfully.
Pierre-Yves David - March 2, 2015, 8:45 p.m.
On 02/20/2015 10:07 PM, Eric Sumner wrote:
> # HG changeset patch
> # User Eric Sumner <ericsumner@fb.com>
> # Date 1424469301 28800
> #      Fri Feb 20 13:55:01 2015 -0800
> # Node ID 05c41109ab939ce6b5f09660ce0c1605af82aacb
> # Parent  ff5caa8dfd993680d9602ca6ebb14da9de10d5f4
> repair: setup hookargs when processing bundle2s

Pushed to the clowncopter, thanks.

Patch

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -181,6 +181,8 @@ 
                 repo.ui.pushbuffer()
             if isinstance(gen, bundle2.unbundle20):
                 tr = repo.transaction('strip')
+                tr.hookargs = {'source': 'strip',
+                               'url': 'bundle:' + vfs.join(chgrpfile)}
                 try:
                     bundle2.processbundle(repo, gen, lambda: tr)
                     tr.close()
diff --git a/tests/test-rebase-pull.t b/tests/test-rebase-pull.t
--- a/tests/test-rebase-pull.t
+++ b/tests/test-rebase-pull.t
@@ -165,5 +165,47 @@ 
   |
   o  0: 'C1'
   
+pull --rebase works with bundle2 turned on
 
-
+  $ cd ../a
+  $ echo R4 > R4
+  $ hg ci -Am R4
+  adding R4
+  $ hg tglog
+  @  5: 'R4'
+  |
+  o  4: 'R3'
+  |
+  o  3: 'R2'
+  |
+  o  2: 'R1'
+  |
+  o  1: 'C2'
+  |
+  o  0: 'C1'
+  
+  $ cd ../c
+  $ hg pull --rebase --config experimental.bundle2-exp=True --config experimental.strip-bundle2-version=02
+  pulling from $TESTTMP/a (glob)
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  rebasing 5:518d153c0ba3 "L1"
+  saved backup bundle to $TESTTMP/c/.hg/strip-backup/518d153c0ba3-73407f14-backup.hg (glob)
+  $ hg tglog
+  @  6: 'L1'
+  |
+  o  5: 'R4'
+  |
+  o  4: 'R3'
+  |
+  o  3: 'R2'
+  |
+  o  2: 'R1'
+  |
+  o  1: 'C2'
+  |
+  o  0: 'C1'
+