changeset 1902:93cf0ddb5234

destination: fix 'hg pull --rebase' I'm not sure why sometime functions do not have func_default but this is easy to fix. I've added a test to catch such stuffs it in the future.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 16 Mar 2016 12:14:20 -0700
parents 85390446f8c1
children 58cdf061d49a
files hgext3rd/topic/destination.py tests/test-topic-dest.t
diffstat 2 files changed, 47 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/destination.py	Thu Mar 17 09:12:18 2016 -0700
+++ b/hgext3rd/topic/destination.py	Wed Mar 16 12:14:20 2016 -0700
@@ -38,7 +38,7 @@
                               % (top, len(heads)))
         else:
             assert False # that's impossible
-    if orig.func_default: # version above hg-3.7
+    if getattr(orig, 'func_default', ()): # version above hg-3.7
         return orig(repo, action, sourceset, onheadcheck)
     else:
         return orig(repo)
--- a/tests/test-topic-dest.t	Thu Mar 17 09:12:18 2016 -0700
+++ b/tests/test-topic-dest.t	Wed Mar 16 12:14:20 2016 -0700
@@ -7,6 +7,8 @@
   > rebase=
   > [phases]
   > publish=false
+  > EOF
+  $ cat <<EOF >> $HGRCPATH
   > [ui]
   > logtemplate = '{rev} ({topics}) {desc}\n'
   > EOF
@@ -256,6 +258,50 @@
   o  0 () c_alpha
   
 
+
+Check pull --rebase
+-------------------
+
+(we broke it a some point)
+
+  $ cd ..
+  $ hg clone jungle other --rev '2'
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 3 files
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd other
+  $ echo other > other
+  $ hg add other
+  $ hg ci -m 'c_other'
+  $ hg pull -r default --rebase
+  pulling from $TESTTMP/jungle
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 3 files (+1 heads)
+  rebasing 3:dbc48dd9e743 "c_other"
+  $ hg log -G
+  @  7 () c_other
+  |
+  o  6 () c_zeta
+  |
+  o  5 () c_epsilon
+  |
+  o  4 () c_delta
+  |
+  o  2 () c_gamma
+  |
+  o  1 () c_beta
+  |
+  o  0 () c_alpha
+  
+  $ cd ../jungle
+
+
 Default destination for update
 ===============================