Re: applying hunks in svn patch

2009-11-18 Thread Stefan Sperling
On Wed, Nov 18, 2009 at 08:28:33PM +0200, Alan Barrett wrote: > On Wed, 18 Nov 2009, Stefan Sperling wrote: > > On Wed, Nov 18, 2009 at 08:47:51AM +0200, Alan Barrett wrote: > > > On Mon, 16 Nov 2009, Stefan Sperling wrote: > > > > 5) Hunks are only applied if they do not overlap with any other h

Re: applying hunks in svn patch

2009-11-18 Thread Alan Barrett
On Wed, 18 Nov 2009, Stefan Sperling wrote: > On Wed, Nov 18, 2009 at 08:47:51AM +0200, Alan Barrett wrote: > > On Mon, 16 Nov 2009, Stefan Sperling wrote: > > > 5) Hunks are only applied if they do not overlap with any other hunk. > > Other patch implementations are able to deal with overlapping

Re: applying hunks in svn patch

2009-11-18 Thread Daniel Shahaf
Stefan Sperling wrote on Wed, 18 Nov 2009 at 15:30 +0100: > On Wed, Nov 18, 2009 at 04:16:19PM +0200, Daniel Shahaf wrote: > > Stefan Sperling wrote on Wed, 18 Nov 2009 at 15:08 +0100: > > > On Wed, Nov 18, 2009 at 03:24:10PM +0200, Daniel Shahaf wrote: > > > > In this case, how about losing the "G

Re: applying hunks in svn patch

2009-11-18 Thread Stefan Sperling
On Wed, Nov 18, 2009 at 08:47:51AM +0200, Alan Barrett wrote: > On Mon, 16 Nov 2009, Stefan Sperling wrote: > > 5) Hunks are only applied if they do not overlap with any other hunk. > > Other patch implementations are able to deal with overlapping hunks. > > For example, consider this pair of hu

Re: applying hunks in svn patch

2009-11-18 Thread Stefan Sperling
On Wed, Nov 18, 2009 at 04:16:19PM +0200, Daniel Shahaf wrote: > Stefan Sperling wrote on Wed, 18 Nov 2009 at 15:08 +0100: > > On Wed, Nov 18, 2009 at 03:24:10PM +0200, Daniel Shahaf wrote: > > > In this case, how about losing the "GROUP BY hunk" from the sort? i.e., > > > > > > BIG_LIST = []

Re: applying hunks in svn patch

2009-11-18 Thread Daniel Shahaf
Stefan Sperling wrote on Wed, 18 Nov 2009 at 15:08 +0100: > On Wed, Nov 18, 2009 at 03:24:10PM +0200, Daniel Shahaf wrote: > > In this case, how about losing the "GROUP BY hunk" from the sort? i.e., > > > > BIG_LIST = [] > > for each hunk: > > for each candidate in hunk: > >

Re: applying hunks in svn patch

2009-11-18 Thread Stefan Sperling
On Wed, Nov 18, 2009 at 03:24:10PM +0200, Daniel Shahaf wrote: > In this case, how about losing the "GROUP BY hunk" from the sort? i.e., > > BIG_LIST = [] > for each hunk: > for each candidate in hunk: > compute a score for candidate > BIG_LIST.append(candi

Re: applying hunks in svn patch

2009-11-18 Thread Daniel Shahaf
Stefan Sperling wrote on Wed, 18 Nov 2009 at 09:57 +0100: > On Wed, Nov 18, 2009 at 12:41:37AM +0200, Daniel Shahaf wrote: > > Stefan Sperling wrote on Tue, 17 Nov 2009 at 09:16 +0100: > > > On Mon, Nov 16, 2009 at 11:31:12PM +0200, Daniel Shahaf wrote: > > > > i.e., iterate all 1st candidates, the

Re: applying hunks in svn patch

2009-11-18 Thread Stefan Sperling
On Wed, Nov 18, 2009 at 10:03:05AM +, Julian Foad wrote: > Alan Barrett wrote: > > By the way, patch(1) is described in > > . > > The algorithm described under "Patch Application" there is the minimal > requirement, and is rea

Re: applying hunks in svn patch

2009-11-18 Thread Julian Foad
Alan Barrett wrote: > On Tue, 17 Nov 2009, Julian Foad wrote: > > Stefan Sperling wrote: > > > 3) Hunks matching at or near their original offset in the target > > > file are always preferred over hunks matching at the same > > > location but with a greater offset relative to their origina

