Arc patch --diff doesn't apply on the latest changes of the branch

arc patch --diff takes the base commit from the users workspace and applies the patch rather than on the latest changes. Is there a way I can apply the patch on the latest changes of the repo.
steps I follow…

  1. clone a mercurial repo-- latest change is the tip
  2. arc patch --diff phid

Requirement: I just need to get the diff file from the phid and apply that patch on the latest changeset from step 1

Try --nobranch.

Thanks Evan, but I need to apply the patch on the latest changes of a particular branch (ex: when I clone a repo my branch is XXX and the patch comes from is also XXX branch) then the patch needs to be applied on the latest changes of XXX branch.

My expectation is that --nobranch will do exactly that. Did you actually try it? If so, what did it do differently?

arc patch --nobranch DXXXX
Updating to the revision’s base commit
10 files updated, 0 files merged, 0 files removed, 0 files unresolved
Created and checked out bookmark arcpatch-DXXXX.
OKAY Successfully committed patch.

It is saying it is updating to revision’s base commit

in the hg log it can’t even see if the patch got applied

I can’t reproduce this. I created a “quack” commit:

epriestley@orbital ~/scratch/mercurial-test $ echo quack > quack.txt
epriestley@orbital ~/scratch/mercurial-test $ hg add quack.txt 
epriestley@orbital ~/scratch/mercurial-test $ hg commit -m quack

I created a diff from it:

epriestley@orbital ~/scratch/mercurial-test $ arc diff --only
...
Created a new Differential diff:
        Diff URI: http://local.phacility.com/differential/diff/349/

Included changes:
  A       quack.txt

I updated to the commit before the “quack” commit, then put a new “moo” commit on the branch:

epriestley@orbital ~/scratch/mercurial-test $ hg up tip^
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
epriestley@orbital ~/scratch/mercurial-test $ echo moo > moo.txt
epriestley@orbital ~/scratch/mercurial-test $ hg add moo.txt 
epriestley@orbital ~/scratch/mercurial-test $ hg commit -m moo
created new head

I applied the diff with arc patch --nobranch ...:

epriestley@orbital ~/scratch/mercurial-test $ arc patch --nobranch --diff 349
Updating to the revision's base commit
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
Created and checked out bookmark arcpatch.
 OKAY  Successfully committed patch.

My working copy state now has both commits and both files:

epriestley@orbital ~/scratch/mercurial-test $ ls -1
moo.txt
quack.txt
test.txt
epriestley@orbital ~/scratch/mercurial-test $ hg log
changeset:   12:60ab2ca568e8
tag:         tip
user:        Evan Priestley <hg@epriestley.com>
date:        Mon May 04 15:11:37 2020 -0700
summary:     quack quack

changeset:   11:622d1fd9d8a3
parent:      7:aaefbe96a5bb
user:        Evan Priestley <hg@epriestley.com>
date:        Mon May 04 15:11:29 2020 -0700
summary:     moo

Thanks Evan for the detailed explanation. I will try and see if it solves my problem.

Thanks a lot Evan, --nobranch is working as expected, but for the scenario of “Depends On DXXX” I don’t see it is picking the changes from the dependent review id

@epriestley It is working for dependent reviews as well. Thanks a lot!