Page MenuHomePhabricator

Using `arc patch` will leave behind a bookmark when answering 'No' in attempt to apply to current state in Mercurial repository
Open, Needs TriagePublic

Description

I sometimes use arc patch for moving my work between machines. When switching to a machine I will make sure to strip away the old patch before applying it fresh. When this happens, arcanist will warn that it's trying to apply the patch on a changeset that isn't in the working copy, and whether I should apply anyways or not. If I answer "no", arcanist properly stops however it leaves behind a bookmark it created in anticipation of saying "yes".

Here's some console output when it happens. To start, I have one outgoing changeset (aaaaa, bookmarked "carryover" at thet tip), and latest public changeset is (bbbbbb bookmarked "master"). I attempted to apply the patch for D5507 then realized I wasn't currently on master, then tried again.

cspeck@machine ~/S/project> hg wip
@   105388:aaaaaaaaaaaa cspeck (21 seconds ago) tip carryover
|     Task #12345 - Change the logic for carrying over
o   105387:bbbbbbbbbbbb cspeck (9 days ago) master
|     Task #12345 - Fixing usability issues
~
cspeck@machine ~/S/project> arc patch D5507
Created and checked out bookmark arcpatch-D5507.


    This diff is against commit ccccccccccccccccccccccccccccccccccc, but
    the commit is nowhere in the working copy. Try to apply it against the
    current working copy state? (.) [Y/n] n

Usage Exception: User aborted the workflow.
cspeck@machine ~/S/project> hg up master
5 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark master)
cspeck@machine ~/S/project> arc patch D5507
Bookmark name arcpatch-D5507 already exists; trying a new name.
Created and checked out bookmark arcpatch-D5507-1.


    This diff is against commit ccccccccccccccccccccccccccccccccccc, but
    the commit is nowhere in the working copy. Try to apply it against the
    current working copy state? (.) [Y/n] n

Usage Exception: User aborted the workflow.
cspeck@machine ~/S/project> hg book
   arcpatch-D5507            105388:aaaaaaaaaaaa
 * arcpatch-D5507-1          105387:bbbbbbbbbbbb
   carryover                 105388:aaaaaaaaaaaa
   master                    105387:bbbbbbbbbbbb
Steps for Reproducing
  1. Repository copy A
    1. create a new commit.
    2. create an even newer commit on top of the new commit.
    3. use arc diff to create a revision for only the newer commit (not both commits).
  2. Repository copy B
    1. attempt to arc patch the revision
    2. when prompted about the patch being against a commit not in the working copy and whether to attempt applying it against the working copy, select "n" for "no".
    3. observe that arc patch left behind a bookmark in preparation for the patch

Arcanist version:
arcanist 3b6b523c2b236e3724a1e115f126cb6fd05fa128 (18 Feb 2017)
libphutil 13a200ca7621ab2b48a0c395f52f8c4411bbc686 (4 Mar 2017)