Q: mergemaster 'm'-merge option results in empty file

Matthew Seaman m.seaman at infracaninophile.co.uk
Sun Sep 14 09:01:45 PDT 2003


On Sun, Sep 14, 2003 at 08:46:52PM +0900, Rob Lahaye wrote:

> What is left and right in the mergemaster context???
> 'man sdiff' doesn't seem to help out here.
> I've tried a bit (I typed 'v' and 'q'), but then found /etc/hosts
> totally empty!!
> 
> Any idea where I went wrong?

'sdiff' does a side-by-side comparison of two files, and lets you
generate a file where some or all of those differences have been
merged together.  'left' and 'right' in this context refer to the two
columns that sdiff divides the screen into, where it shows you the
blocks of lines that differ between the two files you're comparing.

Perhaps an example is in order.  Run these commands to get two
different versions of the GENERIC kernel configuration from cvs:

    # cd /tmp
    # fetch -o GENERIC-CURRENT 'http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/sys/i386/conf/GENERIC?rev=1.246.2.51.2.2&content-type=text/plain'
    # fetch -o GENERIC-STABLE 'http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/sys/i386/conf/GENERIC?rev=1.246.2.54&content-type=text/plain'

(As the names suggest, those are just the latest versions from the
HEAD and RELENG_4 branches)

Now, assuming you're in an xterm or similar, stretch the window until
it is at least 160 characters wide.  If you're in a fixed width
window, substitute the width of the window for the number after '-w'
below.  It's clearer to see what's going on if you can use as wide a
screen as possible.  Now run:

    # setenv EDITOR=vi
    # sdiff -o GENERIC.n -s -w 160 GENERIC-STABLE GENERIC-CURRENT

The first output you will see is:

# $FreeBSD: /repoman/r/ncvs/src/sys/i386/conf/GENERIC,v 1.246.2.54 2003/04/28 | # $FreeBSD: /repoman/r/ncvs/src/sys/i386/conf/GENERIC,v 1.246.2.51.2.2 2003/0
%

(Which probably won't make a lot of sense unless your mail client
doesn't automatically wrap long lines and you happen to be reading
this in a fairly wide screen)

What this is doing is asking which $FreeBSD$ tag should go into the
merged file.  Choose 'l' for the left-hand version, which comes from
GENERIC-STABLE. If you're in a narrow window, you probably can't
see the difference between those two lines as it's too far over to be
displayed.

The next chunk looks like:

                                                                              <
# FireWire support                                                            <
device          firewire        # FireWire bus code                           <
device          sbp             # SCSI over FireWire (Requires scbus and da)  <
device          fwe             # Ethernet over FireWire (non-standard!)      <
%

because the firewire support is only in the GENERIC-STABLE kernel config.

Here, choose 'r' for the right hand version which comes from
GENERIC-CURRENT.

What you should end up with is a new file GENERIC.n where:

% diff -u GENERIC-STABLE GENERIC.n
--- GENERIC-STABLE      Mon Apr 28 04:41:46 2003
+++ GENERIC.n   Sun Sep 14 16:51:22 2003
@@ -264,8 +264,3 @@
 device         aue             # ADMtek USB ethernet
 device         cue             # CATC USB ethernet
 device         kue             # Kawasaki LSI USB ethernet
-
-# FireWire support
-device         firewire        # FireWire bus code
-device         sbp             # SCSI over FireWire (Requires scbus and da)
-device         fwe             # Ethernet over FireWire (non-standard!)

and

% diff -u GENERIC-CURRENT GENERIC.n
--- GENERIC-CURRENT        Tue Mar 25 23:35:15 2003
+++ GENERIC.n   Sun Sep 14 16:51:22 2003
@@ -15,7 +15,7 @@
 # device lines is also present in the ./LINT configuration file. If you are
 # in doubt as to the purpose or necessity of a line, check first in LINT.
 #
-# $FreeBSD: /repoman/r/ncvs/src/sys/i386/conf/GENERIC,v 1.246.2.51.2.2 2003/03/25 23:35:15 jhb Exp $
+# $FreeBSD: /repoman/r/ncvs/src/sys/i386/conf/GENERIC,v 1.246.2.54 2003/04/28 03:41:46 simokawa Exp $
 
 machine                i386
 cpu            I386_CPU


One thing that may trip you up: don't set your $EDITOR variable to
'emacs' -- because of the way emacs works by immediately copying the
temporary file sdiff(1) generates, and renaming the original as a
backup, it confuses sdiff(1), and you won't see any of your edits in
the output.  vi(1) just works directly on the temporary file and all
is well.  

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20030914/f0cb6f43/attachment.bin


More information about the freebsd-questions mailing list