Changes To Cookbook
Not logged in

Changes to "Cookbook" between 2011-05-12 23:38:04 and 2011-06-08 00:32:21

1165
1166
1167
1168
1169
1170
1171
1172

1173
1174
1175
1176
1177
1178
1179
1165
1166
1167
1168
1169
1170
1171

1172
1173
1174
1175
1176
1177
1178
1179







-
+








<h2><a name="Mercurial">Importing from Mercurial</a></h2>

<h3>Problem</h3>

Fossil supports [/doc/trunk/www/inout.wiki|importing from Git], but not from Mercurial.

<h3>Solution</h3>
<h3>Solution1</h3>

We'll use Git as an intermediary: first by converting Mercurial repository to Git, and then by converting Git repository
to Fossil. You'll need both Git and Mercurial installed for this to work.

Get <i>hg2git.py</i>, <i>hg-fast-export.py</i>, and <i>hg-fast-export.sh</i> from [http://repo.or.cz/w/fast-export.git/tree],
and put them into a single directory (we'll use ~/Downloads/).

1200
1201
1202
1203
1204
1205
1206



































1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Now we can import Git repository into Fossil (we'll put it into
parent directory under the "our-repository.fossil" name):

<verbatim>
  git fast-export --all | fossil import --git ../our-repository.fossil
</verbatim>
  
<h3>Solution2</h3>

This solution uses HgGit from [http://hg-git.github.com/], hg, git, and fossil need to be installed on your system.  Most OSs have a package for HgGit, but I ran into a bug in an older version of HgGit and have found that a clean check out works just fine.

The following example worked very nicely for me on a Mercurial repository called "wpkg".

<h4>The basic steps are:</h4>
  1.  Clone the Mercurial repository.
  2.  Clone hg-git.
  3.  Initialize a new git repository.
  4.  Modify the .hg/hgrc file.
  5.  Push the Mercurial repository into the new git repository.
  6.  Export git to fossil.
  7.  Take a look at your new fossil repository.

<verbatim>
mkdir /tmp/crap
cd /tmp/crap
hg clone ssh://hg@hg/repos/wpkg
git clone git://github.com/schacon/hg-git.git
git init --bare git-wpkg
cd wpkg
cat >> .hg/hgrc << EOF

[extensions]
hgext.bookmarks =
hggit = /tmp/crap/hg-git/hggit
EOF

hg push ../git-wpkg
cd ../git-wpkg
git fast-export --all | fossil import --git ../wpkg.fossil
cd ..
fossil ui wpkg.fossil
</verbatim>