darcs

Issue 966 tag/diff => no results (2.0.2+107)

Title tag/diff => no results (2.0.2+107)
Priority urgent Status resolved
Milestone 2.0.x Resolved in
Superseder Nosy List Serware, dan, darcs-devel, dmitry.kurochkin, kowey, thorkilnaur, tommy
Assigned To dmitry.kurochkin
Topics Regression

Created on 2008-07-22.15:28:07 by kowey, last changed 2010-06-15.21:20:27 by admin.

Messages
msg5235 (view) Author: kowey Date: 2008-07-22.15:28:03
Hi,

That sounds like a bug.  I'm CC'ing the bugtracker.  You may want to
put yourself in the nosy list for the ticket that gets created.
msg5248 (view) Author: kowey Date: 2008-07-24.10:37:54
I just noticed that I did not include Dan's message (below the scissors)

-------8<---------------

Hi,

After upgrading from darcs 1.0.9 to darcs 2, I noticed a problem with
getting diffs from the repository. The repository is in version 1 format,
but I also converted it to version 2 format and the problem persists.
Also the same is true with newly created repositories.

What happens that a command like:

darcs diff --patch "patch description"

only works for patches that are still listed in _darcs/inventory

Once I run darcs optimize and they are moved to _darcs/inventories/, the
command above only shows the title for the record and the diff is empty.

To give an example to make things clear:

-----------------------------------------------------------------

dawn:~/work$ mkdir test; cd test
dawn:~/work/test$ darcs initialize
dawn:~/work/test$ echo "aaa" > file
dawn:~/work/test$ darcs add file
dawn:~/work/test$ darcs record -a -m "aaa"
Finished recording patch 'aaa'
dawn:~/work/test$ echo "bbb" >> file
dawn:~/work/test$ darcs record -a -m "bbb"
Finished recording patch 'bbb'
dawn:~/work/test$ darcs diff --patch "aaa"
Tue Jul 22 16:14:41 EEST 2008  Dan Pascu <dan@ag-projects.com>
 * aaa
diff -rN -u old-test/file new-test/file
--- old-test/file       1970-01-01 02:00:00.000000000 +0200
+++ new-test/file       2008-07-22 16:14:54.000000000 +0300
@@ -0,0 +1 @@
+aaa

dawn:~/work/test$ darcs diff --patch "bbb"
Tue Jul 22 16:14:49 EEST 2008  Dan Pascu <dan@ag-projects.com>
 * bbb
diff -rN -u old-test/file new-test/file
--- old-test/file       2008-07-22 16:14:57.000000000 +0300
+++ new-test/file       2008-07-22 16:14:57.000000000 +0300
@@ -1 +1,2 @@
 aaa
+bbb

dawn:~/work/test$ darcs tag release-1
Finished tagging patch 'TAG release-1'
dawn:~/work/test$ darcs optimize
Done optimizing!
dawn:~/work/test$ echo "ccc" >> file
dawn:~/work/test$ darcs record -a -m "ccc"
Finished recording patch 'ccc'
dawn:~/work/test$ darcs diff --patch "ccc"
Tue Jul 22 16:15:48 EEST 2008  Dan Pascu <dan@ag-projects.com>
 * ccc
diff -rN -u old-test/file new-test/file
--- old-test/file       2008-07-22 16:15:53.000000000 +0300
+++ new-test/file       2008-07-22 16:15:53.000000000 +0300
@@ -1,2 +1,3 @@
 aaa
 bbb
+ccc

dawn:~/work/test$ darcs diff --patch "aaa"
Tue Jul 22 16:14:41 EEST 2008  Dan Pascu <dan@ag-projects.com>
 * aaa
dawn:~/work/test$ darcs diff --patch "bbb"
Tue Jul 22 16:14:49 EEST 2008  Dan Pascu <dan@ag-projects.com>
 * bbb
dawn:~/work/test$

-------------------------------------------------------------

As it can be seen from the example above, the aaa and bbb diffs show up
just fine before the tree is optimized (using the release-1 tag). After
that only the ccc record (which was created after the optimization) shows
the diff correctly, while the aaa and bbb records only show thir title,
but not the actual diff.

This happens with darcs 2.0.0 and darcs 2.0.2 on a debian unstable system.
Reverting to darcs 1.0.9 fixes the problem.

Is this a known issue, or is it the new intended behavior? In the later
case how can I still get older diffs for which the inventory was already
archived to _darcs/inventorties/ after an optimization?


P.S.

trying darcs diff --from-patch "bbb" --to-patch "bbb" has the same problem

dawn:~/work/test$ darcs diff --from-patch "bbb" --to-patch "bbb"
Tue Jul 22 16:14:49 EEST 2008  Dan Pascu <dan@ag-projects.com>
 * bbb
