1625
Comment:
|
2032
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
== Tutorial - cloning a repository == | == Tutorial - Cloning a repository == |
Line 3: | Line 3: |
We have followed TutorialInstall to install ["Mercurial"] already, right? Good! | ''(This page is part 2 of 9 of the [:Tutorial] series. Previous part is [:TutorialInstall], next part is [:TutorialHistory])'' |
Line 5: | Line 5: |
In ["Mercurial"], we do all of our work inside a ["Repository"]. A ["Repository"] is a directory that contains all of the source files that we want to keep history of, along with complete histories of those source files. | You have followed TutorialInstall to install Mercurial already, right? Good! |
Line 7: | Line 7: |
The easiest way to get started with ["Mercurial"] is to use a ["Repository"] that already contains some files and some history. | In Mercurial, we do all of our work inside a [:Repository:repository]. A repository is a directory that contains all of the source files that we want to keep history of, along with complete histories of those source files. |
Line 9: | Line 9: |
To do this, we use the {{{clone}}} command. This makes a ["Clone"] of a ["Repository"]; it makes a complete copy of another ["Repository"] so that we will have our own local, private one to work in. | The easiest way to get started with Mercurial is to use a repository that already contains some files and some history. To do this, we use the {{{clone}}} command. This makes a [:Clone:clone] of a repository; it makes a complete copy of another repository so that we will have our own local, private one to work in. Let's clone a small "hello, world" repository hosted at selenic.com: |
Line 12: | Line 16: |
$ hg clone http://www.selenic.com/repo/hello my-hello | $ hg clone http://www.selenic.com/repo/hello my-hello |
Line 15: | Line 19: |
If all goes well, the {{{clone}}} command prints no output. (It seems like new versions of hg prints some progress -- MadsKiilerich.) We should now find a directory called {{{my-hello}}} in our current directory: | If all goes well, the {{{clone}}} command prints this (Mercurial 1.0): |
Line 18: | Line 22: |
$ ls my-hello |
requesting all changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 2 files updating working directory 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
Line 21: | Line 30: |
Inside the {{{my-hello}}} directory, we'll find some files: | We should now find a directory called {{{my-hello}}} in our current directory: |
Line 24: | Line 34: |
$ ls my-hello hello.c Makefile |
$ ls my-hello |
Line 27: | Line 37: |
These files are exact copies of the files in the ["Repository"] we just ["Clone"]d. | |
Line 29: | Line 38: |
'''Note''': in ["Mercurial"], each ["Repository"] is self-contained. When you ["Clone"] a ["Repository"], the new ["Repository"] becomes an exact copy of the existing one at the time of the ["Clone"], but subsequent changes in either one''will not show up'' in the other unless you explicitly transfer them. | Inside the {{{my-hello}}} directory, we should find some files: |
Line 31: | Line 40: |
At this point, we can start examining some of the history of our new ["Repository"], by continuing to TutorialHistory. | {{{ $ ls my-hello Makefile hello.c }}} These files are exact copies of the files in the repository we just cloned. '''Note:''' in Mercurial, each repository is self-contained. When you clone a repository, the new repository becomes an exact copy of the existing one at the time of the clone, but subsequent changes in either one ''will not show up'' in the other unless you explicitly transfer them, by either [:Pull:pulling] or [:Push:pushing]. At this point, we can start examining some of the history of our new repository, by continuing to TutorialHistory. ---- CategoryTutorial |
Tutorial - Cloning a repository
(This page is part 2 of 9 of the [:Tutorial] series. Previous part is [:TutorialInstall], next part is [:TutorialHistory])
You have followed TutorialInstall to install Mercurial already, right? Good!
In Mercurial, we do all of our work inside a [:Repository:repository]. A repository is a directory that contains all of the source files that we want to keep history of, along with complete histories of those source files.
The easiest way to get started with Mercurial is to use a repository that already contains some files and some history.
To do this, we use the clone command. This makes a [:Clone:clone] of a repository; it makes a complete copy of another repository so that we will have our own local, private one to work in.
Let's clone a small "hello, world" repository hosted at selenic.com:
$ hg clone http://www.selenic.com/repo/hello my-hello
If all goes well, the clone command prints this (Mercurial 1.0):
requesting all changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 2 files updating working directory 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
We should now find a directory called my-hello in our current directory:
$ ls my-hello
Inside the my-hello directory, we should find some files:
$ ls my-hello Makefile hello.c
These files are exact copies of the files in the repository we just cloned.
Note: in Mercurial, each repository is self-contained. When you clone a repository, the new repository becomes an exact copy of the existing one at the time of the clone, but subsequent changes in either one will not show up in the other unless you explicitly transfer them, by either [:Pull:pulling] or [:Push:pushing].
At this point, we can start examining some of the history of our new repository, by continuing to TutorialHistory.