monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Multiple projects in one database -- branch confusi


From: Justin Patrin
Subject: Re: [Monotone-devel] Multiple projects in one database -- branch confusion
Date: Wed, 6 Dec 2006 14:47:30 -0800

On 12/6/06, Steven E. Harris <address@hidden> wrote:
Even after using monotone for a while, I'm still confused about how to
keep multiple projects in a single database. Or, rather, I'm confused
about what happens when one attempts to mix and merge content from
separate branches that don't share ancestry.

Say that I start a branch "project.experiment" in my database with
this file structure:

,----[ project.experiment ]
| ./
| | one.txt
| | two.txt
| +-dir/
|     three.txt
`----

Later, I start another branch afresh called "project.prototype" in the
same database with this file structure:

,----[ project.prototype ]
| ./
|   one.txt
|   four.txt
`----

These two projects on separate branches were conceived as being
independent, but now I realize that I'd like to combine them into a
single source tree (maybe also moving some things around).

Does monotone see any relationship between the two files "./one.txt"?
They are in the same place with the same name with respect to some
root directories, but at their conception these two roots had nothing
to do with one another.

Monotone won't see any relationship until you merge one into the
other. Then it will get a mege conflict when you try to merge them as
they're named the same but do no share any ancestry. This is if you
simply merge them as-is, though.

One way to merge these would be to use merg_into_dir. This allows you
to merge one branch's root into a directory in another branch. So
you'd do:

mtn --db=db.MTN merge_into_dir project.experiment project.prototype experiment

and you'd get:

,----[ project.prototype ]
| ./
|   one.txt
|   four.txt
| +-experiment/
|    one.txt
|    two.txt
|   +-dir/
|      three.txt
`----


Is it possible to merge these two branches? One idea I had to avoid
naming conflicts was to first move most of the content of one branch
under some new root directory, then try merging that into the other
tree to at least get all the files together in the same branch.


This may work, but may also cause merge conflicts as the same named
file will have been moved in one branhc but not in another. I'm not
sure of this, though. If you're going to do it this way merge_into_dir
is likely your best bet.

Obviously, I'm confused about whether a single database can hold many
separate directory trees (with overlapping names), or if all the
branches are just different views of the same shared tree.


They are only "shared" if they have shared ancestry. If you have 2
branches which were not proagated/branched to/from each other then
they are different. If one was branched from another then merging back
in will use the ancestry to try to merge intelligently.


What got me thinking about this is the "deleted stays deleted"
rule. If in my "project.experiment" branch I had at one time created
then discarded a file "five.txt", but I've started using a file in the
"project.prototype" branch also called "five.txt", would merging the
former branch into the latter delete "five.txt" permanently, even
though they were really separate files to begin with?


No, it would cause a merge conflict since they do not have shared ancestry.

--
Justin Patrin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]