dawn:~/work/test$

but it seems that darcs diff --last N works correctly:

dawn:~/work/test$ darcs diff --last 4
Tue Jul 22 16:15:48 EEST 2008  Dan Pascu <dan@ag-projects.com>
 * ccc
Tue Jul 22 16:15:23 EEST 2008  Dan Pascu <dan@ag-projects.com>
 tagged release-1
Tue Jul 22 16:14:49 EEST 2008  Dan Pascu <dan@ag-projects.com>
 * bbb
Tue Jul 22 16:14:41 EEST 2008  Dan Pascu <dan@ag-projects.com>
 * aaa
diff -rN -u old-test/file new-test/file
--- old-test/file       1970-01-01 02:00:00.000000000 +0200
+++ new-test/file       2008-07-22 16:28:45.000000000 +0300
@@ -0,0 +1,3 @@
+aaa
+bbb
+ccc

dawn:~/work/test$
msg5301 (view) Author: simon Date: 2008-08-07.02:17:01
Another example: with a fresh lazy copy of the darcs.net repo,

darcs diff -p 'make order of running tests consistent' # prints diff
darcs diff -p 'remove Stringalike module entirely.'    # prints no diff
msg5352 (view) Author: simon Date: 2008-08-10.00:46:24
I understand this report better now. Well somebody more familiar than I can
probably look at the code in Darcs/Commands/Diff.lhs:diff_cmd and say what's
going on here.

I was able to look at it a little with ghci, here's how in case someone wants
to: cd darcs, make ghci, :m + *Darcs.Commands.Diff, :set args diff -p 'remove
Stringalike module entirely.', :b 200, main. This will break after creating the
old-darcs and new-darcs tmp directories; getCurrentDirectory to find out where
they are and take a look. old-darcs seems wrong, it corresponds to the source
after the patch, should be the source before the patch.
msg5353 (view) Author: simon Date: 2008-08-10.01:07:33
Correction: that should be :b Darcs.Commands.Diff 200
msg5631 (view) Author: kowey Date: 2008-08-22.02:17:28
Marking as urgent since this is a regression, and it really affects people's
ability to use darcs
msg5632 (view) Author: kowey Date: 2008-08-22.02:18:04
See also Dan's test case, which I have submitted as a patch.
msg5666 (view) Author: kowey Date: 2008-08-23.11:10:08
Hi Dmitry,

Would you be interested in figuring out why this happens?  Seems like a nice way
to get to know another area of darcs.  Thanks!
msg5681 (view) Author: dmitry.kurochkin Date: 2008-08-24.17:21:19
I would like to investigate this. But I am afraid I will not be able to do this
soon.

So if there are other takers, go ahead. If no one stands up by the time I can
work on this, I will take it.

Regards,
  Dmitry
msg5714 (view) Author: dmitry.kurochkin Date: 2008-08-26.15:32:12
I have started looking at this. And would like to hear comments.

diff_cmd creates 2 directories then calls get_first_match and get_second_match
to get source there. get_first_match and get_second_match are very similar. One
calls get_before_matcher and another get_matcher. And they call
apply_inv_to_matcher_inclusive and apply_inv_to_matcher - this is where we
actually go through patch set and apply inverted patches.

The only difference between apply_inv_to_matcher_inclusive and
apply_inv_to_matcher is that _inclusive applies the maching patch (inverted). So
with _inclusive we should get sources before matching patch.

Now I do not understand why it does not work as expected. I see several
possibilities here:

1. We do not see patched that were before "optimize". But in the example below
'diff -p "aaa"' produces file with single line "aaa" - this means that inverted
patch "bbb" (that is before optimization) was applied.

2. 'apply_matcher m p' does not match the patch. But if we run 'diff -p "bbb"'
files contain both "aaa" and "bbb" lines - this means that we stop where we should.

3. 'apply_invp p' function does not work. But again, in 1. inverted patch "bbb"
is successfully applied.

I do not understand all darcs magic but the above seems correct to me. So I do
not see where the problem is here. It just looks like the last 'apply_invp p'
call in apply_inv_to_matcher_inclusive does nothing. But why is a mystery to me.

Thanks for your patience :)
  Dmitry
msg5721 (view) Author: dmitry.kurochkin Date: 2008-08-27.09:19:29
Ok, forget it. I have found the problem - it was just occasional use of wrong
function.

Will send patch as soon as I have access to SMTP.

BTW darcs can submit patches with HTTP POST. Are there any plans to add such
support to the darcs repo?

Regards,
  Dmitry
