8bf61a5a1fc6 — Kyle Lippincott 8 years ago
tweakdefaults: support pull --rebase -d <dest> without remotenames
2 files changed, 41 insertions(+), 1 deletions(-)

M tests/test-tweakdefaults.t
M tweakdefaults.py
M tests/test-tweakdefaults.t +38 -0
@@ 417,3 417,41 @@ Test reuse message flag by taking messag
   HG: bookmark 'hyphen-book'
   HG: changed afile
 
+Test non-remotenames use of pull --rebase and --update requires --dest
+  $ cd $TESTTMP
+  $ hg clone repo clone
+  updating to branch default
+  9 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd clone
+  $ hg pull --rebase
+  abort: you must use a bookmark with tracking or manually specify a destination for the rebase
+  (set up tracking with `hg book <name> -t <destination>` or manually supply --dest / -d)
+  [255]
+  $ hg pull --update
+  abort: you must specify a destination for the update
+  (use `hg pull --update --dest <destination>`)
+  [255]
+  $ echo foo > foo
+  $ hg commit -Am 'foo'
+  adding foo
+  $ hg pull --rebase -d default
+  pulling from $TESTTMP/repo (glob)
+  searching for changes
+  no changes found
+  nothing to rebase - working directory parent is also destination
+  $ hg pull --update -d default
+  pulling from $TESTTMP/repo (glob)
+  searching for changes
+  no changes found
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg pull --rebase --config tweakdefaults.defaultdest=default
+  pulling from $TESTTMP/repo (glob)
+  searching for changes
+  no changes found
+  nothing to rebase - working directory parent is also destination
+  $ hg pull --update --config tweakdefaults.defaultdest=default
+  pulling from $TESTTMP/repo (glob)
+  searching for changes
+  no changes found
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd $TESTTMP/repo

          
M tweakdefaults.py +3 -1
@@ 142,7 142,9 @@ def pull(orig, ui, repo, *args, **opts):
     rebase = opts.get('rebase')
     update = opts.get('update')
     isrebase = rebase or rebaseflag
-    if isrebase:
+    # Only use from the global rebasedest if _getrebasedest was called.  If the
+    # user isn't using remotenames, then rebasedest isn't set.
+    if rebaseflag:
         dest = rebasedest
     else:
         dest = opts.get('dest')