Mercurial > hg-git
annotate README.md @ 318:f4a125201c5c
README.md: Add information to convert Mercurial to Git.
author | Simon Ruderich <simon@ruderich.org> |
---|---|
date | Tue, 06 Apr 2010 10:19:30 -0500 |
parents | b0d3d6330b80 |
children | 3ab3765db5bc |
rev | line source |
---|---|
46
0bfcd0c06b8e
clarified in the readme that this is still alpha
Scott Chacon <schacon@gmail.com>
parents:
45
diff
changeset
|
1 *Warning: This plugin is not yet stabilized. Use to help me identify bugs, but it will be a few weeks before its fully stable.* |
0bfcd0c06b8e
clarified in the readme that this is still alpha
Scott Chacon <schacon@gmail.com>
parents:
45
diff
changeset
|
2 |
163 | 3 *Project status as of 5/27:* Pretty solid, but a bit slow - can losslessly convert most major scenarios and can handle projects up to several thousand commits. Submodules in Git are not handled. See TODO.txt for full list of things I'm working on. |
111 | 4 |
5 | |
43 | 6 Hg-Git Mercurial Plugin |
7 ======================= | |
8 | |
9 This is the Hg-Git plugin for Mercurial, adding the ability to push and pull to/from a Git server repository from Hg. This means you can collaborate on Git based projects from Hg, or use a Git server as a collaboration point for a team with developers using both Git and Hg. | |
10 | |
115
e28e669e2010
readme update - added sverre and fixed some stuff
Scott Chacon <schacon@gmail.com>
parents:
114
diff
changeset
|
11 The Hg-Git plugin can convert commits/changesets losslessly from one system to another, so you can push via an Hg repository and another Hg client can pull it and their changeset node ids will be identical - Mercurial data does not get lost in translation. It is intended that Hg users may wish to use this to collaborate even if no Git users are involved in the project, and it may even provide some advantages if you're using Bookmarks (see below). |
43 | 12 |
45
a4e53be79ca6
bit of doc cleanup - added dependencies section
Scott Chacon <schacon@gmail.com>
parents:
44
diff
changeset
|
13 Dependencies |
a4e53be79ca6
bit of doc cleanup - added dependencies section
Scott Chacon <schacon@gmail.com>
parents:
44
diff
changeset
|
14 ============ |
a4e53be79ca6
bit of doc cleanup - added dependencies section
Scott Chacon <schacon@gmail.com>
parents:
44
diff
changeset
|
15 |
224
80d67ae190df
port to upstream dulwich
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
200
diff
changeset
|
16 This plugin is implemented entirely in Python - there are no Git binary dependencies, you do not need to have Git installed on your system. The only dependencies are Mercurial and Dulwich. The plugin is known to work on Hg versions 1.1 through 1.3 and requires at least Dulwich 0.3.2. |
45
a4e53be79ca6
bit of doc cleanup - added dependencies section
Scott Chacon <schacon@gmail.com>
parents:
44
diff
changeset
|
17 |
43 | 18 Commands |
19 ========= | |
20 | |
192
03ef61d6882b
Updated the readme some more...
Arne Babenhauserheide <bab@draketo.de>
parents:
191
diff
changeset
|
21 You can clone a Git repository from Hg by running `hg clone [url]`. For example, if you were to run `hg clone git://github.com/schacon/munger.git` it would clone the repository down into the directory 'munger.git', then convert it to an Hg repository for you. |
43 | 22 |
255
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
23 hg clone git://github.com/schacon/hg-git.git |
197
11235deb86fc
README: Added information about the git+ssh:// url format.
Arne Babenhauserheide <bab@draketo.de>
parents:
192
diff
changeset
|
24 |
200
dfed3bd84184
README: minor fixes
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
197
diff
changeset
|
25 If you want to clone a github repository for later pushing (or any other repository you access via ssh), you need to convert the ssh url to a format with explicit protocol prefix (mind the switch from colon to slash after the host!): |
dfed3bd84184
README: minor fixes
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
197
diff
changeset
|
26 |
255
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
27 git clone git@github.com:schacon/hg-git.git |
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
28 hg clone git+ssh://git@github.com/schacon/hg-git.git |
200
dfed3bd84184
README: minor fixes
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
197
diff
changeset
|
29 |
192
03ef61d6882b
Updated the readme some more...
Arne Babenhauserheide <bab@draketo.de>
parents:
191
diff
changeset
|
30 If you are starting from an existing Hg repository, you have to setup a Git repository somewhere that you have push access to, add it as default path or default-push path in your .hg/hgrc and then run `hg push` from within your project. For example: |
43 | 31 |
255
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
32 cd hg-git # (an Hg repository) |
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
33 (edit .hg/hgrc and add the target git url in the paths section) |
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
34 hg push |
197
11235deb86fc
README: Added information about the git+ssh:// url format.
Arne Babenhauserheide <bab@draketo.de>
parents:
192
diff
changeset
|
35 |
11235deb86fc
README: Added information about the git+ssh:// url format.
Arne Babenhauserheide <bab@draketo.de>
parents:
192
diff
changeset
|
36 This will convert all your Hg data into Git objects and push them up to the Git server. |
43 | 37 |
191
c3aeeff8fb29
Updated the readme to include the usage of [paths].
Arne Babenhauserheide <bab@draketo.de>
parents:
163
diff
changeset
|
38 Now that you have an Hg repository that can push/pull to/from a Git repository, you can fetch updates with `hg pull`. |
43 | 39 |
255
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
40 $ hg pull |
197
11235deb86fc
README: Added information about the git+ssh:// url format.
Arne Babenhauserheide <bab@draketo.de>
parents:
192
diff
changeset
|
41 |
43 | 42 That will pull down any commits that have been pushed to the server in the meantime and give you a new head that you can merge in. |
43 | |
318
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
44 Hg-Git can also be used to convert a Mercurial repository to Git. As Dulwich doesn't support local repositories yet, the easiest way is to setup up a local SSH server. Then use the following commands to convert the repository. |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
45 |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
46 $ mkdir git-repo; cd git-repo; git init; cd .. |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
47 $ cd hg-repo |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
48 $ hg push git+ssh://localhost/absolute/path/to/git-repo |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
49 |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
50 To import new changesets into the Git repository you can run the last command as often as you want, only new changes will be pushed. |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
51 |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
52 If the you get the following warning you should setup a bookmark so Git doesn't have to push to the currently checked out branch. |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
53 |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
54 warning: updating the current branch |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
55 |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
56 To fix this run the following command in the Git repository. Warning: All local changes are destroyed! |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
57 |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
58 $ git reset --hard |
f4a125201c5c
README.md: Add information to convert Mercurial to Git.
Simon Ruderich <simon@ruderich.org>
parents:
255
diff
changeset
|
59 |
43 | 60 Hg Bookmarks Integration |
61 ======================== | |
62 | |
200
dfed3bd84184
README: minor fixes
Abderrahim Kitouni <a.kitouni@gmail.com>
parents:
197
diff
changeset
|
63 If you have the bookmarks extension enabled, Hg-Git will use it. It will push your bookmarks up to the Git server as branches and will pull Git branches down and set them up as bookmarks. |
43 | 64 |
65 This is actually pretty cool, since you can use this extension to transfer your Hg bookmarks via the Git protocol, rather than having to scp them, as the Hg transfer protocol does not currently support transferring bookmarks. | |
66 | |
67 Installing | |
68 ========== | |
69 | |
70 Clone this repository somewhere and make the 'extensions' section in your `~/.hgrc` file look something like this: | |
71 | |
255
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
72 [extensions] |
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
73 hgext.bookmarks = |
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
74 hggit = [path-to]/hg-git/hggit |
43 | 75 |
76 That will enable the Hg-Git extension for you. The bookmarks section is not compulsory, but it makes some things a bit nicer for you. | |
44
234bb5784c8b
cleaned up documentation, created initial branch policy
Scott Chacon <schacon@gmail.com>
parents:
43
diff
changeset
|
77 |
234bb5784c8b
cleaned up documentation, created initial branch policy
Scott Chacon <schacon@gmail.com>
parents:
43
diff
changeset
|
78 Authors |
234bb5784c8b
cleaned up documentation, created initial branch policy
Scott Chacon <schacon@gmail.com>
parents:
43
diff
changeset
|
79 ======== |
234bb5784c8b
cleaned up documentation, created initial branch policy
Scott Chacon <schacon@gmail.com>
parents:
43
diff
changeset
|
80 |
234bb5784c8b
cleaned up documentation, created initial branch policy
Scott Chacon <schacon@gmail.com>
parents:
43
diff
changeset
|
81 * Scott Chacon <schacon@gmail.com> - main development |
255
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
82 * Augie Fackler <durin42@gmail.com> - testing and moral support, janitor |
115
e28e669e2010
readme update - added sverre and fixed some stuff
Scott Chacon <schacon@gmail.com>
parents:
114
diff
changeset
|
83 * Sverre Rabbelier <sverre@rabbelier.nl> - gexport, mode and i18n stuff and misc fixes |
255
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
84 * Abderrahim Kitouni <a.kitouni@gmail.com> - more "mercurialistic" UI |
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
85 * Kevin Bullock <kbullock@ringworld.org> - proper packaging for PyPI |
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
86 |
45
a4e53be79ca6
bit of doc cleanup - added dependencies section
Scott Chacon <schacon@gmail.com>
parents:
44
diff
changeset
|
87 * Dulwich Developers - most of this code depends on the awesome work they did. |
255
b0d3d6330b80
Updated readme with more complete author list and some corrected docs.
Augie Fackler <durin42@gmail.com>
parents:
224
diff
changeset
|
88 |
44
234bb5784c8b
cleaned up documentation, created initial branch policy
Scott Chacon <schacon@gmail.com>
parents:
43
diff
changeset
|
89 Sponsorship |
234bb5784c8b
cleaned up documentation, created initial branch policy
Scott Chacon <schacon@gmail.com>
parents:
43
diff
changeset
|
90 =========== |
234bb5784c8b
cleaned up documentation, created initial branch policy
Scott Chacon <schacon@gmail.com>
parents:
43
diff
changeset
|
91 |
45
a4e53be79ca6
bit of doc cleanup - added dependencies section
Scott Chacon <schacon@gmail.com>
parents:
44
diff
changeset
|
92 GitHub let me (Scott) work on this full time for several days, which is why this got done at all. If you're looking for a free Git host to push your open source Hg projects to, do try us out (http://github.com). |