Page MenuHomePhabricator

`arc land` no longer works with upgraded Mercurial (3.6.1)
Closed, ResolvedPublic

Description

Problem

I upgraded from Mercurial 3.5.2 to 3.6.1 and have noticed that arc land will regularly fail with:

abort: default repository not configured!

arcanist 172c930630a960ea79ada1dbeb50f2ad561d3870 (4 Oct 2015)
libphutil dbf792a053fca78fb55b5ed193bb203c7f9049cb (8 Oct 2015)


Workaround

  1. arc land --hold
  2. hg book -r tip master
    • Note that this makes the assumption that tip will point to the last rebased/squashed change. This was the case in my situation but may not be in yours. Make sure to move the master bookmark to the correct changeset just landed locally to go upstream. Typically this is just moving the master bookmark forward one changeset assuming immutable.history=false.
  3. hg push -r master

Bug Hunt

It looks like the execution of this command causes the failure:

hg push -r 'master' ''

Removing the two quotes at the end fixes this. Here's where the command appears to be created from:
https://secure.phabricator.com/diffusion/ARC/browse/master/src/workflow/ArcanistLandWorkflow.php;e3e232530c6e9393228cdd246ba9f4a48c0f5917$1285

I took a browse through the Mercurial release notes and found these a little suspish:

Not sure whether this would be considered a bug in mercurial or not.


Error Details

arc land
cspeck@host128 ~/S/e/mimjava> arc land arcpatch-D1293
Updating master...
The following commit(s) will be landed:

68cad22aec88 Task #56697 - Backported Task #55772 (D1133), with some minor adjustments.

Switched to bookmark arcpatch-D1293. Identifying and merging...
Landing revision 'D1293: Task #56697 - Backported Task #55772 (D1133), with some minor adjustments.'...
 BUILDS PASSED  Harbormaster builds for the active diff completed successfully.
rebasing 93808:68cad22aec88 "Task #56697 - Backported Task #55772 (D1133), with some minor adjustments." (arcpatch-D1293)
Checking for foot shooting...
Legit-type commit for #56697
saved backup bundle to /Users/cspeck/Source/enad/mimjava/.hg/strip-backup/68cad22aec88-0acbfe9c-backup.hg
rebasing 93809:9d00d6257a10 "Task #56697 - Backported Task #55772 (D1133), with some minor adjustments." (tip arcpatch-D1293)
Checking for foot shooting...
Legit-type commit for #56697
Pushing change...

abort: default repository not configured!
(see the "path" section in "hg help config")
   PUSH FAILED!   
Switched back to bookmark arcpatch-D1293.
Usage Exception: 'hg push' failed! Fix the error and push this change manually.
arc land --trace
cspeck@host128 ~/S/e/mimjava> arc land arcpatch-D1293 --trace
libphutil loaded from '/Users/cspeck/Projects/phacility/libphutil/src'.
arcanist loaded from '/Users/cspeck/Projects/phacility/arcanist/src'.
Config: Reading user configuration file "/Users/cspeck/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/Users/cspeck/Source/enad/mimjava/.arcconfig".
Working Copy: Path "/Users/cspeck/Source/enad/mimjava" is part of `hg` working copy "/Users/cspeck/Source/enad/mimjava".
Working Copy: Project root is at "/Users/cspeck/Source/enad/mimjava".
Config: Did not find local configuration at "/Users/cspeck/Source/enad/mimjava/.hg/arc/config".
>>> [0] <conduit> user.whoami() <bytes = 117>
>>> [1] <http> https://phab.company.com/api/user.whoami
<<< [1] <http> 454,103 us
<<< [0] <conduit> 456,646 us
>>> [2] <exec> $ HGPLAIN=1 hg bookmarks
<<< [2] <exec> 95,399 us
>>> [3] <exec> $ HGPLAIN=1 hg bookmarks
<<< [3] <exec> 97,234 us
>>> [4] <exec> $ HGPLAIN=1 hg bookmarks
<<< [4] <exec> 92,537 us
>>> [5] <exec> $ HGPLAIN=1 hg help rebase
<<< [5] <exec> 104,614 us
>>> [6] <exec> $ HGPLAIN=1 hg status
<<< [6] <exec> 406,822 us
Updating master...
>>> [7] <exec> $ HGPLAIN=1 hg pull
<<< [7] <exec> 931,432 us
>>> [8] <exec> $ HGPLAIN=1 hg branch
<<< [8] <exec> 85,302 us
>>> [9] <exec> $ HGPLAIN=1 hg help phase
<<< [9] <exec> 93,585 us
>>> [10] <exec> $ HGPLAIN=1 hg log -r 'master' --template '{phase}'
<<< [10] <exec> 100,496 us
>>> [11] <exec> $ HGPLAIN=1 hg log -l 1 --template '{node}' -r 'ancestor('\''master'\'','\''arcpatch-D1293'\'')' --
<<< [11] <exec> 111,591 us
>>> [12] <exec> $ HGPLAIN=1 hg log -r 'reverse(('\''a3dea2998c46066a6d9bd7bf991c22d788a9f455'\''::'\''arcpatch-D1293'\'') - '\''a3dea2998c46066a6d9bd7bf991c22d788a9f455'\'')' --template '{node|short} {desc|firstline}\n'
<<< [12] <exec> 110,302 us
The following commit(s) will be landed:

