More info on import/export?

John D. Mitchell jdmitchell at gmail.com
Sun Sep 3 23:04:39 UTC 2006


On 9/2/06, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> On 2006-09-02 18:10, "John D. Mitchell" <jdmitchell at gmail.com> wrote:
> >On 9/2/06, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> >>On 2006-09-02 14:52, "John D. Mitchell" <jdmitchell at gmail.com> wrote:
> >>> Is there more information on the export/import process?  I've
> >>> been trying it but getting weird errors and I'm assuming that
> >>> I'm just missing something.
> >>
> >> Can you show us what you tried, what you expected to do and what
> >> failed in your tests?
> >>
> >> It may be that the documentation of export/import is not
> >> adequate, and we can 'fix' the problems you are having by
> >> documenting more extensively how these commands work.
> >
> > I went through the tutorial on the wiki. Then I decided to play with
> > other commands such as tag, remove, and rename.
> >
> > Basically, I tagged one changeset, removed the Makefile, and renamed
> > hello.c to goodbye.c.
>
> I think tags are not handled very-well by import/export right now, but I
> may be wrong.  I'll have to investigate a bit more the way export/import
> works with tags to see if this is a bug or just an unfortunate but
> expected interaction of tagging and import/export.

Okay, I went back through the tutorial and at least some of the things
that I had done in playing around.  I wasn't able to recreate the
problem precisely but I still run into an import problem.

Herein is the full blow by blow.  If you want a copy of the actual
repositories, etc., let me know and I'll send them directly.

My comments are in [].  Hope this make sense.


% md hg-hello-tests
% cd !$
% hg clone http://www.selenic.com/repo/hello my-hello
requesting all changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 2 files
2 files updated, 0 files merged, 0 files removed, 0 files unresolved

% cd !$
% hg log -v
changeset:   1:82e55d328c8ca4ee16520036c0aaace03a5beb65
tag:         tip
user:        mpm at selenic.com
date:        Fri Aug 26 01:21:28 2005 -0700
files:       Makefile
description:
Create a makefile


changeset:   0:0a04b987be5ae354b710cefeba0e2d9de7ad41a9
user:        mpm at selenic.com
date:        Fri Aug 26 01:20:50 2005 -0700
files:       hello.c
description:
Create a standard "hello, world" program

% hg tip -v
changeset:   1:82e55d328c8ca4ee16520036c0aaace03a5beb65
tag:         tip
user:        mpm at selenic.com
date:        Fri Aug 26 01:21:28 2005 -0700
files:       Makefile
description:
Create a makefile

% cd ..
% hg clone my-hello my-hello-new-output
2 files updated, 0 files merged, 0 files removed, 0 files unresolved

% cd !$
% emacs hello.c
[Change printf to puts.]
% hg status
M hello.c

% hg diff
diff -r 82e55d328c8c hello.c
--- a/hello.c   Fri Aug 26 01:21:28 2005 -0700
+++ b/hello.c   Sun Sep 03 13:27:05 2006 -0700
@@ -11,6 +11,6 @@

 int main(int argc, char **argv)
 {
-       printf("hello, world!\n");
+       puts("hello, world!\n");
        return 0;
 }

% hg commit
% hg status
% hg tip -v
changeset:   2:9d8ef585355e39bb7501a287cb733a2659e19f57
tag:         tip
user:        John D. Mitchell <john at mitchell.org>
date:        Sun Sep 03 13:29:06 2006 -0700
files:       hello.c
description:
Why do people use printf instead of puts for simple strings? :-)

% cd ..
% hg clone my-hello my-hello-share
2 files updated, 0 files merged, 0 files removed, 0 files unresolved

% cd !$
% hg pull ../my-hello-new-output/
pulling from ../my-hello-new-output/
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)

% hg update
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

% hg tip -v
changeset:   2:9d8ef585355e39bb7501a287cb733a2659e19f57
tag:         tip
user:        John D. Mitchell <john at mitchell.org>
date:        Sun Sep 03 13:29:06 2006 -0700
files:       hello.c
description:
Why do people use printf instead of puts for simple strings? :-)


