Patchwork convert: handle deleted files when converting from Perforce (issue4743)

login
register
mail settings
Submitter Matt Mackall
Date July 8, 2015, 6:34 p.m.
Message ID <1436380454.19364.211.camel@selenic.com>
Download mbox | patch
Permalink /patch/9926/
State Accepted
Commit 501c51d607922692bd6654cb3c24d9f1e31d7450
Headers show

Comments

Matt Mackall - July 8, 2015, 6:34 p.m.
On Wed, 2015-07-08 at 09:49 +0100, Eugene Baranov wrote:
> Hmm, I think something went wrong when importing changeset since for
> some reason https://selenic.com/repo/hg/rev/97fd07e38b83 doesn't
> actually contain any changes: "diffstat0 files changed, 0
> insertions(+), 0 deletions(-)"

Indeed! You've discovered an "interesting" problem:

$ hg import --debug -v ~/patches/convert-handle-deleted-files-when-converting-from.patch
applying /home/mpm/patches/convert-handle-deleted-files-when-converting-from.patch
Subject: 

Content-Type: text/plain
found patch at byte 320
patch generated by hg export
From: Eugene Baranov <eug.baranov@gmail.com>
message:
convert: handle deleted files when converting from Perforce (issue4743)
patching file hgext/convert/p4.py
applied to working directory

$ patch -p1 < ~/patches/convert-handle-deleted-files-when-converting-from.patch
patching file hgext/convert/p4.py
patch: **** malformed patch at line 14:                  raise IOError(d["generic"], data)

So looks like our patch importer is quietly dropping things where patch
complains. But what's wrong with the patch? Turns out the patch I'm
trying to apply looks like this:

Mercurial-devel@selenic.com
https://selenic.com/mailman/listinfo/mercurial-devel
Matt Mackall - July 8, 2015, 7:01 p.m.
On Wed, 2015-07-08 at 13:34 -0500, Matt Mackall wrote:
> On Wed, 2015-07-08 at 09:49 +0100, Eugene Baranov wrote:
> > Hmm, I think something went wrong when importing changeset since for
> > some reason https://selenic.com/repo/hg/rev/97fd07e38b83 doesn't
> > actually contain any changes: "diffstat0 files changed, 0
> > insertions(+), 0 deletions(-)"
> 
> Indeed! You've discovered an "interesting" problem:
> 
> $ hg import --debug -v ~/patches/convert-handle-deleted-files-when-converting-from.patch
> applying /home/mpm/patches/convert-handle-deleted-files-when-converting-from.patch
> Subject: 
> 
> Content-Type: text/plain
> found patch at byte 320
> patch generated by hg export
> From: Eugene Baranov <eug.baranov@gmail.com>
> message:
> convert: handle deleted files when converting from Perforce (issue4743)
> patching file hgext/convert/p4.py
> applied to working directory
> 
> $ patch -p1 < ~/patches/convert-handle-deleted-files-when-converting-from.patch
> patching file hgext/convert/p4.py
> patch: **** malformed patch at line 14:                  raise IOError(d["generic"], data)
> 
> So looks like our patch importer is quietly dropping things where patch
> complains. But what's wrong with the patch? Turns out the patch I'm
> trying to apply looks like this:
> 
> --- a/hgext/convert/p4.py                                                                                                                                                                                                                      
> +++ b/hgext/convert/p4.py                                                                                                                                                                                                                      
> @@ -164 +164 @@
> 
> ..while the patch you sent looks like this:
> 
> --- a/hgext/convert/p4.py                                                                                                                                                                                                                      
> +++ b/hgext/convert/p4.py                                                                                                                                                                                                                      
> @@ -164,7 +164,8 @@
> 
> ..which is apparently caused by a bug in the recountdiff tool my scripts
> use in case I edit a patch in flight.

Actually, the issue is that the second line of your diff as received is
empty (rather than containing a single space). Many modern email clients
helpfully mangle whitespace whenever possible, which makes all the patch
tools unhappy.

I'll fix this up locally. Please checkout the patchbomb extension or
pushgate for ways of reliably sending diffs.
Eugene Baranov - July 8, 2015, 7:03 p.m.
It felt like my first Mercurial patch was special in some way. :)

On 8 July 2015 at 19:34, Matt Mackall <mpm@selenic.com> wrote:
> On Wed, 2015-07-08 at 09:49 +0100, Eugene Baranov wrote:
>> Hmm, I think something went wrong when importing changeset since for
>> some reason https://selenic.com/repo/hg/rev/97fd07e38b83 doesn't
>> actually contain any changes: "diffstat0 files changed, 0
>> insertions(+), 0 deletions(-)"
>
> Indeed! You've discovered an "interesting" problem:
>
> $ hg import --debug -v ~/patches/convert-handle-deleted-files-when-converting-from.patch
> applying /home/mpm/patches/convert-handle-deleted-files-when-converting-from.patch
> Subject:
>
> Content-Type: text/plain
> found patch at byte 320
> patch generated by hg export
> From: Eugene Baranov <eug.baranov@gmail.com>
> message:
> convert: handle deleted files when converting from Perforce (issue4743)
> patching file hgext/convert/p4.py
> applied to working directory
>
> $ patch -p1 < ~/patches/convert-handle-deleted-files-when-converting-from.patch
> patching file hgext/convert/p4.py
> patch: **** malformed patch at line 14:                  raise IOError(d["generic"], data)
>
> So looks like our patch importer is quietly dropping things where patch
> complains. But what's wrong with the patch? Turns out the patch I'm
> trying to apply looks like this:
>
> --- a/hgext/convert/p4.py
> +++ b/hgext/convert/p4.py
> @@ -164 +164 @@
>
> ..while the patch you sent looks like this:
>
> --- a/hgext/convert/p4.py
> +++ b/hgext/convert/p4.py
> @@ -164,7 +164,8 @@
>
> ..which is apparently caused by a bug in the recountdiff tool my scripts
> use in case I edit a patch in flight.
>
> --
> Mathematics is the supreme nostalgia of our time.
>

Patch

--- a/hgext/convert/p4.py                                                                                                                                                                                                                      
+++ b/hgext/convert/p4.py                                                                                                                                                                                                                      
@@ -164 +164 @@ 

..while the patch you sent looks like this:

--- a/hgext/convert/p4.py                                                                                                                                                                                                                      
+++ b/hgext/convert/p4.py                                                                                                                                                                                                                      
@@ -164,7 +164,8 @@ 

..which is apparently caused by a bug in the recountdiff tool my scripts
use in case I edit a patch in flight.

-- 
Mathematics is the supreme nostalgia of our time.

_______________________________________________
Mercurial-devel mailing list