[MERGE] Support upgrading non-.bzr directories

John Arbash Meinel john at arbash-meinel.com
Sat Nov 29 16:12:34 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jelmer Vernooij wrote:
> The attached patch makes it possible for a BzrDir implementation to 
> override the way backups are done. This is required to e.g. be able to 
> run "bzr upgrade --rich-root-pack" in a Subversion checkout or Git
> branch.
> 
> Cheers,
> 
> Jelmer
> 

This seems fine, but wouldn't you want to backup ".svn" to something
other than "backup.bzr" ? Such as "backup.svn" ?

Also, if it only copies the local .svn directory, does that help much?
(Versus doing something to every .svn directory in the whole tree.)

I realize it might do something for .git, though again it seems like
there isn't much point in creating backup.git if you are going to be
creating a new .bzr directory (as you aren't writing into the .git dir).

Or are you planning on allowing upgrading of the SVN working tree?

So my recommendation would be to change it so that the function called is:

old_path, new_path = BzrDir.create_backup()

And the default implementation does:

 self.root_transport.copy_tree('.bzr', 'backup.bzr')
 return (self.root_transport.abspath('.bzr'),
         self.root_transport.abspath('backup.bzr'))

And then the _backup_control_dir function would be:

old_dir, new_dir = self.bzrdir.backup()
self.pb.note('%s has been backed up to %s',
	     old_dir, new_dir)


I would also then add a
"bzrlib/tests/bzrdir_implementations/test_backup.py" file, with a test
of something like:

def test_backup_copies_existing(self):
  tree = self.make_branch_and_tree('test')
  self.build_tree('test/a')
  tree.add(['a'], ['a-id'])
  tree.commit('some data to be copied.')
  old_path, new_path = tree.bzrdir.backup()
  self.failUnlessExists(old_path)
  self.failUnlessExists(new_path)
  # test that the content of old is the same as the content of new.
  # Probably with something like walkdirs() on both sides.

That way we assert that all BzrDir implementations

1) Support .backup() with the right arguments
2) And when backing up it really does create a copy of everything

The other thing we could test is that "old_path" and "new_path" start
with the BzrDir.root_transport.base, but I'm not 100% sure we need to do
that.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkxafIACgkQJdeBCYSNAANmywCeO7z3AMQkdIpO/dLPEj2bYNHL
UsUAnjjIyeiugg76F6R5ffN2n6n6cPH2
=qT3f
-----END PGP SIGNATURE-----



More information about the bazaar mailing list