darcs

Issue 1290 darcs diff --index option seems broken

Title darcs diff --index option seems broken
Priority bug Status resolved
Milestone 2.5.0 Resolved in 2.5.0
Superseder Nosy List darcs-devel, dmitry.kurochkin, ertai, gp-ml, kowey, thorkilnaur
Assigned To
Topics UI

Created on 2008-12-28.13:18:45 by gp-ml, last changed 2010-08-15.20:42:10 by kowey.

Messages
msg6922 (view) Author: gp-ml Date: 2008-12-28.13:18:42
* Actions to reproduce:

Given a populated repository:

$ darcs changes
Sun Dec 28 12:28:48 CET 2008  "Gian Piero Carrubba" <gp-ml@rm-rf.it>
  * third record

Sun Dec 28 11:07:20 CET 2008  "Gian Piero Carrubba" <gp-ml@rm-rf.it>
  * second record

Sun Dec 28 11:06:52 CET 2008  "Gian Piero Carrubba" <gp-ml@rm-rf.it>
  * initial record
$ darcs changes -n 1-2
Sun Dec 28 12:28:48 CET 2008  "Gian Piero Carrubba" <gp-ml@rm-rf.it>
  * third record

Sun Dec 28 11:07:20 CET 2008  "Gian Piero Carrubba" <gp-ml@rm-rf.it>
  * second record
$ darcs diff -n 1-2

darcs failed:  Pattern not specified in get_first_match.
$ 

* Expected behaviour:

Output of the content of selected patches (as outlined by darcs changes -n).

* Version:

v2.1.0 from Debian sid repository.

$ darcs -v
2.1.0 (release)
$ dpkg -l darcs
[..]
ii  darcs          2.1.0-1        a distributed, interactive, smart

I can't build the latest version from the darcs.net repository, but the
changelog doesn't tell anything meaningful (to me) about this matter so
I assume the behaviour hasn't been changed in the mean time.

Thanks,
Gian Piero.
msg7000 (view) Author: thorkilnaur Date: 2009-01-06.16:46:28
Thanks a lot for this report. I hope that you have not been seriously bothered by 
this behaviour of darcs.

I have been able to reproduce the behaviour you report with darcs 2.1.2 (release). 
Comparing the output of darcs changes --help and darcs diff --help, I can 
certainly understand the expectation you have, that specifying a range with -n N-M 
(or --index N-M) should produce similar results for the two commands. On the other 
hand, darcs changes specifically deals with a range of patches, whereas darcs diff 
only deals with two specific points in the patch sequence. In any case, inspecting 
the code briefly, these options are not handled in the same way by the code that 
supports the two commands, and as far as I can tell, the problem could very well 
be that darcs diff should not allow the -n (or --index) option at all.

Could a volunteer please take a closer look at this? Initially, we would need a 
decision on what the solution to this problem is: Should we fix darcs diff, 
somehow, so that specifying -n or --index works in a sensible manner; should we 
disallow the use of -n or --index for darcs diff; or something else entirely? I'll 
leave the issue in chatting for discussion.

Thanks and best regards
Thorkil
msg8088 (view) Author: kowey Date: 2009-08-11.14:25:26
So I'm afraid I haven't really thought too deeply about this, but I could be
convinced that this is somehow due to different expected behaviours for the
range matchers (as Thorkil suggests).

It sounds like it should be fairly straightforward to have a notion of range
matching which does what darcs diff wants.

I'd recommend starting with a regression test for this and then looking into the
Darcs.Match module.  You may need to extend Darcs.Arguments as well to have a
different notion of range matching.
msg11044 (view) Author: kowey Date: 2010-05-11.16:17:15
We need somebody to turn this into a formal regression test

See http://wiki.darcs.net/Development/RegressionTests

(probably me... unless somebody else can do it)
msg11974 (view) Author: kowey Date: 2010-08-05.12:44:48
I'll push the test patch shortly.

This is a classic example of why the "two minute action" may be a good
idea (ie. do easy/short tasks immediately if possible); this ticket made
no progress for one year, but the actual test I kept meaning to write
for it really took something like one or two minutes.
msg12158 (view) Author: kowey Date: 2010-08-13.18:18:09
The following patch updated issue issue1290 with status=resolved;resolvedin=2.8.0 HEAD

* Resolve issue1290: support diff --index. 
Ignore-this: 1b663983c67a17f09298c74dc5f2c803

While the matching code knew how to identify the context and
fluff patches matchFirstPatchset and matchSecondPatchset),
it did not actually know how to unapply them (getFirstMatch
and getPartialSecondMatch).
msg12196 (view) Author: kowey Date: 2010-08-15.20:14:09
The following patch updated issue issue1290 with status=resolved;resolvedin=2.5.0 CURRENT

* Resolve issue1290: support diff --index. 
Ignore-this: 1b663983c67a17f09298c74dc5f2c803

While the matching code knew how to identify the context and
fluff patches matchFirstPatchset and matchSecondPatchset),
it did not actually know how to unapply them (getFirstMatch
and getPartialSecondMatch).
msg12202 (view) Author: kowey Date: 2010-08-15.20:41:36
See http://irclog.perlgeek.de/darcs/2010-08-15#i_2706659 (stop at 18:30)
for the justification on putting this in 2.5 (little risk of splash, and
also more pre-releases coming up)
History
Date User Action Args
2008-12-28 13:18:45gp-mlcreate
2009-01-06 16:46:32thorkilnaursetpriority: bug
nosy: kowey, simon, thorkilnaur, dmitry.kurochkin, gp-ml
status: unread -> unknown
messages: + msg7000
2009-08-11 14:25:43koweysetstatus: unknown -> needs-implementation
nosy: kowey, simon, thorkilnaur, dmitry.kurochkin, gp-ml
topic: + UI
messages: + msg8088
2009-08-12 10:42:23koweysetnosy: kowey, simon, thorkilnaur, dmitry.kurochkin, gp-ml
title: darcs diff: -n option seems broken -> darcs diff --index option seems broken
2009-08-12 10:42:43koweysetnosy: + ertai
2009-08-12 10:43:24koweylinkissue1378 superseder
2009-08-25 17:37:23adminsetnosy: + darcs-devel, - simon
2009-08-27 14:23:33adminsetnosy: kowey, darcs-devel, thorkilnaur, ertai, dmitry.kurochkin, gp-ml
2009-10-23 22:35:45adminsetnosy: + gpiero, - gp-ml
2009-10-23 22:40:55adminsetnosy: + nicolas.pouillard, - ertai
2009-10-23 23:53:55adminsetnosy: + gp-ml, - gpiero
2009-10-24 00:05:59adminsetnosy: + ertai, - nicolas.pouillard
2010-05-11 16:17:16koweysetstatus: needs-implementation -> needs-reproduction
assignedto: kowey
topic: + Target-2.5
messages: + msg11044
2010-06-15 20:52:15adminsetmilestone: 2.5.0
2010-06-15 21:00:02adminsettopic: - Target-2.5
2010-08-05 12:44:49koweysetstatus: needs-reproduction -> needs-implementation
assignedto: kowey ->
messages: + msg11974
2010-08-13 18:18:09koweysetstatus: needs-implementation -> resolved
messages: + msg12158
resolvedin: 2.8.0
2010-08-15 20:14:09koweysetmessages: + msg12196
resolvedin: 2.8.0 -> 2.5.0
2010-08-15 20:41:37koweysetstatus: resolved -> unknown
messages: + msg12202
resolvedin: 2.5.0 -> 2.8.0
2010-08-15 20:42:10koweysetstatus: unknown -> resolved
resolvedin: 2.8.0 -> 2.5.0