Search code examples
darcs

In Darcs, view diff between two patches


In Git, I can view the diff between two commits by running something like:

$ git diff c23a45 ffd644

How do I do this in Darcs?

Following section 5.10.1 of the user manual I have tried:

$ darcs diff --from-patch ffd644 --to-patch c23a45

but this gives the error:

darcs: Couldn't find patch matching "patch-name ffd644"
CallStack (from HasCallStack):
  error, called at src/Darcs/Patch/Match.hs:654:43 in darcs-2.12.4-EYDQyfVEyiPHocMCwLEEKg:Darcs.Patch.Match

I get a similar error when using the full patch hash.


Solution

  • To refer to patches by their hashes, use --from-hash and --to-hash:

    darcs diff --from-hash ffd644 --to-hash c23a45
    

    You can also use the more verbose match syntax:

    darcs diff --from-match 'hash ffd644' --to-match 'hash c23a45'
    

    Note that this is an inclusive selection: you'll see a diff that includes all the patches between and including the two you specify.

    The set of patches included will also depend on the order the patches currently are in your repository. If you reorder the patches, e.g. with darcs optimize reorder or by pulling them into a different repository, then you might see a different diff.