git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: little conundrum

From
Petr Baudis <pasky@suse.cz>
Date
Nov 3, 2005, 20:06 UTC
Message-ID
<20051103200631.GJ1431@pasky.or.cz>
In-Reply-To
<200511031741.20496.alan@chandlerfamily.org.uk>

Dear diary, on Thu, Nov 03, 2005 at 06:41:20PM CET, I got a letter where Alan Chandler <alan@chandlerfamily.org.uk> told me that...

Show 12 quoted lines
> Since I don't actually have a list of the files, I thought I would establish 
> these automatically by going into each directory and doing a cg-init.  So I 
> now have two disjoint repositories each with their source tree in it.
> 
> My next thought was to add a branch to one of them and then pull the resultant 
> code over and merge it using cg-branch-add followed by a cg-update.  But when 
> I do that it complains that there is no common base.  
> 
> I tried creating an empty directory and separately merging the two versions 
> with it, so that I have a common parent, but whatever I do, I can't get one 
> of those nice little gitk diagrams that has any linkage between the two 
> versions of the source code.

The empty directory is the good approach to do the merge, but you are going to get a huge number of conflicts. Anyway, this is probably the most sensible behaviour for cg-merge, so I added cg-merge -j which does exactly that - use empty tree as a base for three-way merge.

But you actually do not want to do a merge, but:
	$ cd original-version
	$ cg-init
	$ cd ../modified-version
	$ cg-init
	$ cg-branch-add orig ../original-version
	$ cg-fetch orig
	$ echo `cg-object-id` `cg-object-id orig` >.git/info/grafts

Voila, now your commit in 'modified' has the commit in 'original' as its parent.

PS: And to be able to even commit the cg-merge -j, I had to back out the
git-read-tree -u usage in cg-Xlib's tree_timewarp, which made it racy as
hell - basically, it could be argued that it working _properly_ would be
a race now. Besides, keeping local changes wouldn't work, and stuff.
cg-admin-uncommit was painfully broken.
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.
Previous: Peter EriksenNext: Alan Chandler
Message 11 of 12 in “little conundrum”
  1. Alan ChandlerNov 3, 2005
  2. Johannes SchindelinNov 3, 2005
  3. Peter EriksenNov 3, 2005
  4. Alan ChandlerNov 3, 2005
  5. Johannes SchindelinNov 4, 2005
  6. Peter EriksenNov 3, 2005
  7. Alan ChandlerNov 3, 2005
  8. Peter EriksenNov 3, 2005
  9. Alan ChandlerNov 3, 2005
  10. Peter EriksenNov 3, 2005
  11. Petr BaudisNov 3, 2005
  12. Alan ChandlerNov 3, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.