[issue2102] hg export and hg import speak different languages

Russ Cox bugs at mercurial.selenic.com
Thu Mar 18 07:09:51 UTC 2010


New submission from Russ Cox <rsc at swtch.com>:

It would be nice if hg export's output could be read with hg import reliably.

$ hg clone http://selenic.com/repo/hg
destination directory: hg
requesting all changes
adding changesets
adding manifests
adding file changes
added 10725 changesets with 21415 changes to 1481 files
updating working directory
1146 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ mkdir /tmp/hgx
hg -R /tmp/hg export -o /tmp/hgx/patch.%n  0:
$ mkdir /tmp/hg1
$ cd /tmp/hg1
$ hg init .
$ hg import /tmp/hgx/patch.*
applying /tmp/hgx/patch.00001
applying /tmp/hgx/patch.00002
...
applying /tmp/hgx/patch.00074
applying /tmp/hgx/patch.00075
[editor popped up to ask for CL description!]
applying /tmp/hgx/patch.00076
applying /tmp/hgx/patch.00077
...
applying /tmp/hgx/patch.00102
applying /tmp/hgx/patch.00103
patching file hgweb.py
Hunk #1 FAILED at 23
Hunk #2 FAILED at 221
2 out of 2 hunks FAILED -- saving rejects to file hgweb.py.rej
abort: patch failed to apply
$  

Adding --git to the export doesn't help.  In this example the
import behaves exactly the same, but sometimes it behaves
differently.

I picked http://selenic.com/repo/hg because it is an example
I thought would be close to home.  The actual repo I was originally
trying this with was http://go.googlecode.com/hg/.

$ hg clone https://go.googlecode.com/hg go1
requesting all changes
adding changesets
adding manifests
adding file changes
added 5071 changesets with 21073 changes to 3408 files
updating working directory
2047 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ mkdir gox
$ hg -R go1 export -o gox/patch.%n 0:
$ hg init go2
$ hg -R go2 import gox/patch.*
applying gox/patch.0001
applying gox/patch.0002
...
applying gox/patch.0045
applying gox/patch.0046
abort: no diffs found
$ 

Okay, let's try with git mode, since patch.0046 corresponds
to a pure permission bit change, with no actual diffs.
It gets past #0046, but now it doesn't like #0404.

$ hg -R go1 export --git -o gox/gpatch.%n 0:
$ hg init go3
$ hg -R go3 import gox/gpatch.*
applying gox/gpatch.0001
applying gox/gpatch.0002
...
applying gox/gpatch.0403
applying gox/gpatch.0404
1 out of 1 hunk ignored -- saving rejects to file lib/place-holder.rej
abort: patch command failed: exited with status 1
$ 

This is all with Mercurial 1.3.1, though it breaks in enough
different ways that it seems likely at least one of them is still
broken in the latest Mercurial.  This would probably be a good
command sequence to include in a torture test to run before a
release.

----------
messages: 12072
nosy: rsc
priority: bug
status: unread
title: hg export and hg import speak different languages

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2102>
____________________________________________________


More information about the Mercurial-devel mailing list