[RFC] remove/copy enhancements

Jordan Breeding jordan.breeding at mac.com
Thu Sep 15 12:00:24 CDT 2005


Hello for the rest of the email I will reference this output

=================================
27 jbb at cloves /tmp > mkdir jbb_test
28 jbb at cloves /tmp > cd jbb_test
29 jbb at cloves /tmp/jbb_test > ls
30 jbb at cloves /tmp/jbb_test > hg init
31 jbb at cloves /tmp/jbb_test > touch one two; mkdir -p three/four five/six; touch three/four/seven five/six/eight
32 jbb at cloves /tmp/jbb_test > hg status
? five/six/eight
? one
? three/four/seven
? two
33 jbb at cloves /tmp/jbb_test > hg addremove
adding five/six/eight
adding one
adding three/four/seven
adding two
34 jbb at cloves /tmp/jbb_test > hg commit -m "initial commit"
35 jbb at cloves /tmp/jbb_test > hg status
36 jbb at cloves /tmp/jbb_test > hg remove three
removing three/four/seven
37 jbb at cloves /tmp/jbb_test > ls
five/  one  three/  two
38 jbb at cloves /tmp/jbb_test > ls three
four/
39 jbb at cloves /tmp/jbb_test > ls three/four
40 jbb at cloves /tmp/jbb_test > hg revert
41 jbb at cloves /tmp/jbb_test > hg cp three ten
copying three/four/seven to ten
42 jbb at cloves /tmp/jbb_test > ls -al ten
-rw-r--r--  1 jbb swtest 0 Sep 15 11:54 ten
43 jbb at cloves /tmp/jbb_test > hg revert
44 jbb at cloves /tmp/jbb_test > hg status
R ten
? three/four/seven
45 jbb at cloves /tmp/jbb_test > hg update -C
46 jbb at cloves /tmp/jbb_test > hg status
47 jbb at cloves /tmp/jbb_test > ls
five/  one  three/  two
48 jbb at cloves /tmp/jbb_test > find .
.
./.hg
./.hg/data
./.hg/data/five
./.hg/data/five/six
./.hg/data/five/six/eight.d
./.hg/data/five/six/eight.i
./.hg/data/one.d
./.hg/data/one.i
./.hg/data/three
./.hg/data/three/four
./.hg/data/three/four/seven.d
./.hg/data/three/four/seven.i
./.hg/data/two.d
./.hg/data/two.i
./.hg/hgrc
./.hg/dirstate
./.hg/00manifest.d
./.hg/00manifest.i
./.hg/00changelog.d
./.hg/00changelog.i
./.hg/undo
./.hg/undo.dirstate
./one
./two
./three
./three/four
./three/four/seven
./five
./five/six
./five/six/eight
49 jbb at cloves /tmp/jbb_test > hg help cp
hg copy [OPTION]... [SOURCE]... DEST

mark files as copied for the next commit

aliases: cp

options:

 -I --include  include path in search
 -X --exclude  exclude path from search
 -A --after    record a copy after it has happened
 -f --force    replace destination if it exists
 -p --parents  append source path to dest
50 jbb at cloves /tmp/jbb_test > hg cp -p three ten
abort: with --parents, destination must be a directory
51 jbb at cloves /tmp/jbb_test >
=================================

Sorry, that was probably a little long winded.  The main problems I have are:

1) If, during a remove, a directory tree becomes empty and the remove command was issued using that directory (eg. `hg remove three` above), I think that we should prune the empty directory tree as we do for updates.

2) It seemed to me that `hg cp -p` would work like `cp -R` and that it would create the new directory structure for me.

Jordan


More information about the Mercurial mailing list