It looks like arc land throws an exception when rebasing with conflicts or squashing commits that were rebased and contained conflicts (which continues to think there are conflicts... but I haven't discovered why). The resulting state of the repository is quite confusing and contains uncommitted changes.
cspeckrun@specktop ~/P/n/hgtest> arc version arcanist 1773aad8559965f8896cd66087710ddbeee153ae (10 Oct 2015) libphutil c5a7d67db29431dc67f930473f967c46477a7ad7 (10 Oct 2015)
- With Mercurial repository create new branch off of non-head -- also ensure the repository has "history.immutable" : "false"
- Create several commits, with conflicting changes -- I believe this is key: there must be multiple commits not amended/squashed and there must be a conflict to disallow a clean rebase
cspeckrun@specktop ~/P/n/hgtest> hg wip @ 41:2c012896d487 cspeck (3 seconds ago) tip test | addfile o 40:1fd75fc107c0 cspeck (53 seconds ago) | more mods o 39:82bbd834fa66 cspeck (4 minutes ago) | creating a branch o 38:efb1653d421c cspeck (8 minutes ago) <--- modifies 'readme' causing conflicts | modifying readme for COLLISIONS o 37:c1a6ee8a65cf cspeck (9 minutes ago) | creating a branch | o 36:d721d5b57fc9 cspeck (21 hours ago) master <--- there are actually 15 commits between 'master' and revision 20 where the branch is rooted. within these commits have changes to the 'readme' |/ more test data o 20:136bb8213584 cspeck (8 days ago) | test hg.....
- Attempting to land fails due to conflict, manually rebase and resolve conflicts
- Run arc diff to update the revision after rebasing and resolving conflicts:
cspeckrun@specktop ~/P/n/hgtest> arc diff Linting... No lint engine configured for this project. Running unit tests... No unit test engine is configured for this project. SKIP STAGING Phabricator does not support staging areas for this repository. Updated an existing Differential revision: Revision URI: http://192.168.0.133/D1 Included changes: A .arcconfig M README A newfile A supernewfile cspeckrun@specktop ~/P/n/hgtest> hg wip @ 41:945ead78d871 cspeck (3 minutes ago) tip test | addfile o 40:364c8f96f85c cspeck (4 minutes ago) | more mods o 39:35f26c87dd0f cspeck (7 minutes ago) | creating a branch o 38:2ae07ac41111 cspeck (11 minutes ago) | modifying readme for COLLISIONS o 37:16a239549c36 cspeck (12 minutes ago) | creating a branch o 36:d721d5b57fc9 cspeck (21 hours ago) master | more test data
- Run arc land then get placed in an unusual state
cspeckrun@specktop ~/P/n/hgtest> arc land test Updating master... The following commit(s) will be landed: 945ead78d871 addfile 364c8f96f85c more mods 35f26c87dd0f creating a branch 2ae07ac41111 modifying readme for COLLISIONS 16a239549c36 creating a branch Switched to bookmark test. Identifying and merging... Revision 'D1: creating a branch' has not been accepted. Continue anyway? [y/N] y Landing revision 'D1: creating a branch'... BUILDS PASSED Harbormaster builds for the active diff completed successfully. rebasing 37:16a239549c36 "creating a branch" note: rebase of 37:16a239549c36 created no changes to commit rebasing 38:2ae07ac41111 "modifying readme for COLLISIONS" note: rebase of 38:2ae07ac41111 created no changes to commit rebasing 39:35f26c87dd0f "creating a branch" note: rebase of 39:35f26c87dd0f created no changes to commit rebasing 40:364c8f96f85c "more mods" unresolved conflicts (see hg resolve, then hg rebase --continue) Exception Command failed with error #255! COMMAND HGPLAIN=1 hg checkout 'test' STDOUT (empty) STDERR abort: outstanding uncommitted merge (Run with `--trace` for a full exception trace.)
- At this point the repository ends up in an unclean state. Sometimes it appears as though my working set is at two different revisions. I think Mercurial is in the middle of a merge due to the squash because hg summary indicates:
cspeckrun@specktop ~/P/n/hgtest> hg summ parent: 36:d721d5b57fc9 more test data parent: 40:364c8f96f85c more mods branch: default bookmarks: [test] master commit: 1 modified, 2 added, 1 unresolved (merge) update: 1 new changesets (update) phases: 5 draft
Looking at ArcanistLandWorkflow and doing some investigation into the commands, I think this is what happens:
- Squash is performed by using hg rebase --collapse - [[ https://secure.phabricator.com/diffusion/ARC/browse/master/src/workflow/ArcanistLandWorkflow.php;172c930630a960ea79ada1dbeb50f2ad561d3870$840 | L840 ]]
- The squash fails so an attempt to abort is made by doing hg rebase --abort - [[ https://secure.phabricator.com/diffusion/ARC/browse/master/src/workflow/ArcanistLandWorkflow.php;172c930630a960ea79ada1dbeb50f2ad561d3870$840 | L847 ]]
- The abort does not clear out the working state, leaving uncommitted files
- Attempting to switch back to the bookmark using hg checkout results in failure/exception due to uncommitted changes [[ https://secure.phabricator.com/diffusion/ARC/browse/master/src/workflow/ArcanistLandWorkflow.php;172c930630a960ea79ada1dbeb50f2ad561d3870$1220 | L1220 ]]
Adding --clean to the checkout command fixes this:
-C --clean discard uncommitted changes (no backup)
However it looks like there's some reliability on the checkout command being cross-VCS-compatible.
I have in my .hgrc my merge behavior set to merge=internal:fail which I believe is why I'm seeing the squash fail. When I remove this option the squash succeeds, although it does indicate that one of the rebased commits requires a merge. I'm guessing this is required as part of internal Mercurial for doing the squash, it essentially has to re-apply the change back on to master and resolve conflicts even though it was a descendant to begin with.