On Mon, May 27, 2013 at 3:35 PM, Isaac Jurado <dipto...@gmail.com> wrote:

> Hello,
>
> I'm testing Fossil by migrating a bunch of Mercurial repositories.
> Unlike Git, Mercurial tracks file renames.  However, in order to create
> a Fossil repository I have to follow the Mercurial -> Git -> Fossil
> path.
>

Is there a better way?  Can we create a direct Hg->Fossil importer?



>
> On the first conversion I lose file copying/renaming information.  But
> the "git fast-export" command has the -M and -C switches to enable
> copy/rename detection heuristics.  Therefore, the last conversion step
> looks like:
>
>     git fast-export -M -C --all | fossil import --git ../myrepo.fossil
>
> The good news is that the heuristics work, as Fossil fails with the
> following message:
>
>     cannot handle R records, use --full-tree
>
> Which would be understandable if it was a completely unsupported caes.
> Nevertheless, I searched for the place where the error originates and I
> found this:
>

I apparently wrote that particular code.  But if I ever knew what an "R"
record was, I have now forgotten.  You might try commenting out the
fossil_fatal() call at the end of that code block to see what happens.  If
that doesn't work, somebody is going to need to spend a day or say
reverse-engineering the rename-support in git-fast-export.


>
>     }else
>     if( memcmp(zLine, "R ", 2)==0 ){
>       int nFrom;
>       import_prior_files();
>       z = &zLine[2];
>       zFrom = next_token(&z);
>       zTo = rest_of_line(&z);
>       i = 0;
>       nFrom = strlen(zFrom);
>       while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
>         if( pFile->isFrom==0 ) continue;
>         pNew = import_add_file();
>         pFile = &gg.aFile[i-1];
>         if( strlen(pFile->zName)>nFrom ){
>           pNew->zName = mprintf("%s%s", zTo, pFile->zName[nFrom]);
>         }else{
>           pNew->zName = fossil_strdup(pFile->zName);
>         }
>         pNew->zPrior = pFile->zName;
>         pNew->isExe = pFile->isExe;
>         pNew->isLink = pFile->isLink;
>         pNew->zUuid = pFile->zUuid;
>         pNew->isFrom = 0;
>         gg.nFile--;
>         *pFile = *pNew;
>         memset(pNew, 0, sizeof(*pNew));
>       }
>       fossil_fatal("cannot handle R records, use --full-tree");
>     }else
>
> Then I tried commenting the call to fossil_fatal() and the import
> completed, but the old files were not removed.
>
> So, finally, my question is.  What is that code lacking in order to
> correctly import copy and rename information?
>
> Regards.
>
> --
> Isaac Jurado
>
> "The noblest pleasure is the joy of understanding."
>                                   Leonardo da Vinci
> _______________________________________________
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to