Differences between revisions 7 and 22 (spanning 15 versions)
Revision 7 as of 2005-09-21 21:24:12
Size: 2068
Editor: AdrienBeau
Comment: Updated to Mercurial 0.7 output
Revision 22 as of 2012-11-06 13:12:40
Size: 2822
Editor: abuehl
Comment: remove link to deleted page "clone"
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== Tutorial - sharing a change with another repository == == Tutorial - Sharing a Change with another Repository ==
''(This page is part of the [[Tutorial]] series. Previous part is TutorialFirstChange, next part is TutorialExport)''
Line 3: Line 4:
In TutorialFirstChange, we created a ChangeSet in the {{{my-hello-new-output}}} ["Repository"]. Now we want to propagate that change somewhere else. In TutorialFirstChange, we created a [[ChangeSet|changeset]] in the `my-hello-new-output` [[Repository|repository]]. Now we want to propagate that change somewhere else.
Line 5: Line 6:
Following good ["Mercurial"] style, let's first ["Clone"] our original ["Repository"]. Following good Mercurial style, let's first clone our original repository.
Line 10: Line 11:
updating working directory
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
Line 11: Line 14:

We can use the {{{tip}}} command to find out what the ["Tip"] in each ["Repository"] is. (Remember, the ["Tip"] is the most recent ChangeSet.) We pass in the {{{-q}}} ("be quiet") option to keep ["Mercurial"] from printing a complete description of the ["Tip"].
We can use the `tip` command to find out what the [[Tip|tip]] in each repository is. (Remember, the tip is the most recent changeset.) We pass in the `-q` ("be quiet") option to keep Mercurial from printing a complete description of the tip.
Line 20: Line 22:
2:a58809af174d 2:86794f718fb1
Line 22: Line 24:

As we can see, the ["Tip"] is different in each. Let's go back to {{{my-hello-share}}} and propagate our new ChangeSet in there. To do this, we use the {{{pull}}} command, which ["Pull"]s all ["ChangeSet"]s that are in the other repository, but not yet in this one, into this one.
As we can see, the tip is different in each. Let's go back to `my-hello-share` and propagate our new changeset in there. To do this, we use the `pull` command, which [[Pull|pulls]] all changesets that are in the other repository, but not yet in this one, into this one.
Line 36: Line 37:
Unlike other common Mercurial commands, `pull` is chatty. In this case, the pull has succeeded.
Line 37: Line 39:
Unlike other common ["Mercurial"] commands, {{{pull}}} is chatty. In this case, the ["Pull"] has succeeded. The last line of output is important. By default, Mercurial does not update the [[WorkingDirectory|working directory]] after a pull. This means that although the repository now contains the changeset, the file `hello.c` in the working directory still has its old pre-pull contents.
Line 39: Line 41:
The last line of output is important. By default, ["Mercurial"] does not update the WorkingDirectory after a ["Pull"]. This means that although the ["Repository"] now contains the ChangeSet, the file {{{hello.c}}} in the WorkingDirectory still has its old pre-["Pull"] contents.

We can ["Update"] this file (and any others that were changed during the ["Pull"]) by following ["Mercurial"]'s reminder:
We can [[Update|update]] this file (and any others that were changed during the pull) by following Mercurial's reminder (we use the abbreviation `up`):
Line 44: Line 44:
$ hg update $ hg up
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Line 46: Line 47:
At this point, we can check and see that `my-hello-share` and `my-hello-new-output` have identical contents and revision histories.
Line 47: Line 49:
At this point, we can check and see that {{{my-hello-share}}} and {{{my-hello-new-output}}} have identical contents and revision histories. To check the repositories are the same, we can go to `my-hello-share`, and do a

{{{
$ hg pull ../my-hello-new-output
$ hg push ../my-hello-new-output
}}}
If both of these give a 'no changes found', that means the repositories are identical. Or vice versa, using 'my-hello-new-output' instead of 'my-hello-share'.

??How, exactly would we 'check and see'? This would be a great time, perhaps, to at least reference the comparison tools available.??
Line 50: Line 60:

----
CategoryTutorial

Tutorial - Sharing a Change with another Repository

(This page is part of the Tutorial series. Previous part is TutorialFirstChange, next part is TutorialExport)

In TutorialFirstChange, we created a changeset in the my-hello-new-output repository. Now we want to propagate that change somewhere else.

Following good Mercurial style, let's first clone our original repository.

$ cd ..
$ hg clone my-hello my-hello-share
updating working directory
2 files updated, 0 files merged, 0 files removed, 0 files unresolved

We can use the tip command to find out what the tip in each repository is. (Remember, the tip is the most recent changeset.) We pass in the -q ("be quiet") option to keep Mercurial from printing a complete description of the tip.

$ cd my-hello-share
$ hg -q tip
1:82e55d328c8c
$ cd ../my-hello-new-output
$ hg -q tip
2:86794f718fb1

As we can see, the tip is different in each. Let's go back to my-hello-share and propagate our new changeset in there. To do this, we use the pull command, which pulls all changesets that are in the other repository, but not yet in this one, into this one.

$ cd ../my-hello-share
$ 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)

Unlike other common Mercurial commands, pull is chatty. In this case, the pull has succeeded.

The last line of output is important. By default, Mercurial does not update the working directory after a pull. This means that although the repository now contains the changeset, the file hello.c in the working directory still has its old pre-pull contents.

We can update this file (and any others that were changed during the pull) by following Mercurial's reminder (we use the abbreviation up):

$ hg up
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

At this point, we can check and see that my-hello-share and my-hello-new-output have identical contents and revision histories.

To check the repositories are the same, we can go to my-hello-share, and do a

$ hg pull ../my-hello-new-output
$ hg push ../my-hello-new-output

If both of these give a 'no changes found', that means the repositories are identical. Or vice versa, using 'my-hello-new-output' instead of 'my-hello-share'.

??How, exactly would we 'check and see'? This would be a great time, perhaps, to at least reference the comparison tools available.??

To share a change with another person, we continue to TutorialExport.


CategoryTutorial

TutorialShareChange (last edited 2012-11-11 19:48:16 by abuehl)