Re: applying hunks in svn patch

2009-11-18 Thread Stefan Sperling
On Wed, Nov 18, 2009 at 12:41:37AM +0200, Daniel Shahaf wrote: > Stefan Sperling wrote on Tue, 17 Nov 2009 at 09:16 +0100: > > On Mon, Nov 16, 2009 at 11:31:12PM +0200, Daniel Shahaf wrote: > > > Stefan Sperling wrote on Mon, 16 Nov 2009 at 14:39 +0100: > > > > Let C represent the current index int

Re: applying hunks in svn patch

2009-11-17 Thread Alan Barrett
On Tue, 17 Nov 2009, Julian Foad wrote: > Stefan Sperling wrote: > > 3) Hunks matching at or near their original offset in the target > > file are always preferred over hunks matching at the same > > location but with a greater offset relative to their original > > offset. > > Would I

Re: applying hunks in svn patch

2009-11-17 Thread Alan Barrett
On Mon, 16 Nov 2009, Stefan Sperling wrote: > Julian asked for a formal description of how 'svn patch' applies > hunks. By the way, patch(1) is described in . The description does not mention unidiff format, but appears to match t

Re: applying hunks in svn patch

2009-11-17 Thread Alan Barrett
On Mon, 16 Nov 2009, Stefan Sperling wrote: > 5) Hunks are only applied if they do not overlap with any other hunk. Other patch implementations are able to deal with overlapping hunks. For example, consider this pair of hunks on the left, and a corresponding single hunk on the right: @@

Re: applying hunks in svn patch

2009-11-17 Thread Daniel Shahaf
Stefan Sperling wrote on Tue, 17 Nov 2009 at 09:16 +0100: > On Mon, Nov 16, 2009 at 11:31:12PM +0200, Daniel Shahaf wrote: > > Stefan Sperling wrote on Mon, 16 Nov 2009 at 14:39 +0100: > > > Let C represent the current index into the lists of candidate offsets. > > > Set C = 1 (indexing the first c

Re: applying hunks in svn patch

2009-11-17 Thread Julian Foad
Stefan Sperling wrote: > Julian asked for a formal description of how 'svn patch' applies > hunks. Below are my current plans. The current code does something > quite different and will be changed to implement what is described > below before 1.7 release. > > Any feedback appreciated. Hi Stefan.

Re: applying hunks in svn patch

2009-11-17 Thread Stefan Sperling
On Mon, Nov 16, 2009 at 11:31:12PM +0200, Daniel Shahaf wrote: > Stefan Sperling wrote on Mon, 16 Nov 2009 at 14:39 +0100: > > The goals of the hunk-application algorithm are: > > 1) Memory usage is bound by the longest line occurring in the patch file > > "bounded" sbutler agrees (and he's amer

Re: applying hunks in svn patch

2009-11-16 Thread Daniel Shahaf
Stefan Sperling wrote on Mon, 16 Nov 2009 at 14:39 +0100: > Julian asked for a formal description of how 'svn patch' applies > hunks. Below are my current plans. The current code does something > quite different and will be changed to implement what is described > below before 1.7 release. Okay, g

applying hunks in svn patch

2009-11-16 Thread Stefan Sperling
Julian asked for a formal description of how 'svn patch' applies hunks. Below are my current plans. The current code does something quite different and will be changed to implement what is described below before 1.7 release. Any feedback appreciated. Stefan This note is a high-level description