Can I completely remove a branch with its history from a shared repository?

Asked by Alexandre on 2008-07-10

Is recommended to use a single shared repository on a central server to store many different projects?
I know that it will work fine, because I have tested, but in some cases I need/want to push a temporary project to server than work within it.
But I found a "problem". if I decide to remove that project from repository, I can just acces the server and "rm -R repo/project.dev", but the revision info for that project/branch will remain in the shared repository.
I want to use a layout not listed in http://bazaar-vcs.org/SharedRepositoryLayouts for my projects:

shared repo/
        /project.dev # development focus (trunk)
        /project.some-feature # branch for add some special feature
        /project.8.20 # branch for fix issues on version 8.20
        /anotherproject.dev
        /anotherproject.feature..........

there is someone using this aproach?

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
Alexandre
Solved:
2008-07-10
Last query:
2008-07-10
Last reply:
2008-07-10

I use a similar layout:

shared repo/
    foo/
        foo.dev/
        foo.feature/
    bar/
        bar.dev/
        bar.feature/

Sometimes 'foo' or 'bar' will also be a shared repository, so I can set 'no-trees' if the project requires it, but most of my branches use 'shared repo'.

How big are these temporary projects that you're worried about the space the unused revisions take up?

Alexandre (lexrupy) said : #2

the temporary projects are not so big, something about a 10~12 Mb of working tree, but all repo is started with --no-trees. but wasted space is not my really worry, my worry is about the ghost project that will remain in the working tree, since I don't want a branch/project in a repository (specially this kind o multiproject repository) I should be able to remove the complete history too, because after I rm -R the project direct from filesystem, I cannot find a say to check out that branche again.
the question: "many projects on the same shared repository" is not clear, the correct question is: Can I completely remove a branch with its history from a shared repository?

Alexandre (lexrupy) said : #3

and about your layout, I also thought of using this layout with a small change:

repo/
   project/
      dev/
      feature/

by this way the repetition "project/project.dev" is avoided,
but I am thinking that by my current organization urls will be more clear:

bzr+ssh://server/bzr/project.dev instead of bzr+ssh://server/bzr/project/project/dev, but it is just a way to see the same thing.
thanks for reply

To answer the question in the summary, I believe it is possible to remove the history of a branch from a repository, but there isn't a nice way of doing it right now. That is to say, you'd have to get your hands dirty with Python and bzrlib.

Alexandre (lexrupy) said : #5

ok, so I Will do a workarround, I will just create a bzrtmp repository to store that kind of project, and if the project becomes permanent I branch it for "official" repository,
and this way I can recreate the temporary repository after some temp projects.
and about get hands dirty, it is easier to bazaar developers implement such thing. I was thinking about spent some lines of python code to implement something like gitosis: http://eagain.net/gitweb/?p=gitosis.git (for git) or hg-admin-tools: http://hg.opensource.lshift.net/hg-admin-tools/ (for mercurial). the good point is there is a good startina point, both use python. :)

thanks for answer.

John A Meinel (jameinel) said : #6

I believe there is a plugin which provides this (bzr-remove-revisions) already.

Further, when you copy revisions *from* this repository, it will not pull changes that are unreferenced. For example, if I do:

bzr branch new-project /shared/repo/new-project
bzr branch other-project /shared/repo/other-project

when I do:

bzr branch /shared/repo/new-project local

I don't get any of the changes included in 'other-project'. So doing 'rm -rf /shared/repo/other-project' doesn't remove those changes from the repository, they will not be included whenever someone gets other data from your repository.

Also, I want to make it clear, that if you *merge* the changes from a branch into another branch, then we do not support getting rid of those changes. It is possible within our data structures, but it is not something that we endorse. (To try to clarify, it is a different action to remove a branch and its history if the history of the 2 branches are connected or not.)

Alexandre (lexrupy) said : #7

ok it is the best answer.
however, in my case the branches I want to remove are not shared merged with other branches that will stay in repository, because each branch should be a project,
by this way if I have two branches, project.dev and project.feature1, so I will remove project.* branches, by this way a branch merged with another in the same project will never remain in repository.
thank you for the answer

Aleksandar (alekrsteski) said : #8

Sorry, to bring this topic again. But I've searched for the answer of the same question.

Let us say that we have shared repository with two differnet projects:
repo/
    project1.branch1/
    project1.branch2/
    project2.branch1/
    project2.branch2/
    project2.branch3/

Now if we remove the project2 completley from the file-system, its history will remain in the shared repository.

I've got the following idea, but I'm not sure how it will work. The idea is to run bzr reconfigure --standalone on both remaining branches of project1:
bzr reconfigure --standalone project1.branch1
bzr reconfigure --standalone project1.branch2

Then I will create new empty shared repository and move the branches to the new repository. After that I will run bzr reconfigure --use-shared on both branches in the new repository.
bzr reconfigure --use-shared project1.branch1
bzr reconfigure --use-shared project1.branch2

How is this idea going to work? Am I going to achive the desired result of removing the history from the repository? Are there any problems that could arise?