msg5723 (view) Author: droundy Date: 2008-08-27.10:54:25
On Wed, Aug 27, 2008 at 5:19 AM, dmitry.kurochkin <bugs@darcs.net> wrote:
> Will send patch as soon as I have access to SMTP.
>
> BTW darcs can submit patches with HTTP POST. Are there any plans to add such
> support to the darcs repo?

There are no such plans.  Someone would have to tell me how, and it
would have to be safe.

David
msg5724 (view) Author: kowey Date: 2008-08-27.12:03:04
> There are no such plans.  Someone would have to tell me how, and it
> would have to be safe.

There is a cgi script tools/upload.cgi
that dumps the contents into a mailbox.
msg5741 (view) Author: dmitry.kurochkin Date: 2008-08-27.20:40:34
The following patch updated the status of issue966 to be resolved:

* Resolve issue966: fix apply_inv_to_matcher_inclusive.
History
Date User Action Args
2008-07-22 15:28:07koweycreate
2008-07-23 21:18:21koweylinkissue967 superseder
2008-07-24 10:37:57koweysetpriority: bug
nosy: + dan, - dan
status: unread -> unknown
messages: + msg5248
2008-08-07 02:17:03simonsetnosy: + simon
messages: + msg5301
2008-08-10 00:46:27simonsetnosy: darcs-users, tommy, beschmi, kowey, dagit, simon, dan
messages: + msg5352
2008-08-10 01:07:36simonsetnosy: darcs-users, tommy, beschmi, kowey, dagit, simon, dan
messages: + msg5353
2008-08-22 02:17:34koweysetpriority: bug -> urgent
nosy: + Serware, droundy, - darcs-users
topic: + Regression, Target-2.0
messages: + msg5631
title: Issue with darcs diff in darcs2 -> tag/diff => no results (2.0.2+107)
2008-08-22 02:18:06koweysetnosy: droundy, tommy, beschmi, kowey, dagit, simon, Serware, dan
messages: + msg5632
2008-08-23 11:10:10koweysetnosy: + dmitry.kurochkin
messages: + msg5666
assignedto: dmitry.kurochkin
2008-08-24 17:21:21dmitry.kurochkinsetnosy: droundy, tommy, beschmi, kowey, dagit, simon, dmitry.kurochkin, Serware, dan
messages: + msg5681
assignedto: dmitry.kurochkin -> (no value)
2008-08-26 15:32:14dmitry.kurochkinsetnosy: droundy, tommy, beschmi, kowey, dagit, simon, dmitry.kurochkin, Serware, dan
messages: + msg5714
2008-08-27 09:19:31dmitry.kurochkinsetnosy: droundy, tommy, beschmi, kowey, dagit, simon, dmitry.kurochkin, Serware, dan
messages: + msg5721
assignedto: dmitry.kurochkin
2008-08-27 10:54:27droundysetnosy: droundy, tommy, beschmi, kowey, dagit, simon, dmitry.kurochkin, Serware, dan
messages: + msg5723
2008-08-27 12:03:07koweysetnosy: droundy, tommy, beschmi, kowey, dagit, simon, dmitry.kurochkin, Serware, dan
messages: + msg5724
2008-08-27 20:40:36dmitry.kurochkinsetstatus: unknown -> resolved-in-unstable
nosy: droundy, tommy, beschmi, kowey, dagit, simon, dmitry.kurochkin, Serware, dan
messages: + msg5741
title: tag/diff => no results (2.0.2+107) -> fix apply_inv_to_matcher_inclusive.
2008-09-14 08:30:11koweysetnosy: droundy, tommy, beschmi, kowey, dagit, simon, dmitry.kurochkin, Serware, dan
title: fix apply_inv_to_matcher_inclusive. -> tag/diff => no results (2.0.2+107)
2009-04-22 03:31:00twbsetstatus: resolved-in-unstable -> resolved
nosy: + thorkilnaur
2009-08-06 17:59:50adminsetnosy: + markstos, jast, darcs-devel, zooko, mornfall, - droundy, dan
2009-08-06 21:09:46adminsetnosy: - beschmi
2009-08-10 22:21:48adminsetnosy: + dan, - markstos, darcs-devel, zooko, jast, mornfall
2009-08-11 00:19:08adminsetnosy: - dagit
2009-08-25 17:23:50adminsetnosy: + darcs-devel, - simon
2009-08-27 14:18:32adminsetnosy: tommy, kowey, darcs-devel, thorkilnaur, dmitry.kurochkin, Serware, dan
2009-10-23 22:44:15adminsetnosy: + serware, - Serware
2009-10-23 23:30:05adminsetnosy: + Serware, - serware
2010-06-15 21:20:26adminsetmilestone: 2.0.x
2010-06-15 21:20:27adminsettopic: - Target-2.0