removing directories from repository

Colin D Bennett colin at gibibit.com
Wed Dec 17 15:55:06 GMT 2008


On Wed, 17 Dec 2008 09:35:58 +1100
"Andrew King" <eurokang at gmail.com> wrote:

> Hi,
> Is it possible to permanently remove a directory from the history of a
> branch? ie.I have some tree external/mydir, I want to do a command
> such that it is removed as though it was never in the repository.
> 
> If it is not possible, how hard would it be to implement?
> 
> The most obvious application of this is someone adds a big file by
> mistake to the repo (or a library), and then you are stuck with all
> those files for eternity.

bzr devs:

I attempted to demonstrate removing a file from history by using the
rebase plugin's "replay" command as John suggested, but it appears that
the file continues to take up space even when it is removed from view.
I thought this would be a good thing to add to the bzr user guide (is
there a bzr FAQ? I don't recall one).

In this example, I make a couple of small commits, then check in a
large (12 MB) file, then make a couple more small commits.  I then
branch off from before the large file was committed and use 'bzr
replay' to replay the changes after the large file was checked in.
This seems to work, but the repository still takes up >12MB of space.


myproject $ mkdir trunk
myproject $ bzr init --1.9 trunk
Standalone tree (format: 1.9)
Location:
  branch root: trunk
myproject $ cd trunk
myproject/trunk $ ls
myproject/trunk $ echo 'Hello, World!' > Hello.txt
myproject/trunk $ bzr add
added Hello.txt
myproject/trunk $ bzr ci -m "Initial checkin; greetz."
Committing to: /home/cdb/myproject/trunk/
added Hello.txt
Committed revision 1.
myproject/trunk $ echo 'TODO Write the readme' > README
myproject/trunk $ bzr add
added README
myproject/trunk $ bzr ci -m 'Added README file, w/o
content.' Committing to: /home/cdb/myproject/trunk/
added README
Committed revision 2.
myproject/trunk $ cp ~/grub/grub-gfxmenu.tar.gz .
myproject/trunk $ bzr add
added grub-gfxmenu.tar.gz
myproject/trunk $ bzr ci -m 'Added GRUB gfxmenu archive.'
Committing to: /home/cdb/myproject/trunk/
added grub-gfxmenu.tar.gz
Committed revision 3.
-- NOTE: This file is over 12 MB in size.
myproject/trunk $ ls -l
total 12520
-rw-r--r-- 1 cdb cdb 12787755 2008-12-17 07:37 grub-gfxmenu.tar.gz
-rw-r--r-- 1 cdb cdb       14 2008-12-17 07:35 Hello.txt
-rw-r--r-- 1 cdb cdb       22 2008-12-17 07:36 README
myproject/trunk $ du -sh .bzr
13M     .bzr
myproject/trunk $ cd ..
myproject $ bzr branch trunk
myproject $ cd trunk
myproject/trunk $ echo 'This is the README file, blah,
blah...' > README cdb at gamma ~/myproject/trunk $ bzr ci -m 'Updated
README file for blah blah.' Committing to: /home/cdb/myproject/trunk/
modified README
Committed revision 4.
myproject/trunk $ echo 'int main() { while(1) fork(); }' >
forkbomb.c cdb at gamma ~/myproject/trunk $ bzr add
added forkbomb.c
myproject/trunk $ bzr ci -m 'Added a lovely and useful
program.' Committing to: /home/cdb/myproject/trunk/
added forkbomb.c
Committed revision 5.
myproject/trunk $ bzr ll
5: Colin D Bennett 2008-12-17 Added a lovely and useful program.
4: Colin D Bennett 2008-12-17 Updated README file for blah blah.
3: Colin D Bennett 2008-12-17 Added GRUB gfxmenu archive.
2: Colin D Bennett 2008-12-17 Added README file, w/o content.
1: Colin D Bennett 2008-12-17 Initial checkin; greetz.
myproject/trunk $ cd ..
myproject $ bzr branch trunk -r2 cleaned
Branched 2 revision(s).
myproject $ du -sh cleaned
120K    cleaned
myproject $ cd cleaned
myproject/cleaned $ bzr replay -r 4.. ../trunk
All changes applied successfully.
Committing to: /home/cdb/myproject/cleaned/
modified README
Committed revision 3.
All changes applied successfully.
Committing to: /home/cdb/myproject/cleaned/
added forkbomb.c
Committed revision 4.
myproject/cleaned $ bzr ll
4: Colin D Bennett 2008-12-17 Added a lovely and useful program.
3: Colin D Bennett 2008-12-17 Updated README file for blah blah.
2: Colin D Bennett 2008-12-17 Added README file, w/o content.
1: Colin D Bennett 2008-12-17 Initial checkin; greetz.
-- While the file no longer shows up, it still seems to be taking up
-- space in the repository:
myproject/cleaned $ du -sh .bzr
13M     .bzr
myproject/cleaned $ du -cs .bzr/repository/*
4       .bzr/repository/format
84      .bzr/repository/indices
4       .bzr/repository/lock
4       .bzr/repository/obsolete_packs
4       .bzr/repository/pack-names
12536   .bzr/repository/packs
4       .bzr/repository/upload
12640   total

Regards,
Colin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20081217/ad1a5e9b/attachment.pgp 


More information about the bazaar mailing list