Make "rename" command an alias for "mv"?

Erik Toubro Nielsen erik at tntech.dk
Tue Oct 25 07:06:33 BST 2005


Michael Ellerman <michael at ellerman.id.au> writes:
(...)
> What about stupid people like me, who *consistently* move files around and 
> only later remember to "bzr rename" them? There's lots of stupid people out 
> there, and if you ever manipulate your tree with a GUI file manager you'll 
> have to do the bzr renaming later, so I think it should work.
> 
> Currently I just have a local hack to rename, so that if the destination 
> exists it doesn't do the move.
> 
> We could try and be intelligent about it:
> 
>   bzr rename A B
> 
>   if exists(A) == exists(B):
> 	raise Exception('Blerg')
> 
>   if exists(A) and not exists(B):
> 	bzr.rename(A, B)
> 	move(A, B)
> 
>   if not exists(A) and exists(B):
> 	bzr.rename(A, B)
> 	print 'Warning: You seem to have moved A to B already'


+1 for this suggestion.

For instance, I had this problem: when using refactor in Eclipse to
change the name of a java class from A to B, its file name is also
changed to B.java.

So when doing
   bzr rename src/com/yadda/A.java src/com/yadda/B.java

bzr complains that A.java doesn't exist. So I have to manually mv the
file back, then use bzr rename to have the rename recorded. 
 
(Using bzr rename first, and then using Eclipse refactoring to try to
rename class A (in file B.java) to B, makes Eclipse complain that B.java
exists.)

Erik




More information about the bazaar mailing list