Muffinresearch Labs by Stuart Colville

Bazaar: Moving files after the fact | 3 Comments

Posted in Code on 29th January 2009, 9:18 am by

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”.

Post Tools

  • http://www.red-bean.com/kfogel/ Karl Fogel

    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.

  • http://muffinresearch.co.uk Stuart Colville

    @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.

  • http://sina.salek.ws Sina Salek

    It’s possible and actually not very difficult. they may implement it in future versions. you might want to fill a feature request ;)

GNU screen: open tab in current working directory|(1)

A nice trick for having screen open a new tab in the same directory as the one you’re currently in. To use it add it to your .screenrc

# Open new window in current dir.
bind c stuff "screen -X chdir \$PWD;screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

Hat tip: mteckert on SuperUser.com

Ubuntu: add-apt-repository: command not found|(3)

When you’re using a minimal Ubuntu install if you find the ‘add-apt-repository’ command is missing (it’s useful for adding PPAs and other repositories), then simply run:

sudo apt-get install python-software-properties

Photos on Flickr

© Copyright 2004-12 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.491s.