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)