[new-extension] hg breakout

Guido Ostkamp hg at ostkamp.fastmail.fm
Sun Sep 2 10:39:59 CDT 2007


On Sat, 1 Sep 2007, Essien Ita Essien wrote:
> Anyways... I won't pretend to be a guru on the source control domain, so 
> i'm not exactly sure how this would work out. This is the rough idea 
> floating around my head after reading what you described above.
>
> 1. Everyfile has its history, which contains changesets that list it as 
> an affected file.
>
> 2. The breakout extension should carry along _only_ the changesets that 
> affect _all_ the files that fall _under_ the subdirectory being 
> processed.
>
> Does this sound right?

I wouldn't recommend to go through each files history. Instead I would 
scan through all changesets from first one to tip and check the list of 
affected (added/removed/modified) files to determine whether this 
changeset is of interest and if yes, which parts of it.

If no file belongs to the directory which should be broken out, the 
changeset can be skipped; otherwise partially replay the changeset in the 
new repo, which means use only those parts that deal with changes in the 
matching directory.

E.g. if you want to break out 'dir1' and you have the following 
original repository:

Changeset 1:    Added dir1/file1

Changeset 2:    Added dir2/file47
                 Added dir2/file49
                 Added dir3/file50

Changeset 3:    Modified dir1/file1
                 Added dir2/file48
                 Modified dir2/file49
                 Removed dir3/file50

then a new breakout repository for 'dir1' should have the following 
changesets:

Changeset 1:    Added dir1/file1     (from orig changeset 1)

Changeset 2:    Modified dir1/file1  (from orig changeset 3)

Regards

Guido


More information about the Mercurial-devel mailing list