🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.linux.misc
Article #1224

Re: version control - complicated diff usage

#1224
From: Steve Peltz
Date: Wed, 17 Mar 1999 00:00
46 lines
2479 bytes
In article <slrn7etn9v.jq9.aa126@fan1.fan.nb.ca>,
William Burrow <aa126@DELETE.fan.nb.ca> wrote:
>This routine actually failed to correctly apply the update, though
>it successfully completed.  I would suggest that the failure was due
>to a lack of context (patch will search for blocks meeting some
>context and apply the changes as it sees fit, unfortunately, the
>section used for context for my test was likely too small.)
>
>This problem may be harder than it first seems.  

Use diff3, typically using 

	diff3 -mE file ancestor changes

(the -m option is specific to the GNU version of diff3)

v1.0 -- v1.0.1
  |        |   (patch 1)
  |     v1.0.2
  |
v1.1 -- v1.1.1
  |
v1.2 -- v1.2.1
  |       |    (patch 2)
v1.3    v1.2.2

Let's say, in the above tree, you made some changes from v1.0.1 to v1.0.2
and some changes from v1.2.1 to v1.2.2, and you want to apply those same
changes to v1.1.1 (resulting in v1.1.2), e.g. you want to apply patch 1 and
patch 2 to v1.1.1)

diff3 -mE v1.0 v1.0.1 v1.0.2 > file-1 (apply patch 1 to v1.0)
diff3 -mE v1.1 v1.0 file-1 > file-2   (apply patch 1 to v1.1)
diff3 -mE v1.2 v1.2.1 v1.2.2 > file-3 (apply patch 2 to v1.2)
diff3 -mE v1.1 v1.2 file-3 > file-4   (apply patch 2 to v1.1)
diff3 -mE file-2 v1.1 file-4 > file-5 (apply patch 2 to v1.1 patched with 1)
diff3 -mE v1.1.1 v1.1 file-5 > v1.1.2

You could eliminate some of the steps, e.g. you could use

	diff3 -mE v1.1 v1.0.1 v1.0.2 > file-2
	diff3 -mE v1.1 v1.2.1 v1.2.2 > file-4

and skip creating file-1 and file-3, but if there are conflicts it is
probably easier to go one version at a time. If there are conflicts at
any step, you need to resolve them before going on.
Technical Details
Message-ID: <7cpd5c$q3a$1@harbinger.nn.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36E661D4.D192F5D3@ee.ed.ac.uk> <36E70D58.14D191BF@mincom.com> <slrn7etn9v.jq9.aa126@fan1.fan.nb.ca>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1025b4,3ddeb2681666593e
X-Google-Attributes: gid1025b4,public
X-Google-Thread: 1103af,3ddeb2681666593e
X-Google-Attributes: gid1103af,public
X-Google-Thread: 1107b1,3ddeb2681666593e
X-Google-Attributes: gid1107b1,public
X-Google-Thread: 106243,3ddeb2681666593e
X-Google-Attributes: gid106243,public
From: peltz@medusa.nn.com (Steve Peltz)
Subject: Re: version control - complicated diff usage
Date: 1999/03/17
Message-ID: <7cpd5c$q3a$1@harbinger.nn.com>
X-Deja-AN: 455917763
References: <36E661D4.D192F5D3@ee.ed.ac.uk> <36E70D58.14D191BF@mincom.com> <slrn7etn9v.jq9.aa126@fan1.fan.nb.ca>
Organization: NovaNET
Newsgroups: comp.os.linux.misc,gnu.misc.discuss,comp.emacs.xemacs,ed.linux