[Here's where I go off-script and do some other stuff.]

% hg tag "Release 1.1"
% hg tags
tip				   3:e79b93d560db90735eee98561ca12e942ee8a714
Release 1.1                        2:9d8ef585355e39bb7501a287cb733a2659e19f57

% hg tip -v
changeset:   3:e79b93d560db90735eee98561ca12e942ee8a714
tag:         tip
user:        John D. Mitchell <john at mitchell.org>
date:        Sun Sep 03 15:36:21 2006 -0700
files:       .hgtags
description:
Added tag Release 1.1 for changeset
9d8ef585355e39bb7501a287cb733a2659e19f57

% cd ..
% hg clone my-hello my-hello-desc
2 files updated, 0 files merged, 0 files removed, 0 files unresolved

% cd !$
% emacs hello.c
[Add descriptive comment.]
% hg commit -m 'Add description of hello.c'
% hg diff -r 1
diff -r 82e55d328c8c hello.c
--- a/hello.c   Fri Aug 26 01:21:28 2005 -0700
+++ b/hello.c   Sun Sep 03 15:39:11 2006 -0700
@@ -1,5 +1,5 @@
 /*
- * hello.c
+ * hello.c -- Standard example program.
  *
  * Placed in the public domain by Bryan O'Sullivan
  *

% hg pull ../my-hello-new-output/
pulling from ../my-hello-new-output/
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)

% hg merge
merging hello.c
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)

% hg diff -r 1
diff -r 82e55d328c8c hello.c
--- a/hello.c   Fri Aug 26 01:21:28 2005 -0700
+++ b/hello.c   Sun Sep 03 15:40:44 2006 -0700
@@ -1,5 +1,5 @@
 /*
- * hello.c
+ * hello.c -- Standard example program.
  *
  * Placed in the public domain by Bryan O'Sullivan
  *
@@ -11,6 +11,6 @@

 int main(int argc, char **argv)
 {
-       printf("hello, world!\n");
+       puts("hello, world!\n");
        return 0;
 }

% hg commit -m "Merged with my-hello-new-output."


% cd ../my-hello-share
% emacs hello.c
[Let's make some conflicing changes:
 Add a description for the file,
 Change the printed message.]
% hg commit -m "Added some conflicting changes."
% hg pull ../my-hello-desc/
pulling from ../my-hello-desc/
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)

% hg merge
merging hello.c
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)

% hg commit -m "Kept good description and capitalized 'hello'."

[Now, lets go create another repo where we can do some removing and
renaming...]

% cd ..
% hg clone my-hello-share my-hello-removing
3 files updated, 0 files merged, 0 files removed, 0 files unresolved

% cd !$
% hg rename hello.c goodbye.c
% emacs !$
[Change description and message.]
% hg diff
diff -r 7e06e4ce2596 goodbye.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/goodbye.c Sun Sep 03 15:50:10 2006 -0700
@@ -0,0 +1,16 @@
+/*
+ * goodbye.c -- Ciao!
+ *
+ * Placed in the public domain by Bryan O'Sullivan
+ *
+ * This program is not covered by patents in the United States or other
+ * countries.
+ */
+
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+       puts("Goodbye, cruel world!\n");
+       return 0;
+}
diff -r 7e06e4ce2596 hello.c
--- a/hello.c   Sun Sep 03 15:47:18 2006 -0700
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-/*
- * hello.c -- Standard example program.
- *
- * Placed in the public domain by Bryan O'Sullivan
- *
- * This program is not covered by patents in the United States or other
- * countries.
- */
-
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
-       puts("Hello, world!\n");
-       return 0;
-}

% emacs Makefile
[Change hello to goodbye.]

