Bazaar: Moving files after the fact | Comments (3)
Posted in Code on 29th January 2009, 9:18 am by Stuart
I recently came across a useful flag that can be use with Bazaar’s move command. --after can be used to update bazaar’s internal reference to the file after you’ve already moved the file.
The syntax is as follows:
$ mv foo bar # Doh should have used bzr mv
$ bzr mv --after foo bar
renamed foo => bar
Moving files without telling bazaar will just simply remove them from their original location and require you to re-add them. The point of using bzr mv is that it tracks renames. The has a huge benefit when merging as Bazaar knows that the file that was formerly “foo” is now called “bar”. Any changes to “foo” will be correctly applied to “bar”.

You know, though… I wonder if the –after flag is even necessary? Is there any reason plain ‘bzr mv’ can’t just Do The Right Thing if it detects that the file has already been moved?
In cases where the content of bar is the same as the recorded versioned content for foo, it’s trivial. But even when bar differs, it’s usually going to be recognizably similar. And bzr could simply error (and recommend –after or –force or something) if the relationship is not automatically detectable.
@Karl: Technically I can’t see why not. But, on a practical level I think keeping things like this as explicit is better than requiring an interface to resolve ambiguity.
It’s possible and actually not very difficult. they may implement it in future versions. you might want to fill a feature request