darcs

Issue 1272 amend-record not the same as unrecord + record

Title amend-record not the same as unrecord + record
Priority bug Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, kowey, mornfall, simonmar, simonpj, thorkilnaur
Assigned To
Topics

Created on 2008-12-19.15:24:38 by marlowsd, last changed 2009-10-23.23:34:55 by admin.

Messages
msg6834 (view) Author: simonmar Date: 2008-12-19.15:24:35
I would naively expect that amend-record is just a convenient way to do 
unrecord followed by record.  However, as the following sequence 
demonstrates, it's possible to get different results.  I can understand (at 
a high level) how this might happen, but I think it ought to be classed as 
a bug.  The impact of the current behaviour is that the amend-recorded 
patch has extra junk in it, and is more likely to conflict with other 
patches.  So to get "clean" patches I find myself using unrecord/record 
instead of amend-record, and that's bad.

Ideally:

   * recording a change A and then amend-recording it to B, should give
     the same patch as just recording B in the first place.

   * amend-recording a patch should give the same results as unrecord
     followed by record.

   * If I amend-record a patch, then unrecord+record on that patch should
     be a no-op.

In all cases, by "the same patch" I mean the same set of hunks.

simple script to demonstrate the difference:

#! /bin/sh
mkdir test
cd test
darcs init
printf "a\nb\nc\nd\n" >x
darcs add x
darcs rec -a -m "add x"

# First the amend-record sequence
printf "AAA\nBBB\nCCC\nDDD\n" >x
darcs rec -a -m patch
printf "AAA\nb\nc\nDDD\n" >x
yes | darcs amend-record -a -p patch
echo "PATCH AFTER AMEND-RECORD:"
darcs changes --no-summary -v -p patch

yes | darcs unpull -p patch

# Now just recording the patch:
printf "AAA\nb\nc\nDDD\n" >x
darcs rec -a -m patch
echo "PATCH AFTER RECORD:"
darcs changes --no-summary -v -p patch
msg6887 (view) Author: mornfall Date: 2008-12-25.00:09:21
(default PATH has darcs 2.1 on it)

01:06:18 | morn@eri:/tmp -> rm -rf test
01:06:21 | morn@eri:/tmp -> sh ./test.sh                                
Finished recording patch 'add x'
Finished recording patch 'patch'
Thu Dec 25 01:06:25 CET 2008  Petr Rockai <me@mornfall.net>
  * patch
Shall I amend this patch? [yNvpxq], or ? for help: 
Finished amending patch:
Thu Dec 25 01:06:25 CET 2008  Petr Rockai <me@mornfall.net>
  * patch
PATCH AFTER AMEND-RECORD:
Thu Dec 25 01:06:25 CET 2008  Petr Rockai <me@mornfall.net>
  * patch
    hunk ./x 1
    -a
    -b
    -c
    -d
    +AAA
    +b
    +c
    +DDD
Thu Dec 25 01:06:25 CET 2008  Petr Rockai <me@mornfall.net>
  * patch
Shall I unpull this patch? (1/1)  [ynWsfvpxdaqjk], or ? for help: 
Finished unpulling.
Finished recording patch 'patch'
PATCH AFTER RECORD:
Thu Dec 25 01:06:25 CET 2008  Petr Rockai <me@mornfall.net>
  * patch
    hunk ./x 1
    -a
    +AAA
    hunk ./x 4
    -d
    +DDD

01:06:25 | morn@eri:/tmp -> rm -rf test 
01:06:39 | morn@eri:/tmp -> PATH=~/dev/darcs/mainline:$PATH sh ./test.sh
Finished recording patch 'add x'
Finished recording patch 'patch'
Thu Dec 25 01:06:41 CET 2008  Petr Rockai <me@mornfall.net>
  * patch
Shall I amend this patch? [yNvpxq], or ? for help: 
Finished amending patch:
Thu Dec 25 01:06:41 CET 2008  Petr Rockai <me@mornfall.net>
  * patch
PATCH AFTER AMEND-RECORD:
Thu Dec 25 01:06:41 CET 2008  Petr Rockai <me@mornfall.net>
  * patch
    hunk ./x 1
    -a
    +AAA
    hunk ./x 4
    -d
    +DDD
Thu Dec 25 01:06:41 CET 2008  Petr Rockai <me@mornfall.net>
  * patch
Shall I unpull this patch? (1/1)  [ynWsfvplxdaqjk], or ? for help: 
Finished unpulling.
Finished recording patch 'patch'
PATCH AFTER RECORD:
Thu Dec 25 01:06:42 CET 2008  Petr Rockai <me@mornfall.net>
  * patch
    hunk ./x 1
    -a
    +AAA
    hunk ./x 4
    -d
    +DDD

In other words, this has been fixed for 2.2, I believe by David, and it's also 
been filed in the tracker before but I'm too lazy to dig up the original issue#.
History
Date User Action Args
2008-12-19 15:24:38marlowsdcreate
2008-12-25 00:09:26mornfallsetpriority: bug
status: unread -> resolved
messages: + msg6887
nosy: + mornfall
2009-08-25 17:18:49adminsetnosy: + darcs-devel, - igloo
2009-08-25 17:36:23adminsetnosy: - simon
2009-08-27 14:14:07adminsetnosy: kowey, darcs-devel, simonpj, thorkilnaur, dmitry.kurochkin, marlowsd, mornfall
2009-10-23 23:34:55adminsetnosy: + simonmar, - marlowsd