% hg commit -m "hello -> goodbye"
% hg remove Makefile
% hg commit -m "We don't need no stinkin' makefile!"
% hg tip -v
changeset:   9:829d411ebed70b3746a5748659e145d50172cddc
tag:         tip
user:        John D. Mitchell <john at mitchell.org>
date:        Sun Sep 03 15:52:07 2006 -0700
files:       Makefile
description:
We don't need no stinkin' makefile!


[Now, export this and then try to import it into a clean copy of the
original...]

% hg export 2 3 4 5 6 7 8 9 > ../ciao.patch
% cd ..
% more ciao.patch
# HG changeset patch
# User John D. Mitchell <john at mitchell.org>
# Date 1157315346 25200
# Node ID 9d8ef585355e39bb7501a287cb733a2659e19f57
# Parent  82e55d328c8ca4ee16520036c0aaace03a5beb65
Why do people use printf instead of puts for simple strings? :-)

diff -r 82e55d328c8c -r 9d8ef585355e hello.c
--- a/hello.c	Fri Aug 26 01:21:28 2005 -0700
+++ b/hello.c	Sun Sep 03 13:29:06 2006 -0700
@@ -11,6 +11,6 @@

 int main(int argc, char **argv)
 {
-	printf("hello, world!\n");
+	puts("hello, world!\n");
 	return 0;
 }
# HG changeset patch
# User John D. Mitchell <john at mitchell.org>
# Date 1157322981 25200
# Node ID e79b93d560db90735eee98561ca12e942ee8a714
# Parent  9d8ef585355e39bb7501a287cb733a2659e19f57
Added tag Release 1.1 for changeset 9d8ef585355e39bb7501a287cb733a2659e19f57

diff -r 9d8ef585355e -r e79b93d560db .hgtags
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgtags	Sun Sep 03 15:36:21 2006 -0700
@@ -0,0 +1,1 @@
+9d8ef585355e39bb7501a287cb733a2659e19f57 Release 1.1
# HG changeset patch
# User John D. Mitchell <john at mitchell.org>
# Date 1157323474 25200
# Node ID fb1d6efb2a3712ef6f290dd52dbbfaaabf7ab058
# Parent  e79b93d560db90735eee98561ca12e942ee8a714
Added some conflicting changes.

