Discussion:
Batch file renaming using Unix commands
Nicholas Allen
2012-11-16 08:14:49 UTC
Permalink
Hi,

I'm curious as to the best way to rename many files in the repository
using Unix commands. I tried the obvious but it seems bugs in Veracity
prevent it from working (but I admit it may also be my fault ;-)).

I want to rename all files in my working copy with the name
description.txt to info.json. I tried the following command inside the
root of my working copy:

find . -name description.txt -exec vv rename \"{}\" info.json \;

But then I get errors like the following from Veracity:

Error: Attempt to operate on an item which is not under version control:
/tmp/test-working-copy/"./Dir Name With Spaces/description.txt"

If I run the command using echo instead of vv it all looks correct:

find . -name description.txt -exec echo vv rename \"{}\" info.json \;


vv rename "./Dir Name With Spaces/description.txt" info.json

So the path passed is a relative path using ./ and this seems to break
the rename command. If I manually delete the "./" from the start then
the command works. So this looks like a bug in veracity's handling of
relative paths to me.


Nicholas Allen
Joe Ream
2012-11-16 17:52:07 UTC
Permalink
If you copy/paste the output from your echo test, the vv command works.
You just need to drop the redundant quotes from your find command.
find's exec handles breaking up the argument lists appropriately on its own.

$ find . -name description.txt -exec vv rename \"{}\" info.json \;
Error: Attempt to operate on an item which is not under version control:
/home/qa/vwork/tst1/"./dir space/description.txt"

$ find . -name description.txt -exec vv rename {} info.json \;

$ vv status
Renamed: @/dir space/info.json
# was description.txt
Post by Nicholas Allen
Hi,
I'm curious as to the best way to rename many files in the repository
using Unix commands. I tried the obvious but it seems bugs in Veracity
prevent it from working (but I admit it may also be my fault ;-)).
I want to rename all files in my working copy with the name
description.txt to info.json. I tried the following command inside the
find . -name description.txt -exec vv rename \"{}\" info.json \;
Error: Attempt to operate on an item which is not under version
control: /tmp/test-working-copy/"./Dir Name With Spaces/description.txt"
find . -name description.txt -exec echo vv rename \"{}\" info.json \;
vv rename "./Dir Name With Spaces/description.txt" info.json
So the path passed is a relative path using ./ and this seems to break
the rename command. If I manually delete the "./" from the start then
the command works. So this looks like a bug in veracity's handling of
relative paths to me.
Nicholas Allen
_______________________________________________
Veracity-users mailing list
http://lists.sourcegear.com/cgi-bin/mailman/listinfo/veracity-users
Loading...