9d00d6257a10 Task #56697 - Backported Task #55772 (D1133), with some minor adjustments.

>>> [13] <exec> $ HGPLAIN=1 hg bookmarks
<<< [13] <exec> 94,175 us
Switched to bookmark arcpatch-D1293. Identifying and merging...
>>> [14] <exec> $ HGPLAIN=1 hg log -l 1 --template '{node}' -r 'ancestor('\''master'\'',.)' --
<<< [14] <exec> 109,110 us
>>> [15] <exec> $ HGPLAIN=1 hg log --template '{node}{desc}' --rev '('\''a3dea2998c46066a6d9bd7bf991c22d788a9f455'\''::. - '\''a3dea2998c46066a6d9bd7bf991c22d788a9f455'\'')' --branch 'default' --
<<< [15] <exec> 112,930 us
>>> [16] <conduit> differential.query() <bytes = 142>
>>> [17] <http> https://phab.company.com/api/differential.query
<<< [17] <http> 452,049 us
<<< [16] <conduit> 452,255 us
>>> [18] <conduit> differential.getcommitmessage() <bytes = 150>
>>> [19] <http> https://phab.company.com/api/differential.getcommitmessage
<<< [19] <http> 222,144 us
<<< [18] <conduit> 222,329 us
Landing revision 'D1293: Task #56697 - Backported Task #55772 (D1133), with some minor adjustments.'...
>>> [20] <conduit> harbormaster.querybuildables() <bytes = 218>
>>> [21] <http> https://phab.company.com/api/harbormaster.querybuildables
<<< [21] <http> 202,702 us
<<< [20] <conduit> 202,893 us
 BUILDS PASSED  Harbormaster builds for the active diff completed successfully.
>>> [22] <exec> $ HGPLAIN=1 hg log -l 1 --template '{node}' -r 'master' --
<<< [22] <exec> 98,390 us
>>> [23] <exec> $ HGPLAIN=1 hg log -l 1 --template '{node}' -r 'ancestor('\''master'\'', '\''arcpatch-D1293'\'')' --
<<< [23] <exec> 107,116 us
>>> [24] <exec> $ HGPLAIN=1 hg log -l 1 --template '{node}' -r 'arcpatch-D1293' --
<<< [24] <exec> 99,346 us
>>> [25] <exec> $ HGPLAIN=1 hg log -l 1 --template '{node}' -r 'first(('\''master'\''::'\''arcpatch-D1293'\'')-'\''master'\'')' --
<<< [25] <exec> 106,430 us
>>> [26] <exec> $ HGPLAIN=1 hg log --template '{node}\n' -r 'roots(descendants('\''9d00d6257a10d6618e554b49d1a43a5769e8ece6'\'')-descendants('\''arcpatch-D1293'\'')-('\''9d00d6257a10d6618e554b49d1a43a5769e8ece6'\''::'\''arcpatch-D1293'\''))'
<<< [26] <exec> 106,381 us
>>> [27] <exec> $ HGPLAIN=1 hg rebase --collapse --keep --logfile '/private/var/folders/kw/22j3hs0j08v7lr6j448pm8lw0000gp/T/9t3v5stozdwkcs0g/94650-kNA3S8' -r '('\''9d00d6257a10d6618e554b49d1a43a5769e8ece6'\''::'\''arcpatch-D1293'\'')' -d 'master'
rebasing 93809:9d00d6257a10 "Task #56697 - Backported Task #55772 (D1133), with some minor adjustments." (tip arcpatch-D1293)
Checking for foot shooting...
Legit-type commit for #56697
<<< [27] <exec> 1,175,219 us
>>> [28] <exec> $ HGPLAIN=1 hg bookmarks
<<< [28] <exec> 96,307 us
>>> [29] <exec> $ HGPLAIN=1 hg bookmark -f 'master'
<<< [29] <exec> 108,289 us
>>> [30] <exec> $ HGPLAIN=1 hg bookmark -f 'arcpatch-D1293' -r '9d00d6257a10d6618e554b49d1a43a5769e8ece6'
<<< [30] <exec> 106,173 us
>>> [31] <exec> $ HGPLAIN=1 hg log -r 'children('\''arcpatch-D1293'\'')' --template '{node}\n'
<<< [31] <exec> 125,097 us
>>> [32] <exec> $ HGPLAIN=1 hg checkout 'master'
<<< [32] <exec> 352,403 us
>>> [33] <event> land.willPushRevision <listeners = 0>
<<< [33] <event> 61 us
Pushing change...

