[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] Re: Something wrong with mtn diff, with changes close t
From: |
Bruce Stephens |
Subject: |
[Monotone-devel] Re: Something wrong with mtn diff, with changes close to beginning of file? |
Date: |
Thu, 12 Apr 2007 22:50:53 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (gnu/linux) |
"Zack Weinberg" <address@hidden> writes:
> On 4/12/07, Bruce Stephens <address@hidden> wrote:
>>
>> Often, when I've used "mtn diff" to generate patches, the dependencies
>> fail to apply with GNU patch.
>>
>> Here's an example hunk which fails:
> ...
>> @@ -1,12 +1,14 @@ DSAP_Lsnr.o : ../../../../h/isode/asn1/I
> ...
>> @@ -4,9 +4,11 @@
>
> I think the problem is here. There should be exactly the same number
> of lines of leading and trailing context.
>
> Why monotone is doing that I couldn't tell you, but perhaps that gives
> enough of a clue for someone to go looking...
Hmm, mostly by messing about, how about the attached? (Testing
involves
<http://www.codinghorror.com/blog/archives/2007_03.html#000818>.)
Context diffs may well want something similar: I also find those fail
in these circumstances.
#
# old_revision [3fcea0ffc78cad2a9013f0f20f7333804ef14cc9]
#
# patch "diff_patch.cc"
# from [5437f74550a59622f0aca36b00dd43f104b7692a]
# to [cf3e91200ebfdd8c56aa01b925296f017d1a917b]
#
============================================================
--- diff_patch.cc 5437f74550a59622f0aca36b00dd43f104b7692a
+++ diff_patch.cc cf3e91200ebfdd8c56aa01b925296f017d1a917b
@@ -1012,6 +1012,10 @@ void unidiff_hunk_writer::advance_to(siz
}
else
{
+ // This affects the very first hunk, maybe: trim off excess context
+ if (newpos - a_begin > ctx)
+ a_begin = newpos - ctx;
+
// pad intermediate context
while(a_begin + a_len < newpos)
{