[darcs-devel] [issue1519] Surprising behaviour of darcs mv
Lele Gaifax
bugs at darcs.net
Thu Aug 13 09:22:27 UTC 2009
New submission from Lele Gaifax <lele at nautilus.homeip.net>:
Hi all,
yesterday I did a little reorg of one project, moving stuff around. In
particular, I had a sub/subfolder that I moved to the top level, and a
few other files moved into it as well.
Trying to distill a simple recipe to trigger the behaviour, I was even
more surprised to come up with two *very* similar scripts that produce
different output...
This first script:
darcs --version
mkdir p
cd p
darcs init
mkdir -p folder/subfolder
touch folder/subfolder/file_a
touch folder/subfolder/file_b
mkdir other
touch other/file_c
darcs add --recursive folder other
darcs record -a -m "1st"
mkdir another
touch another/file_z
darcs add --recursive another
darcs record -a -m "2nd"
darcs mv folder/subfolder promoted
darcs mv other/file_c promoted/new_name
darcs mv another/file_z promoted
darcs whatsnew -s
darcs record -a -m "3rd"
darcs changes -s --last=1
cd ..
rm -rf p
outputs this:
$ sh -x pp.sh
+ darcs --version
2.3.0 (release)
+ mkdir p
+ cd p
+ darcs init
+ mkdir -p folder/subfolder
+ touch folder/subfolder/file_a
+ touch folder/subfolder/file_b
+ mkdir other
+ touch other/file_c
+ darcs add --recursive folder other
+ darcs record -a -m 1st
Finished recording patch '1st'
+ mkdir another
+ touch another/file_z
+ darcs add --recursive another
+ darcs record -a -m 2nd
Finished recording patch '2nd'
+ darcs mv folder/subfolder promoted
+ darcs mv other/file_c promoted/new_name
+ darcs mv another/file_z promoted
+ darcs whatsnew -s
./another/file_z -> ./folder/subfolder/file_z
./folder/subfolder -> ./promoted
./other/file_c -> ./promoted/new_name
+ darcs record -a -m 3rd
Finished recording patch '3rd'
+ darcs changes -s --last=1
Thu Aug 13 11:16:31 CEST 2009 lele at nautilus.homeip.net
* 3rd
./another/file_z -> ./folder/subfolder/file_z
./folder/subfolder -> ./promoted
./other/file_c -> ./promoted/new_name
+ cd ..
+ rm -rf p
And you can see the two different ways darcs handled the move of
"another/file_z" and "other/file_c" into the renamed folder.
This other script, that AFAICS differs from the first *only* on the
path names (what was "another" in the first is "third" here...):
darcs --version
mkdir p
cd p
darcs init
mkdir -p folder/subfolder
touch folder/subfolder/file_a
touch folder/subfolder/file_b
mkdir other
touch other/file_c
darcs add --recursive folder other
darcs record -a -m "1st"
mkdir third
touch third/file_z
darcs add --recursive third
darcs record -a -m "2nd"
darcs mv folder/subfolder promoted
darcs mv other/file_c promoted/new_name
darcs mv third/file_z promoted
darcs whatsnew -s
darcs record -a -m "3rd"
darcs changes -s --last=1
cd ..
rm -rf p
does not produce the same:
$ sh -x p.sh
+ darcs --version
2.3.0 (release)
+ mkdir p
+ cd p
+ darcs init
+ mkdir -p folder/subfolder
+ touch folder/subfolder/file_a
+ touch folder/subfolder/file_b
+ mkdir other
+ touch other/file_c
+ darcs add --recursive folder other
+ darcs record -a -m 1st
Finished recording patch '1st'
+ mkdir third
+ touch third/file_z
+ darcs add --recursive third
+ darcs record -a -m 2nd
Finished recording patch '2nd'
+ darcs mv folder/subfolder promoted
+ darcs mv other/file_c promoted/new_name
+ darcs mv third/file_z promoted
+ darcs whatsnew -s
./folder/subfolder -> ./promoted
./other/file_c -> ./promoted/new_name
./third/file_z -> ./promoted/file_z
+ darcs record -a -m 3rd
Finished recording patch '3rd'
+ darcs changes -s --last=1
Thu Aug 13 11:17:16 CEST 2009 lele at nautilus.homeip.net
* 3rd
./folder/subfolder -> ./promoted
./other/file_c -> ./promoted/new_name
./third/file_z -> ./promoted/file_z
+ cd ..
+ rm -rf p
and actually this is what I was expecting to see...
Just to be picky:
$ diff -u pp.sh p.sh
--- pp.sh 2009-08-13 11:15:47.163840847 +0200
+++ p.sh 2009-08-13 11:12:07.872139599 +0200
@@ -9,13 +9,13 @@
touch other/file_c
darcs add --recursive folder other
darcs record -a -m "1st"
-mkdir another
-touch another/file_z
-darcs add --recursive another
+mkdir third
+touch third/file_z
+darcs add --recursive third
darcs record -a -m "2nd"
darcs mv folder/subfolder promoted
darcs mv other/file_c promoted/new_name
-darcs mv another/file_z promoted
+darcs mv third/file_z promoted
darcs whatsnew -s
darcs record -a -m "3rd"
darcs changes -s --last=1
This is not a problem at all of course, after all everything is going
ok, but I tag this as "problematic", in the sense that tools like
tailor and trac-darcs have to do tricky dance to understand what's
going on.
thank you,
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at nautilus.homeip.net | -- Fortunato Depero, 1929.
----------
messages: 8124
nosy: dmitry.kurochkin, kowey, lele, simon, thorkilnaur
status: unread
title: Surprising behaviour of darcs mv
__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue1519>
__________________________________
More information about the darcs-devel
mailing list