>>> [34] <exec> $ HGPLAIN=1 hg push -r 'master' ''
abort: default repository not configured!
(see the "path" section in "hg help config")
<<< [34] <exec> 89,715 us
   PUSH FAILED!   
>>> [35] <exec> $ HGPLAIN=1 hg --config extensions.mq= strip 'master'
<<< [35] <exec> 764,256 us
>>> [36] <exec> $ HGPLAIN=1 hg checkout 'arcpatch-D1293'
<<< [36] <exec> 545,349 us
Switched back to bookmark arcpatch-D1293.
Usage Exception: 'hg push' failed! Fix the error and push this change manually.

[2015-11-17 21:50:25] EXCEPTION: (ArcanistUsageException) 'hg push' failed! Fix the error and push this change manually. at [<arcanist>/src/workflow/ArcanistLandWorkflow.php:1083]
arcanist(head=master, ref.master=172c930630a9), phutil(head=master, ref.master=dbf792a053fc)
  #0 ArcanistLandWorkflow::push() called at [<arcanist>/src/workflow/ArcanistLandWorkflow.php:224]
  #1 ArcanistLandWorkflow::run() called at [<arcanist>/scripts/arcanist.php:382]

Event Timeline

cspeckmim updated the task description. (Show Details)
cspeckmim added projects: Mercurial, Arcanist.
cspeckmim added a subscriber: cspeckmim.

We should be able to just omit the final argument if remote is not specified. We can refine that later, but our usage seems like it's in the wrong to me.

If you want to test that something in this vein works, I'm happy to bring it upstream.

diff --git a/src/workflow/ArcanistLandWorkflow.php b/src/workflow/ArcanistLandWorkflow.php
index 4525eeb..23b0b7b 100644
--- a/src/workflow/ArcanistLandWorkflow.php
+++ b/src/workflow/ArcanistLandWorkflow.php
@@ -1282,10 +1282,16 @@ EOTEXT
         $err = $repository_api->execPassthru('push %s', $this->remote);
         $cmd = 'hg push';
       } else if ($this->isHg) {
-        $err = $repository_api->execPassthru(
-          'push -r %s %s',
-          $this->onto,
-          $this->remote);
+        if (strlen($this->remote)) {
+          $err = $repository_api->execPassthru(
+            'push -r %s %s',
+            $this->onto,
+            $this->remote);
+        } else {
+          $err = $repository_api->execPassthru(
+            'push -r %s',
+            $this->onto);
+        }
         $cmd = 'hg push';
       }

Wow thank you - I was planning to look at this probably sometime this weekend (with pretty much the change you pasted). I'll edit the task description to provide a workaround if anyone else runs into this.

If you want to test that something in this vein works, I'm happy to bring it upstream.

The patch works perfectly!

epriestley triaged this task as Normal priority.Nov 21 2015, 5:31 PM

That's the patch from earlier, yell if you spot any issues with it.

Just tested this on rHGTEST, it's working. Thanks for grabbing this so quick.

Awesome, thanks for the report!