Patch 1111 implement log --fast-export to output git-fast-import ...

Title implement log --fast-export to output git-fast-import ...
Superseder Nosy List gh, mornfall, owst
Related Issues
Status accepted Assigned To

Created on 2014-01-08.19:29:58 by gh, last changed 2014-02-09.15:58:35 by gh.

File name Status Uploaded Type Edit Remove
implement-convert-__export-and-__import-for-git-conversion.dpatch dead gh, 2014-01-21.16:57:55 application/x-darcs-patch
implement-convert-__export-and-__import-for-git-conversion.dpatch gh, 2014-01-26.16:42:22 application/x-darcs-patch
implement-log-__fast_export-to-output-git_fast_import-stream.dpatch dead gh, 2014-01-08.19:29:58 application/x-darcs-patch
patch-preview.txt gh, 2014-01-08.19:29:58 text/x-darcs-patch
patch-preview.txt gh, 2014-01-21.16:57:55 text/x-darcs-patch
patch-preview.txt gh, 2014-01-26.16:42:22 text/x-darcs-patch
patch-preview.txt ganesh, 2014-02-07.20:36:29 text/x-darcs-patch
unnamed gh, 2014-01-08.19:29:58
unnamed gh, 2014-01-21.16:57:55
unnamed gh, 2014-01-26.16:42:22
unnamed ganesh, 2014-02-07.20:36:29
we-need-utf8_string-on-windows-too-now-for-the-fast_export_import-code.dpatch ganesh, 2014-02-07.20:36:29 application/x-darcs-patch
See mailing list archives for discussion on individual patches.
msg17121 (view) Author: gh Date: 2014-01-08.19:29:58
This is a proof-of-concept port of fast-export as an option of
`darcs log`.

In terms of UI, nothing complicated, inside of any repository do:

    darcs log --fast-export

Use it with --repo to convert some on-line repository, eg:

    mkdir test ; cd test ; git init
    darcs log --fast-export --repo http://hub.darcs.net/simon/fungen | git fast-import
    git checkout

In terms of implementation it is just a port of darcs-fastconvert
with some bits of darcs-bridge, to the Darcs.UI.Commands.Log module.
It could be probably moved to Darcs.UI.Export or Darcs.Repository.Export,
not very sure about what is better.

1 patch for repository http://darcs.net:

Wed Jan  8 15:51:21 ART 2014  Guillaume Hoffmann <guillaumh@gmail.com>
  * implement log --fast-export to output git-fast-import stream
  Ported from darcs-fastconvert by Petr Rockai and
  darcs-bridge by Owen Stephens.
msg17122 (view) Author: gh Date: 2014-01-08.20:51:13
See also http://bugs.darcs.net/patch332
msg17123 (view) Author: gh Date: 2014-01-08.21:00:39
for my current motivation.
msg17127 (view) Author: gwern Date: 2014-01-13.03:07:51
I tried out using `--fast-export` today (applying the patch to darcs.net
HEAD) because `darcs-to-git` was taking absurdly long (multiple days) to
convert my repo and sm said this might be faster. I took
https://patch-tag.com/r/gwern/Gwern/home and converted it into
https://github.com/gwern/gwern.net in under an hour.

It seems to have converted properly, except for 2 things:

1. permissions of executable files changed:
(not sure if this is good or bad)
2. filenames with Unicode seem to be mishandled somehow:
msg17137 (view) Author: gh Date: 2014-01-21.16:57:55
Thanks for the report, Gwern.  The permissions issue seems to come from the fact that all files are exported with permission 0644. Darcs does not track permissions, what we could do is to provide a --set-scripts-executable flag.  The unicode filename issue is probably easy to fix.  I have been working on porting back the --import code up to now.

I'm sending a whole new version of the patch. Let me explain why with a little of history.

In the discussion of patch332 (from August 2010), Petr Rockai proposed convert --import/--export as part of the convert command. After a couple of comments by Eric and Ganesh, Petr wrote a separate darcs-fastconvert program (http://hackage.haskell.org/package/darcs-fastconvert), based on libdarcs.

I want to point out now that 1) in the discussion of patch332, there is no strong opposition against having fast-import/export features inside of darcs; yes, there are a few objections, but nothing definitive. 2) The discussion occurred in 2010, when somehow we still had the human resources to handle maintenance of a separate fastconvert program, but as can be seen from hackage, darcs-fastconvert's last version is from Feb. 2011, and we know what happens each time a new GHC version is released.

Worst, we do have some code duplication between darcs-fastconvert (unmaintained) and Owen's darcs-bridge (newer and almost maintained).

So my stance on this issue is that we should have fast-import/export built-in darcs as subcommands of convert, and that we should remove darcs-fastconvert from HackageDB once it is done.

The patch I've sent is a port of Petr's darcs-fastconvert code, inspired by its original (patch332) bundle, and with a couple of changes transplanted from Owen's darcs-bridge.

Comments are welcome, I'm not screening this yet.

1 patch for repository http://darcs.net:

Tue Jan 21 13:54:59 ART 2014  Guillaume Hoffmann <guillaumh@gmail.com>
  * Implement convert --export and --import for git conversion
  Port of code by Petr Rockai and Owen Stephens.
msg17138 (view) Author: gh Date: 2014-01-21.17:04:01
You can also pull the patch from

msg17145 (view) Author: gh Date: 2014-01-26.16:42:22
I've modified the help string of `convert` and removed the
pragma "darcs-1" from the shell test convert.sh since now
convert can accept the flag --darcs-1 (when importing from git).

Will screen it in a couple of days (or maybe tomorrow) if there
is no complain.

1 patch for repository http://darcs.net:

Sat Jan 25 12:45:37 ART 2014  Guillaume Hoffmann <guillaumh@gmail.com>
  * Implement convert --export and --import for git conversion
  Port of code by Petr Rockai and Owen Stephens.
msg17147 (view) Author: simon Date: 2014-01-27.02:13:42
I'm glad this is moving forward. But why add these significant commands
as hard-to-discover sub-options of the convert command, which already
has a well-understood purpose. import and export commands seems better
to me (like svn, hg, git, ...).
msg17148 (view) Author: gh Date: 2014-01-28.01:01:47
> I'm glad this is moving forward. But why add these significant commands
> as hard-to-discover sub-options of the convert command, which already
> has a well-understood purpose. import and export commands seems better
> to me (like svn, hg, git, ...).

I don't feel strongly about that, but inertia will probably make me
screen this patch as it is now.

My main motivation is to avoid creating too many top-level commands.
Moreover, one command for all repositories conversion features does
not seem artificial to me. The short description of convert is
"Convert repositories between various formats.". Also, it's not like
users will be converting repos all the time..

The door is open to introduce import and export as aliases for
`convert --import` and `convert --export` if we feel we need it, but
personally I don't.
msg17151 (view) Author: ganesh Date: 2014-01-31.07:32:24
Just to note this doesn't build on Windows:

    Could not find module `Data.ByteString.Lazy.UTF8'
    Perhaps you meant
      Data.ByteString.Lazy.Char8 (from bytestring-
      Data.ByteString.Lazy (from bytestring-
    Use -v to see a list of the files searched for.

I think the problem is we don't already depend on utf8-string on 
Windows. It's a dubious dependency given that it should be obsoleted by 
GHC's own unicode support anyway, so we should try to remove it rather 
than add the dependency on Windows.

I'll try to take a look myself when I have a change but just making a 
note in the ticket for my own reference or in case anyone else gets to 
it first.
msg17160 (view) Author: ganesh Date: 2014-02-07.20:36:29
I decided the utf8-string dependency isn't all that evil

1 patch for repository darcs-unstable@darcs.net:screened:

Fri Feb  7 19:29:23 GMT 2014  Ganesh Sittampalam <ganesh@earth.li>
  * we need utf8-string on Windows too now for the fast-export/import code
msg17187 (view) Author: gh Date: 2014-02-09.15:58:35
Self-accepting with Ganesh' Windows patch.
Date User Action Args
2014-01-08 19:29:58ghcreate
2014-01-08 20:51:13ghsetmessages: + msg17122
2014-01-08 21:00:39ghsetmessages: + msg17123
2014-01-13 03:07:52gwernsetmessages: + msg17127
2014-01-20 19:04:49ghsetnosy: + mornfall, owst
2014-01-21 16:57:56ghsetfiles: + patch-preview.txt, implement-convert-__export-and-__import-for-git-conversion.dpatch, unnamed
messages: + msg17137
2014-01-21 17:04:01ghsetmessages: + msg17138
2014-01-26 16:42:22ghsetfiles: + patch-preview.txt, implement-convert-__export-and-__import-for-git-conversion.dpatch, unnamed
messages: + msg17145
2014-01-27 02:13:42simonsetmessages: + msg17147
2014-01-28 01:01:48ghsetmessages: + msg17148
2014-01-28 19:40:04ghsetstatus: needs-screening -> needs-review
2014-01-31 07:32:25ganeshsetmessages: + msg17151
2014-02-07 20:36:30ganeshsetfiles: + patch-preview.txt, we-need-utf8_string-on-windows-too-now-for-the-fast_export_import-code.dpatch, unnamed
messages: + msg17160
2014-02-09 15:58:35ghsetstatus: needs-review -> accepted
messages: + msg17187