[darcs-users] Conflicts and Darcs messages don't help much

Jean-Louis Leroy jll at soundobjectlogic.com
Fri Mar 3 11:56:25 UTC 2006


Hello,

here's my situation. I have two repositories:

  [jll at boby ~]$ cd conflicts/
  [jll at boby conflicts]$ ll
  total 28436
  drwxrwx---  11 jll dev     4096 Mar  3 11:19 t3.conflicts
  drwxr-xr-x  11 jll dev     4096 Mar  3 11:20 t3.xml

t3.xml was cloned from t3.conflicts. Some worked occured in both
repositories. Actually t3.conflicts is the central repository, it
received patches from here and there. I have made changes in t3.xml
and I want to send them to the central repository.

First I check that everything is recorded:


  [jll at boby conflicts]$ cd t3.xml
  [jll at boby t3.xml]$ darcs whatsnew
  No changes!

Following a habit I took with BitKeeper I first pull from the central
repository:

  [jll at boby t3.xml]$ darcs pull
  Pulling from "../t3.conflicts"...
  
  Thu Feb 23 21:16:19 UTC 2006  jacques.lauzeral at soundobjectlogic.com
    * doc: xml tool documentation + java examples same as perl examples
  Shall I pull this patch? (1/27) [ynWvpxqadjk], or ? for help: a
  
  Finished pulling and applying.

Now I tru to push:

  [jll at boby t3.xml]$ darcs push
  Pushing to ../t3.conflicts...
  
  Wed Mar  1 16:48:31 UTC 2006  jll at soundobjectlogic.com
    * perl+xml: sync with java
  Shall I push this patch? (1/1) [ynWvpxqadjk], or ? for help: y
  
  
  darcs failed:  Refusing to apply patches leading to conflicts.
  If you would rather apply the patch and mark the conflicts,
  use the --mark-conflicts option to apply.
  There are conflicts in the following files:
  ./perl/Tangram-XML/lib/Tangram/XML/Storage/Flat.pm
  
Let's do as Darcs suggests then:

  [jll at boby t3.xml]$ darcs push  --mark-conflicts
  
  darcs failed:  unrecognized option `--mark-conflicts'
  
Okay, I see that in general it's not a good idea to mark conflicts in
the repository one pushes to so I'll do it from the other side
although it'sstarting to feel a bit unnatural:

  [jll at boby t3.xml]$ cd ../t3.conflicts/
  [jll at boby t3.conflicts]$ darcs pull ../t3.xml/
  
  Wed Mar  1 16:48:31 UTC 2006  jll at soundobjectlogic.com
    * perl+xml: sync with java
  Shall I pull this patch? (1/1) [ynWvpxqadjk], or ? for help: y
  
  We have conflicts in the following files:
  ./perl/Tangram-XML/lib/Tangram/XML/Storage/Flat.pm
  Error applying patch to recorded!
  The patch was:
  {
  [perl+xml: sync with java
  jll at soundobjectlogic.com**20060301164831] {
  hunk ./perl/Tangram-XML/lib/Tangram/XML.pm 229
  -      $tag =~ s/::/:/g;
  +      $tag =~ s/::/-/g;
  hunk ./perl/Tangram-XML/lib/Tangram/XML/Storage/Flat.pm 80
  +sub user_type_tag ($) {
  +  my $name = shift;
  +  $name =~ s/::/-/g;
  +  $name
  +}
  +
  hunk ./perl/Tangram-XML/lib/Tangram/XML/Storage/Flat.pm 110
  -  $writer->xmlDecl('US-ASCII');
  +  my $root_tag = user_type_tag ref $self;
  +
  +  $writer->xmlDecl('utf-8');
  hunk ./perl/Tangram-XML/lib/Tangram/XML/Storage/Flat.pm 114
  -  $writer->startTag($self->{TAG}, class => "$self->{TAG}", storage => "$xml_class", @schema_attr);
  +  $writer->startTag($root_tag);
  hunk ./perl/Tangram-XML/lib/Tangram/XML/Storage/Flat.pm 123
  -  $writer->endTag($self->{TAG});
  +  $writer->endTag($root_tag);
  }
  }

At least I see what's going on - or at least what the conflicts are
but not the patches that led to the conflict.

So let's try that option again:

  [jll at boby t3.conflicts]$ darcs pull ../t3.xml/ --mark-conflicts
  
  darcs failed:  unrecognized option `--mark-conflicts'
  
Okay, this is a replay of the story that is a bit longer but I'll
shorten it a bit: realizing that it's 'darcs apply' that has a
--mark-conflicts option I used 'darcs send' to create a patch bundle
and tried to apply it with --mark-conflicts. I don't remember the
details but this approach failed too. I guess I could reproduce it
though. I ended up taking a backup of the central repository and
replacing it with my t3.xml work repository.

I think that Darcs can be improved a lot here. As I understand the
manual on conflicts, there is an important bit of information that's
missing from Darcs' error messages: the patch dependency tree that led
to the conflict. And the messages you do get are wrong.

I was expecting to solve the problem by creating a new patch in my
work repository then pushing it. That was the reason for the initial
pull. But perhaps there's something I misunderstood?

The two repositories - as they were before I typed all the commands
above - are available here
http://jimi.soundobjectlogic.com/darcs/conflicts.tgz.
-- 
Jean-Louis Leroy
Sound Object Logic
http://www.soundobjectlogic.com




More information about the darcs-users mailing list