9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] OT -  CVS-like merge for dumpfs / relica with sources
@ 2002-11-26 12:08 steve.simon
  2002-11-26 13:40 ` Lucio De Re
  2002-11-26 15:55 ` andrey mirtchovski
  0 siblings, 2 replies; 5+ messages in thread
From: steve.simon @ 2002-11-26 12:08 UTC (permalink / raw)
  To: 9fans

Hi,

Any ideas on a script to do a CVS like merge of two
incompatable versions (overlapping changes)
of a file in the dump filesystem.

I assume this is fairly easy using just diff/awk/sed etc
but I cannot see how to do it...

This would also be handy when doing a replica only to discover that
"the labs" (tm) has fixed parts of a file you are also working on and you
want to merge their changes with yours...

-Steve



^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [9fans] OT -  CVS-like merge for dumpfs / relica with sources
@ 2002-11-26 12:44 rog
  0 siblings, 0 replies; 5+ messages in thread
From: rog @ 2002-11-26 12:44 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 683 bytes --]

> Any ideas on a script to do a CVS like merge of two
> incompatable versions (overlapping changes)
> of a file in the dump filesystem.

i use the gnu version of diff3, and a little script called "merge"
(which i've attached).

then when i've made changes on my home laptop that
i want to merge in with the current source, i use (e.g.)

	merge -n 5 /n/kfs/usr/rog/xx/*.c /usr/rog/xx

the options are exactly those taken by yesterday(1).

you have to be a little careful, as merging is not idempotent.
(but conflicts are flagged, so it's not too bad).

nigel@9fs.org did the diff3 port and suggested how to use it.
i think he's got the port.

  cheers,
    rog.

[-- Attachment #2: merge --]
[-- Type: text/plain, Size: 535 bytes --]

#!/bin/rc

fn usage {
	echo usage: merge [-n days] file.... dir
	echo '	'merge [-n days] file1 file2
}

fn domerge {
	echo gnu/diff3 -m $1 `{yesterday $opts $2} $2
	gnu/diff3 -m $1 `{yesterday $opts $2} $2 > $2.xxx
	cp $2.xxx $2 && rm $2.xxx
}

opts=()
while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 --){
	opts=($opts $1)
	shift
}
if(! ~ $#* 0 && ~ $1 --)
	shift
if(~ $#* 0 1)
	usage
if(test -d $$#*) {
	d=$$#*
	while(! ~ $#* 1) {
		domerge $1 $d/$1
		shift
	}
}
if not {
	if (! ~ $#* 2)
		usage
	domerge $1 $2
}

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [9fans] OT -  CVS-like merge for dumpfs / relica with sources
@ 2002-11-27  0:11 Geoff Collyer
  0 siblings, 0 replies; 5+ messages in thread
From: Geoff Collyer @ 2002-11-27  0:11 UTC (permalink / raw)
  To: 9fans

I use idiff(1).  It's not automatic, but it's simple and easy.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-11-27  0:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-26 12:08 [9fans] OT - CVS-like merge for dumpfs / relica with sources steve.simon
2002-11-26 13:40 ` Lucio De Re
2002-11-26 15:55 ` andrey mirtchovski
2002-11-26 12:44 rog
2002-11-27  0:11 Geoff Collyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).