monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] usage question


From: Jack Cummings
Subject: Re: [Monotone-devel] usage question
Date: Tue, 13 Feb 2007 00:35:10 -0800
User-agent: Mutt/1.4.1i

On Mon, Feb 12, 2007 at 03:31:50PM -0800, Arthur A. Gleckler wrote:
 
> Because all of my files have existed since before I started using  
> Monotone, I have multiple versions of the same file.  

[snip]
 
> What's the right way to proceed here?  

Right now the problem is that monotone thinks you are trying to merge two
completely different files that happen to have the same name. This probably
isn't what you want. 

What you want to do is merge the content of two files. One way to do that is to
synthesize some ancestry for the files you want to merge. It doesn't need to be
much, you just need to tell monotone that the two files are descended from the
same ancestor. When monotone knows you are trying merge files with a common
ancestor, then it will try to merge their contents. 

Here's how you'd do that:
    add an empty copy of the config file to a base revision
    commit the file (this is the "base" revision)
    copy one version of the config file into the workspace
    commit the changes (this is one head)
    "update" back to the base revision
    copy another version of the config file into the workspace
    commit the changes (this is the other head)

At this point monotone will tell you that you have committed a change that
creates divergence, and that you should probably run "merge" to fix that. 

Here's a transcript:

==============================
address@hidden:force_content_merge]$ mtn --db=db/com.example.mtn db init
address@hidden:force_content_merge]$ mtn --db=db/com.example.mtn 
--branch=com.example.force_content_merge setup ws
address@hidden:force_content_merge]$ cd ws

# setup a workspace..

address@hidden:ws]$ touch foo
address@hidden:ws]$ mtn add foo
mtn: adding foo to workspace manifest
address@hidden:ws]$ mtn commit -m"create ancestor"
mtn: beginning commit on branch 'com.example.force_content_merge'
mtn: committed revision 7f8ceb7179e3f69cebec393ff687c33792a5a4bf

# we've created the base revision. 

address@hidden:ws]$ cp ~/.vimrc foo
address@hidden:ws]$ mtn commit -m"adding one head"
mtn: beginning commit on branch 'com.example.force_content_merge'
mtn: committed revision 2c8d4bb950bca69442f3d4a210f9a6cf4411cdfc

# we've created one of the heads

address@hidden:ws]$ mtn update -r 7f8ceb7179e3f
mtn: expanded selector '7f8ceb7179e3f' -> 'i:7f8ceb7179e3f'
mtn: expanding selection '7f8ceb7179e3f'
mtn: expanded to '7f8ceb7179e3f69cebec393ff687c33792a5a4bf'
mtn: selected update target 7f8ceb7179e3f69cebec393ff687c33792a5a4bf
mtn: modifying foo
mtn: updated to base revision 7f8ceb7179e3f69cebec393ff687c33792a5a4bf

# we've reverted back to the base revision

address@hidden:ws]$ cp ~/.vimrc2 foo
address@hidden:ws]$ vim foo
address@hidden:ws]$ mtn commit -m"adding the other head"
mtn: beginning commit on branch 'com.example.force_content_merge'
mtn: committed revision a5dd92ce8dfd73cee61bf716749951fb16aefff3
mtn: note: this revision creates divergence
mtn: note: you may (or may not) wish to run 'mtn merge'
==============================

At this point, if you you run "mtn merge", you'll get a merge tool and get to
patch together the contents of the file. 

> Is there a way to have Monotone prompt me to merge just the files that don't
> match, running a manual merge tool as necessary?  

> Is there any problem starting with two versions of a file that don't, in
> fact, have a common ancestor in  Monotone?

Just because two files have the same name, Monotone does not assume that they
are related. The only way that it will decide that files are related is if they
have a common ancestor. 

Cheers, 

--Jack 

--
Jack (John) Cummings                           http://mudshark.org/
PGP fingerprint: 0774 D073 E386 B70B 6B16  2D2B 1DD8 F8B0 CCF0 FAEE




reply via email to

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