Issue 2647 "Failed to commute common patches" after replacing a patch with its duplicate, then pulling in the original

Title "Failed to commute common patches" after replacing a patch with its duplicate, then pulling in the original
Priority Status duplicate
Milestone Resolved in
Superseder Nosy List falsifian
Assigned To

Created on 2020-07-01.16:28:48 by falsifian, last changed 2020-07-01.17:36:09 by bfrk.

msg22123 (view) Author: falsifian Date: 2020-07-01.16:28:43
1. Summarise the issue (what were doing, what went wrong?)

I get a "Failed to commute common patches" error when I do the following.

* Create two patches. P: create file "f", Q: add text to "f".
* In a new repo, make a new patch R: create file "f". (In the error message below, this patch is "version B".)
* Pull patches P and Q into the new repo.
* Obliterate P in the new repo. (Originally, Q depended on P, but darcs seems happy to let me obliterate P, maybe because R does the same thing.
* Pull P again from the old repo to the new.

At this point, I see:

james angel ~/tmp/B $ darcs pull ../A
HINT: if you want to change the default remote repository to
      quit now and issue the same command with the --set-default flag.
darcs: This is a bug! Please report it at http://darcs.net
Failed to commute common patches:
patch d469bc34b05d89c04ad260037ad559b1daafd667
Author: jcook@cs.berkeley.edu
Date:   Wed Jul  1 16:22:53 UTC 2020
  * Add stuff to f.
patch 1e4f99523033230bf343c8d6a0f5502304423c4c
Author: jcook@cs.berkeley.edu
Date:   Wed Jul  1 16:23:17 UTC 2020
  * Add f (version B).
CallStack (from HasCallStack):
  error, called at src/Darcs/Prelude.hs:71:11 in darcs-2.14.2-FwKSYNegFf78c2JxGuvUka:Darcs.Prelude

As shell commands (I could probably make this non-interactive if it helps). I added some comments about minimal contexts because there's a thread about those on darcs-users that I plan to reply to using this as an example.

mkdir A; cd A
darcs init
touch f; darcs add f
darcs record -am "Add f (version A)."
echo "stuff" > f
darcs record -am "Add stuff to f."
# The minimal context of "Add stuff to f." is one patch, "Add f (version A)"

cd ..; mkdir B; cd B
darcs init
touch f; darcs add f
darcs record -am "Add f (version B)."
darcs pull ../A
# Choose all patches. (Darcs won't let me just choose "Add stuff to f." without "Add f (version A)." at this point.)
# (At this point, I don't think "Add stuff to f." has a well-defined minimal context, based on what comes next.)
darcs obliterate
# Choose just "Add f (version A)."
# Now, the minimal context of "Add stuff to f." is "Add f (version B)"
darcs pull ../A
# This is where the error message appears.

2. What behaviour were you expecting instead?

I didn't have any particular expectation, other than darcs not crashing. This was an experiment to understand whether darcs lets me replace a depended-on patch with its duplicate.

Based on an ongoing discussion in darcs-users, I suspect darcs shouldn't have let me obliterate the patch "Add f (version A)".

3. What darcs version are you using? (Try: darcs --exact-version)

darcs compiled on Jan 26 2019, at 14:14:51

Weak Hash: not available


[TAG 2.14.2
Ganesh Sittampalam <ganesh@earth.li>**20190126112346
 Ignore-this: 5c94e042fbcfdf311008d6e980d9cf1d

4. What operating system are you running?

Linux (NixOS 20.04)
msg22124 (view) Author: bfrk Date: 2020-07-01.17:36:07
It is a known bug present in darcs-1 and darcs-2 format.See e.g. 
issue1327 and many others.
Date User Action Args
2020-07-01 16:28:48falsifiancreate
2020-07-01 17:36:09bfrksetstatus: unknown -> duplicate
messages: + msg22124