[darcs-users] Frustrations diffing against the last change to a file

Michael G Schwern schwern at pobox.com
Wed Mar 30 22:07:33 UTC 2005


I was trying to look at the diff between the current version and the last
change to a file.  Trivial stuff.  I failed and gave up.

To sum up...

* "darcs diff some/file" should only report on changes to affect some/file, 
  not the entire repository.  This was the source of 90% of my frustration.
  --last 1, for example, showing me the last change to the repository instead
  of the last change to some/file.

* The lack of simple revision numbers really complicates what would be a
  very simple task in most other version control systems.

* "fancy dates" such as "last month" and "last year" should work if
  not-so-fancy dates like "last week" work.

* Unless there's a match rule type (ie. 'date') which has whitespace in it,
  I don't see why --match 'date last week' shouldn't Do What I Mean.
  Quotes inside quotes for normal operations... bad.

* There seems to be something wrong with matching a patch by exact date.


Here's some documentation on what I tried and how my thoughts went...

Ok, I want to diff against the last revision.  Here's this --last option.
Perfect!

0 /usr/local/src/darcs-unstable$ darcs diff --last 1 tests/add.pl
Wed Mar 23 23:36:20 PST 2005  schwern at pobox.com
  * Uncommon file not actually being created
  
  On OS X at least (perhaps elsewhere) `date >> \\` produces
  sh: -c: line 2: syntax error: unexpected end of file
  
  Replaced with Shell::Command's touch() so that the file named \ is actually
  created.

This was most surprising.  Why is diff giving me a change log entry and no 
diff?

Ok, I'll try to match that change.

0 /usr/local/src/darcs-unstable$ darcs diff --from-match 'Wed Mar 23 23:36:20 PST 2005  schwern at pobox.com' tests/add.pl

Fail: Invalid --match pattern 'Wed Mar 23 23:36:20 PST 2005  schwern at pobox.com'.
    "match" (line 1, column 1):
    unexpected "W"
    expecting match rule

Hmmm.  Invalid.  Its not a simple pattern match.  Reading the docs I see I 
need to tell it what I'm matching.  Ok...


$ darcs diff --from-match 'date "Wed Mar 23 23:36:20 PST 2005"' tests/add.pl

darcs failed:  Couldn't match pattern "date "Wed Mar 23 23:36:20 PST 2005""

Hrmf, I'd have expected that to work.  How about...


$ darcs diff --from-match 'author schwern at pobox.com' tests/add.pl

Fail: Invalid --match pattern 'author schwern at pobox.com'.
    "match" (line 1, column 1):
    unexpected "a"
    expecting match rule


$ darcs diff --from-patch 'Wed Mar 23 23:36:20 PST 2005  schwern at pobox.com' tests/add.pl

darcs failed:  Couldn't match pattern "patch-name Wed Mar 23 23:36:20 PST 2005  schwern at pobox.com"

$ darcs diff --from-match 'date last week' tests/add.pl

Fail: Invalid --match pattern 'date last week'.
    "match" (line 1, column 11):
    unexpected "w"
    expecting space, white space, operator or end of input


$ darcs diff --from-match 'date "last week"' tests/add.pl

darcs failed:  Couldn't match pattern "date "last week""

This one caught me off guard.  I'd been getting so many syntax errors that
I just figured this didn't work either.  But the last change was two weeks
ago.  Ok then...


$ darcs diff --from-match 'date "last month"' tests/add.pl

Fail: Can't support fancy dates.

$ darcs diff --from-match 'date "last year"' tests/add.pl

Fail: Can't support fancy dates.

*sigh*  If "last week" works why not "last month" and "last year"?


$ darcs diff --from-patch 'Uncommon file not actually being created' tests/add.pl
Wed Mar 23 23:36:20 PST 2005  schwern at pobox.com
  * Uncommon file not actually being created
  
  On OS X at least (perhaps elsewhere) `date >> \\` produces
  sh: -c: line 2: syntax error: unexpected end of file
  
  Replaced with Shell::Command's touch() so that the file named \ is actually
  created.

ARGH!  Why is DIFF giving me a CHANGE LOG ENTRY?!  If I give it no file...

$ darcs diff --from-patch 'Uncommon file not actually being created'       
Wed Mar 23 23:36:20 PST 2005  schwern at pobox.com
  * Uncommon file not actually being created
  
  On OS X at least (perhaps elsewhere) `date >> \\` produces
  sh: -c: line 2: syntax error: unexpected end of file
  
  Replaced with Shell::Command's touch() so that the file named \ is actually
  created.
diff -rN old-darcs-unstable-1/tests/whatsnew.pl new-darcs-unstable-1/tests/whatsnew.pl
4a5,6
> use lib 'lib/perl';
> 
10c12
< use File::Path;
...etc...


I finally get some diff output.  However I notice that test/add.pl is
nowhere to be found in this patch.  Why did "darcs diff --last=1 tests/add.pl"
show me the change log for a patch which didn't effect that file?  Argh!


With this knowledge in hand, let's get the last change to tests/add.pl

$ darcs changes tests/add.pl | head
Changes to tests/add.pl:

Sat Mar 12 14:08:46 PST 2005  Mark Stosberg <mark at summersault.com>
  * a TODO test which confirms that RT#266 is a regression
  
  I suspect of the recent symlink patches introduced this. 
  Search 'darcs changes' for 'sym' to find it. 

Sat Mar 12 06:22:20 PST 2005  Mark Stosberg <mark at summersault.com>
  * Allow parens to be optional when calling darcs() test command in some cases.

darcs failed:  resource vanished


And then just match against that date...

$ darcs diff --from-match 'date "Sat Mar 12 14:08:46 PST 2005"' tests/add.pl
Wed Mar 23 23:36:20 PST 2005  schwern at pobox.com
  * Uncommon file not actually being created
  
  On OS X at least (perhaps elsewhere) `date >> \\` produces
  sh: -c: line 2: syntax error: unexpected end of file
  
  Replaced with Shell::Command's touch() so that the file named \ is actually
  created.
Wed Mar 23 22:03:12 PST 2005  schwern at pobox.com
  * Convert add_in_subdir test to Perl
  
  To demonstrate converting a shell test into Perl using Shell::Command for
  better portability, diagnostics and debugging.
  
  Its pretty much a straightforward line-by-line mapping.
...etc...

Lots of changes that have nothing to do with tests/add.pl.
                that aren't on the date I requested.
And again no diff, just a change log.
To top it all off, the change I asked for isn't in the list.

$ darcs diff --from-match 'date "Sat Mar 12 14:08:46 PST 2005"' tests/add.pl | grep 'Sat Mar 12 14:08:46 PST 2005'
$

At this point I give up.





More information about the darcs-users mailing list