Changes To Cookbook
Not logged in

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

  1165   1165   
  1166   1166   <h2><a name="Mercurial">Importing from Mercurial</a></h2>
  1167   1167   
  1168   1168   <h3>Problem</h3>
  1169   1169   
  1170   1170   Fossil supports [/doc/trunk/www/inout.wiki|importing from Git], but not from Mercurial.
  1171   1171   
  1172         -<h3>Solution</h3>
         1172  +<h3>Solution1</h3>
  1173   1173   
  1174   1174   We'll use Git as an intermediary: first by converting Mercurial repository to Git, and then by converting Git repository
  1175   1175   to Fossil. You'll need both Git and Mercurial installed for this to work.
  1176   1176   
  1177   1177   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],
  1178   1178   and put them into a single directory (we'll use ~/Downloads/).
  1179   1179   
................................................................................
  1200   1200   Now we can import Git repository into Fossil (we'll put it into
  1201   1201   parent directory under the "our-repository.fossil" name):
  1202   1202   
  1203   1203   <verbatim>
  1204   1204     git fast-export --all | fossil import --git ../our-repository.fossil
  1205   1205   </verbatim>
  1206   1206     
         1207  +<h3>Solution2</h3>
         1208  +
         1209  +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.
         1210  +
         1211  +The following example worked very nicely for me on a Mercurial repository called "wpkg".
         1212  +
         1213  +<h4>The basic steps are:</h4>
         1214  +  1.  Clone the Mercurial repository.
         1215  +  2.  Clone hg-git.
         1216  +  3.  Initialize a new git repository.
         1217  +  4.  Modify the .hg/hgrc file.
         1218  +  5.  Push the Mercurial repository into the new git repository.
         1219  +  6.  Export git to fossil.
         1220  +  7.  Take a look at your new fossil repository.
         1221  +
         1222  +<verbatim>
         1223  +mkdir /tmp/crap
         1224  +cd /tmp/crap
         1225  +hg clone ssh://hg@hg/repos/wpkg
         1226  +git clone git://github.com/schacon/hg-git.git
         1227  +git init --bare git-wpkg
         1228  +cd wpkg
         1229  +cat >> .hg/hgrc << EOF
         1230  +
         1231  +[extensions]
         1232  +hgext.bookmarks =
         1233  +hggit = /tmp/crap/hg-git/hggit
         1234  +EOF
         1235  +
         1236  +hg push ../git-wpkg
         1237  +cd ../git-wpkg
         1238  +git fast-export --all | fossil import --git ../wpkg.fossil
         1239  +cd ..
         1240  +fossil ui wpkg.fossil
         1241  +</verbatim>