diff -r e79b93d560db -r fb1d6efb2a37 hello.c
--- a/hello.c	Sun Sep 03 15:36:21 2006 -0700
+++ b/hello.c	Sun Sep 03 15:44:34 2006 -0700
@@ -1,5 +1,5 @@
 /*
- * hello.c
+ * hello.c - Worthless description message.
  *
  * Placed in the public domain by Bryan O'Sullivan
  *
@@ -11,6 +11,6 @@

 int main(int argc, char **argv)
 {
-	puts("hello, world!\n");
+	puts("Hello, world!\n");
 	return 0;
 }
# HG changeset patch
# User John D. Mitchell <john at mitchell.org>
# Date 1157323173 25200
# Node ID 272c4611aea075d9f0f7135c92cc2c1036e22e49
# Parent  82e55d328c8ca4ee16520036c0aaace03a5beb65
Added descripion of hello.c

diff -r 82e55d328c8c -r 272c4611aea0 hello.c
--- a/hello.c	Fri Aug 26 01:21:28 2005 -0700
+++ b/hello.c	Sun Sep 03 15:39:33 2006 -0700
@@ -1,5 +1,5 @@
 /*
- * hello.c
+ * hello.c -- Standard example program.
  *
  * Placed in the public domain by Bryan O'Sullivan
  *
# HG changeset patch
# User John D. Mitchell <john at mitchell.org>
# Date 1157323354 25200
# Node ID 1579cd4ef48c3015be7dcb6c1632fdbe156fcc49
# Parent  272c4611aea075d9f0f7135c92cc2c1036e22e49
# Parent  9d8ef585355e39bb7501a287cb733a2659e19f57
Merged with my-hello-new-output.

diff -r 272c4611aea0 -r 1579cd4ef48c hello.c
--- a/hello.c	Sun Sep 03 15:39:33 2006 -0700
+++ b/hello.c	Sun Sep 03 15:42:34 2006 -0700
@@ -11,6 +11,6 @@

 int main(int argc, char **argv)
 {
-	printf("hello, world!\n");
+	puts("hello, world!\n");
 	return 0;
 }
# HG changeset patch
# User John D. Mitchell <john at mitchell.org>
# Date 1157323638 25200
# Node ID 7e06e4ce2596c9fcd21964d4b9ba83840c3344e2
# Parent  fb1d6efb2a3712ef6f290dd52dbbfaaabf7ab058
# Parent  1579cd4ef48c3015be7dcb6c1632fdbe156fcc49
Kept good description and capitalized 'hello'.

diff -r fb1d6efb2a37 -r 7e06e4ce2596 hello.c
--- a/hello.c	Sun Sep 03 15:44:34 2006 -0700
+++ b/hello.c	Sun Sep 03 15:47:18 2006 -0700
@@ -1,5 +1,5 @@
 /*
- * hello.c - Worthless description message.
+ * hello.c -- Standard example program.
  *
  * Placed in the public domain by Bryan O'Sullivan
  *
# HG changeset patch
# User John D. Mitchell <john at mitchell.org>
# Date 1157323891 25200
# Node ID febc580750b8cb19a9d0a68b1e9b52a26db8d9c1
# Parent  7e06e4ce2596c9fcd21964d4b9ba83840c3344e2
hello -> goodbye

diff -r 7e06e4ce2596 -r febc580750b8 Makefile
--- a/Makefile	Sun Sep 03 15:47:18 2006 -0700
+++ b/Makefile	Sun Sep 03 15:51:31 2006 -0700
@@ -1,1 +1,1 @@ all: hello
-all: hello
+all: goodbye
diff -r 7e06e4ce2596 -r febc580750b8 goodbye.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/goodbye.c	Sun Sep 03 15:51:31 2006 -0700
@@ -0,0 +1,16 @@
+/*
+ * goodbye.c -- Ciao!
+ *
+ * Placed in the public domain by Bryan O'Sullivan
+ *
+ * This program is not covered by patents in the United States or other
+ * countries.
+ */
+
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+	puts("Goodbye, cruel world!\n");
+	return 0;
+}
diff -r 7e06e4ce2596 -r febc580750b8 hello.c
--- a/hello.c	Sun Sep 03 15:47:18 2006 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-/*
- * hello.c -- Standard example program.
- *
- * Placed in the public domain by Bryan O'Sullivan
- *
- * This program is not covered by patents in the United States or other
- * countries.
- */
-
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
-	puts("Hello, world!\n");
-	return 0;
-}
# HG changeset patch
# User John D. Mitchell <john at mitchell.org>
# Date 1157323927 25200
# Node ID 829d411ebed70b3746a5748659e145d50172cddc
# Parent  febc580750b8cb19a9d0a68b1e9b52a26db8d9c1
We don't need no stinkin' makefile!

diff -r febc580750b8 -r 829d411ebed7 Makefile
--- a/Makefile	Sun Sep 03 15:51:31 2006 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-all: goodbye

% hg clone my-hello my-hello-ciao
2 files updated, 0 files merged, 0 files removed, 0 files unresolved

% cd !$
% hg import ../ciao.patch
applying ../ciao.patch
patching file hello.c
patching file .hgtags
patching file hello.c
patching file hello.c
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file hello.c.rej
patching file hello.c
Hunk #1 FAILED at 11.
1 out of 1 hunk FAILED -- saving rejects to file hello.c.rej
patching file hello.c
patching file Makefile
patching file goodbye.c
patching file hello.c
patching file Makefile
abort: patch command failed: exited with status 1

[Eeek!  Now what?]

Obviously, I know what's intended and can maually fix this up but
these failres are definitely not what I would expect.

I'm using hg v0.9.1 on Mac OS X 10.4.7.

Thanks!
John



More information about the Mercurial mailing list