Differences between revisions 1 and 21 (spanning 20 versions)
Revision 1 as of 2005-08-26 00:57:49
Size: 1894
Editor: waste
Comment:
Revision 21 as of 2012-11-08 16:35:10
Size: 1951
Editor: abuehl
Comment: remove link to deleted page "Export"
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== ["Tutorial"] - sharing a change with another person == == Tutorial - Sharing a Change with another Person ==
''(This page is part of the [[Tutorial]] series. Previous part is TutorialShareChange, next part is TutorialMerge)''
Line 3: Line 4:
In TutorialShareChange, we learned how to propagate a ChangeSet from one repository to another. In TutorialShareChange, we learned how to propagate a [[ChangeSet|changeset]] from one [[Repository|repository]] to another. There are other ways of sharing changes between repositories and people, one of the most common is through email.
Line 5: Line 6:
["Mercurial"] provides several ways of sharing changes between people, but one of the most common is through email. After we have committed a change, we can export it to a file, and email the file as an attachment to someone else.
Line 7: Line 8:
After we have ["Commit"]ted a change, we can ["Export"] it to a file, and email the file as an attachment to someone else.

To ["Export"] a change, we use the ''export'' command. We must provide a ["Tag"], RevisionNumber or ChangeSetID to tell ["Mercurial"] what to ["Export"]. In our case, we want to ["Export"] the ["Tip"]. By default, ["Export"] just displays the patch, so we redirect the output to a file.

At this point, we should still be in the my-hello-share directory.
To export a change, we use the `export` command. We must provide a [[Tag|tag]], [[RevisionNumber|revision number]] or [[ChangeSetID|changeset ID]] to tell Mercurial what to export. In our case, we want to export the [[Tip|tip]]. Provided we're still in the `my-hello-share` directory, let's do just that.
Line 14: Line 11:
 $ hg export tip > /tmp/my-patch
 $ cat /tmp/my-patch
 # HG changeset patch
 # User bos@camp4.serpentine.com
 # Node ID da99cce05957f7a62b74d345fd55365dc33109f0
 # Parent bd2fb7137c85cd5e6b04db4c72a45699e0d90ea9
$ hg export tip
# HG changeset patch
# User mpm@selenic.com
# Date 1209943246 -7200
# Node ID 86794f718fb1ea9e633f7c052757663b8ce90e30
# Parent 82e55d328c8ca4ee16520036c0aaace03a5beb65
Express great joy at existence of Mercurial

diff -r 82e55d328c8c -r 86794f718fb1 hello.c
--- a/hello.c Fri Aug 26 01:21:28 2005 -0700
+++ b/hello.c Mon May 05 01:20:46 2008 +0200
@@ -12,5 +12,6 @@
 int main(int argc, char **argv)
 {
        printf("hello, world!\n");
+ printf("sure am glad I'm using Mercurial!\n");
        return 0;
 }
Line 21: Line 30:
By default, `export` just displays the patch, so usually we redirect the output to a file (or use option -o). This file is a [[PatchFile|patch file]] in [[UnifiedDiff|unified diff]] format, with some extra information that tells Mercurial how to [[Import|import]] it.
Line 22: Line 32:
{{{
 Express great joy at existence of Mercurial
}}}
When the recipient receives our email, they will save the attachment and use the `import` command to import the changeset into their repository.
Line 26: Line 34:
{{{
 diff -r bd2fb7137c85 -r da99cce05957 hello.c
 --- a/hello.c Wed Jun 29 19:04:20 2005
 +++ b/hello.c Wed Jun 29 19:58:37 2005
 @@ -12,5 +12,6 @@
  int main(int argc, char **argv)
  {
      printf("hello, world!\n");
 + printf("sure am glad I'm using Mercurial!\n");
      return 0;
  }
}}}
To learn how to [[Merge|merge]] changes from diverged repositories, continue to TutorialMerge.
Line 39: Line 36:
This file is a PatchFile in UnifiedDiff format, with some extra information that tells ["Mercurial"] how to ["Import"] it.

When the recipient receives our email, they will save the attachment and use the ''import'' command to ["Import"] the ChangeSet into their ["Repository"]. (As of version 0.6c, ["Mercurial"] ignores some of this information on import making imports that involve merges problematic.)

Let's put ourselves in the position of that recipient, and learn how to ["Merge"] a change, in TutorialMerge.
----
CategoryTutorial

Tutorial - Sharing a Change with another Person

(This page is part of the Tutorial series. Previous part is TutorialShareChange, next part is TutorialMerge)

In TutorialShareChange, we learned how to propagate a changeset from one repository to another. There are other ways of sharing changes between repositories and people, one of the most common is through email.

After we have committed a change, we can export it to a file, and email the file as an attachment to someone else.

To export a change, we use the export command. We must provide a tag, revision number or changeset ID to tell Mercurial what to export. In our case, we want to export the tip. Provided we're still in the my-hello-share directory, let's do just that.

$ hg export tip
# HG changeset patch
# User mpm@selenic.com
# Date 1209943246 -7200
# Node ID 86794f718fb1ea9e633f7c052757663b8ce90e30
# Parent  82e55d328c8ca4ee16520036c0aaace03a5beb65
Express great joy at existence of Mercurial

diff -r 82e55d328c8c -r 86794f718fb1 hello.c
--- a/hello.c   Fri Aug 26 01:21:28 2005 -0700
+++ b/hello.c   Mon May 05 01:20:46 2008 +0200
@@ -12,5 +12,6 @@
 int main(int argc, char **argv)
 {
        printf("hello, world!\n");
+       printf("sure am glad I'm using Mercurial!\n");
        return 0;
 }

By default, export just displays the patch, so usually we redirect the output to a file (or use option -o). This file is a patch file in unified diff format, with some extra information that tells Mercurial how to import it.

When the recipient receives our email, they will save the attachment and use the import command to import the changeset into their repository.

To learn how to merge changes from diverged repositories, continue to TutorialMerge.


CategoryTutorial

TutorialExport (last edited 2012-11-08 16:35:10 by abuehl)