[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: isn't variance adjusted patching horribly dangerous?

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2003-04-09 04:47:30 CEST

Tom Lord <lord@emf.net> writes:

You quote me without using my name. Your quoting style makes it
awkward to distinguish my material from the bits of your material that
you decided to indent. This does not encourage me to participate in
the discussion.

> It boils down to the question: how often should adjacent,
> non-overlapping changes result in a conflict? I prefer the
> answer "never", you appear to prefer "always". I don't
> suppose either of us can prove which is the most likely to be
> correct in the real world.
>
> There is considerable empirical evidence that I'm basically right.

I suspect we may have to agree to disagree.

> For example, for how many years now has the documentation for Larry
> Wall's patch suggested -- what is it ... uh -- three lines of context?
> Or for how many years has that been the default in various versions of
> diff? And in that time, how much folklore has spread around to the
> effect that that's a lousy default and you should override those
> parameters when using those tools?

Traditional patch works without having access to the full text of all
the files involved, it only has one full text. The multiple merge
implied by variance adjusted patching involves access to all the full
texts, the line numbers can be adjusted and the hunks applied without
resorting to the fuzzy context matching used by patch. It's not clear
to me why one would want to use context at all if the full texts are
available.

An example

  # Create a file on the trunk
  rm -rf repo wc
  svnadmin create repo
  svn mkdir -m rev1 file://`pwd`/repo/trunk
  svn checkout file://`pwd`/repo/trunk wc
  printf "foo\nbar\n" > wc/file
  svn add wc/file
  svn commit -m rev2 wc

  # Copy to file to branch
  svn copy -m rev3 file://`pwd`/repo/trunk file://`pwd`/repo/branch

  # Commit a trunk change
  printf "foo2\nbar\n" > wc/file
  svn commit -m rev4 wc

  # Commit a branch change
  svn switch file://`pwd`/repo/branch wc
  printf "foo\nbar2\n" > wc/file
  svn commit -m rev5 wc
  svn switch file://`pwd`/repo/trunk wc

  # Local, uncommitted trunk change
  printf "zig\nfoo2\nbar\n" > wc/file

So now I have a local, uncommitted change

svn diff wc/file
Index: wc/file
===================================================================
--- wc/file (revision 5)
+++ wc/file (working copy)
@@ -1,2 +1,3 @@
+zig
 foo2
 bar

and a change on the branch

svn diff -r4:5 file://`pwd`/repo/branch/file
Index: file
===================================================================
--- file (revision 4)
+++ file (revision 5)
@@ -1,2 +1,2 @@
 foo
-bar
+bar2

Running Subversion's builtin merge

svn merge -r4:5 file://`pwd`/repo/branch wc

produces the result

cat wc/file
zig
foo2
bar2

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Apr 9 04:48:13 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.