-
Notifications
You must be signed in to change notification settings - Fork 89
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
If tip commit of local hg repo is stripped, git-remote-hg does not automatically recover #26
Comments
For local hg repositories, the repo was not cloned. This special case made it necessary to have GIT_REMOTE_HG_TEST_REMOTE for use by tests. It also caused some problems for me, see e.g. issue #26.
@fingolfin: So you're saying that stripping the tip commit from hg removes the commit from git? For me, doing that is the surest way to cause a broken pipe issue that cripples git-remote-hg until you fix it via the steps on #4 (comment). |
@fgb I am saying what I saying :). I think I even made a test script to setup hg and git repos like I described, to replicate the issue. No "broken pipe" for me. Might be due to differences in our setup (Mercurial & git version used, version of git-remote-hg used), but of course also with the repository (I only tested this with toy repositories, and at the test time, only the one commit was removed -- your situation might be different, e.g. a commit removed and others added, etc.). It's been a long time I looked at this, so my memoy is a bit fuzzy, but I am pretty sure I run these tests specifically to try and see whether I could reproduce your issues and some others I experienced myself in the past. Unfortunately, they tend to be difficult to reproduce consistently (ideally: with a script)... :-( I'll try to dig up my complete test script for this and add it here. |
For local hg repositories, the repo was not cloned. This special case made it necessary to have GIT_REMOTE_HG_TEST_REMOTE for use by tests. It also caused some problems for me, see e.g. issue felipec#26.
As commented above, there are quite some things that can go wrong when doing a strip on a remote hg repo, though git-remote-hg is not really to blame. That is, strip is a pretty invasive and tricky operation and such fiddling with tips will confuse things as recorded in |
Actually, I stand self-corrected; git-remote-hg would not have to resort to guessing (tips status). With some more thorough modifications of how to-be-imported revisions are determined, it can always accomplish that task just fine in a safe and robust way. In particular, the approach of above commit no longer relies on any tip tracking, so any manual or otherwise script fiddling with that is no longer necessary. Note that the counterpart of an |
Indeed, fixes and solutions should preferably be within git-remote-hg. As such, @fgb, #58 and its fixes might help in that regard. In the same way commits such as mnauw/git-remote-hg@b3fccdd here eliminate tips metadata tracking, those commits eliminate last_note metadata tracking. In fact, the only relevant metadata that is then left is the mapping from hg revision to mark number (in the same way the git side only relates commit sha1 to mark). After all, if that suffices for the Git DAG side, it also should for the Mercurial DAG side (and indeed it does). Less (superfluous) metadata tracking means less that can go stale and that can break things (and indeed, |
@mnauw I tried to use your fork to solve the issue with re-pushing stripped commits, but it doesn't seem to work for me. Can you tell me what I'm doing wrong? (I would have filed this as an issue on your fork, but you don't seem to have issues open). I've attached my demo script (sorry it's a .txt -- github won't let me upload a .sh under that name). Or is that just not supported yet? I saw "recovering from a strip on remote repo" in your README, so I thought I might get lucky. Thanks. |
@novalis oops, seems to have missed enabling issues, that should be ok now. At the time of writing that in the README, I mainly had handling fetching following a strip in mind. To recover in a way for a push to succeed as well, the helper script's However, alternatively, I have had some more changes pending for some time. So, at present, upgrading to the latest master that I just pushed also handles pushing after a strip. In particular, running the demo.txt script with latest master results in seeing the expected. Note that some minor settings change (and "conversion") is required to have similar results on existing repos (see documentation), or cloning afresh will also do. |
@mnauw It does indeed seem to work. Thanks! |
Suppose you have a local hg repository, and a git clone of that, both are fully in sync. Now the tip commit of the remote hg repository is stripped. If one does
git pull
, then origin/master is correctly updated.I expected to be able to push the old commit (stripped from hg, but still present on the git side) out again, but not so, instead I get into this "infinite cycle" and no commit appears in the hg repo:
I guess this is because the marks file still references the commit, but the commit is gone in the repository. And since for local hg repositories no clone is made, it cannot recover from it.
Note that everything works fine if I set the GIT_REMOTE_HG_TEST_REMOTE env to force the creation of a clone even for local repositories.
So one possible fix would be to simply remove the special case for local repositories.
The text was updated successfully, but these errors were encountered: