Skip to content

transport: fixes for fast-import-based remotes #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dscho
Copy link
Member

@dscho dscho commented Feb 24, 2019

Once upon a time, I worked on a remote-hg helper with Sverre Rabbelier. For really unfortunate reasons, our work was dismissed, and a now-dysfunct remote-hg helper was forced into git.git.

While I no longer have a need for a working remote-hg helper (and while I nowadays would be loathe to re-open that can of ugly worms, or for that matter, even to think back to that unhappy episode, and while I would probably use git cinnabar anyway), these patches still might have value to others.

@dscho dscho added the needs-work These patches have pending issues that need to be resolved before submitting label Feb 24, 2019
@dscho dscho force-pushed the remote-hg-prerequisites branch from 283e71f to e5b9145 Compare February 26, 2019 09:01
@dscho dscho force-pushed the remote-hg-prerequisites branch from e5b9145 to 3f59a18 Compare July 13, 2022 16:38
@gitgitgadget
Copy link

gitgitgadget bot commented Jul 13, 2022

There are issues in commit 3f59a18:
fixup! t9350: point out that refs are not updated correctly
Rebase needed to squash commit

SRabbelier and others added 5 commits July 27, 2022 15:41
This makes it safer to use, as it avoids rev/file ambiguities.

Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
After importing anything with fast-import, we should always let the
garbage collector do its job, since the objects are written to disk
inefficiently.

This brings down an initial import of http://selenic.com/hg from about
230 megabytes to about 14.

In the future, we may want to make this configurable on a per-remote
basis, or maybe teach fast-import about it in the first place.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
In 25e0ca5 (Add new fast-export testcases, 2009-06-25), we
introduced a test where `fast-export` was called with a commit range
whose positive side was not a ref name, but a revision that refers to
the parent of a ref.

In such a case, the result of `fast-export` cannot be piped to
`fast-import` to essentially recreate the same revisions because we do
not have a proper ref name to work with.

The introduced test case set the expectation that Git should
transmogrify the `main~1` into `refs/heads/master`, and because it
doesn't, the test case was marked as demonstrating a breakage.

However, it would be improper to perform that conversion: the overall
expectation of `fast-export` is that when piping it to `fast-import`,
you get an identical result. And no matter how you hold the tool, `git
fast-export main~2..main~1` will never be able to perform that trick
because there is simply insufficient information.

It would seem that `fast-export` Does The Right Thing here by using
`main~1` as the "ref name", even if `fast-import` would stumble over
that: At least the output documents properly which commit was exported,
even if the result is not a valid `fast-import` script.

So let's turn the test case around into documenting that the current
behavior is actually expected and not at all a breakage that needs
fixing.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
We do not write "GIT" in all caps anymore, and we do translate error
messages.

The error messages when a ref needs to be created and it fails either
because the ref name is invalid or because the ref already exists should
be identical to the ones `git branch` emits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho force-pushed the remote-hg-prerequisites branch from 3f59a18 to d4008bc Compare July 28, 2022 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-work These patches have pending issues that need to be resolved before submitting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants