hg pull abort unknown parent - mercurial

I'm trying to pull from an hg repo but I seem to be getting the following error:
pulling from http://hg.mozilla.org/qa/mozmill-tests
searching for changes
adding changesets
adding manifests
adding file changes
transaction abort!
rollback completed
abort: data/tests/endurance/testBookmarks_AddAndRemoveBookmarkViaAwesomeBar/test1.js.i#2daf2ef33d4b: unknown parent!
And hg verify seems to return
759 files, 2820 changesets, 5082 total revisions
2688 integrity errors encountered!
(first damaged changeset appears to be 54)
How can I fix this?

I've cloned this repo and it worked ok. Do you have any local modifications in your clone? If not, you could just reclone the repo. Otherwise I suggest you to refer to the wiki page about repo corruption.

Related

Unknown parent error in Mercurial but no error in verify

We have too large Mercurial repo's in which following error has occured few times during a year when trying to clone:
$ hg clone --rev develop --noupdate http://url.to.repository
adding changesets
adding manifests
adding file changes
transaction abort!
rollback completed
abort: data/.../Result.Database.nuspec.i#03b180f4076b: unknown parent!
All goes well if I don't specify a revision in clone command.
Hg verify doesn't show any error:
$ hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
3427 files, 913 changesets, 5406 total revisions
How can I fix this error?
What is causing this error? I would like to fix the root cause to prevent this happening anymore in future.

"Unknown Parent" error on rebundle in Mercurial

I accidentally stripped the wrong changesets; however, I saved backups, but when I try to unbundle them using hg unbundle .hg/strip-backup/faa0a1895b97-backup.hg, I get the following error:
adding changesets
transaction abort!
rollback completed
abort: 00changelog.i#561fe01204b5: unknown parent!
What can I do to correct this?
Here's the entire output from hg verify:
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
If unbundle is telling you that it can't apply the bundle then the parent of that "first" changeset it that bundle, the bundles base, doesn't exist in your repo. Since repos never lose changesets using normal mercurial commands (strip isn't normal) then it seem you used strip or some other history-altering-not-normal-usage command to alter or remove that changeset.
Try going through all the .hg/strip-backup/ files and applying them one by one. Maybe one of them does apply and contains the parent the the strip backup you're trying to apply requires.
Tl;Dr: no normal mercurial command ever deletes anything, and the non-normal ones that do create backups. Unless you deleted the file out of band the data is there somewhere.

Got inconsistent Mercurial subrepository state (RepoLookupError) twice per day. How is that possible?

Recently migrated to Mercurial.
Due to heavy use of externals in old SVN repo we are using Subrepos accordingly and have a CI server that does pulls / pushes to central repositories often. So it's a bit hard to trace what exactly happened and developers can't reproduce the exact steps.
But, after pulling we got errors likes this:
RepoLookupError: unknown revision '766981bc81dc78fe24d5fe5c7d68e36c66858e73'
abort: unknown revision '766981bc81dc78fe24d5fe5c7d68e36c66858e73'!
And such changesets could not be found anywhere, nor on server nor in local repositories. Got this situation twice per day.
Somehow, from the server comes a .hgsubstate that refers to unknown subrepository changeset.
And we didn't do anything potentially harmful, just usual commits / pulls / merges.
As of our understanding - this is an impossible situation (you can't commit a .hgsubstate referring to uncommitted or not existing subrepository changeset).
Any ideas what we could be doing wrong or how this could happen?
edit:not using mq either
To create an unknown (invisible) revision, do like this.
Client 1
Commmit a change in a subrepo
Link the commit in the subrepo with a commit in the subrepo (the subrepo changeset id will be updated in the .hgsubstate file)
Rollback the subrepo commit (now you got yourself a link in the master repo to a non-existing changeset in the subrepo)
Push both repositories to the server
Client 2
Pull from the server
Error occur!

Fixing a failed integrity check in Mercurial?

I just did hg pull on a repository and brought in some changesets. It said to run hg update, so I did. Unfortunately, when I did that, it failed with the following error message:
abort: integrity check failed on 00manifest.i:173!
When I run hg verify, it tells me there are a number of issues with things not in the manifest (with some slight path obscuring):
>hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
somewhere1/file1.aspx#172: in changeset but not in manifest
somewhere2/file1.pdf#170: in changeset but not in manifest checking files
file3.csproj#172: ee005cae8058 not in manifests
somewhere2/file1.pdf#171: 00371c8b9d95 not in manifests
somewhere3/file1.ascx#170: 5c921d9bf620 not in manifests
somewhere4/file1.ascx#172: 23acbd0efd3a not in manifests
somewhere5/file1.aspx#170: ce48ed795067 not in manifests
somewhere5/file2.aspx#171: 15d13df4206f not in manifests
1328 files, 174 changesets, 3182 total revisions
8 integrity errors encountered!
(first damaged changeset appears to be 170)
The source repository passes hg verify just fine.
Is there any way to recover from an integrity check failure or do I need to re-clone the repository completely from the source (not a huge issue in this case)? What could I have done to cause this, so I don't do it again?
Well, since the first damaged changeset is 170, you could clone your local repository to 169 and then pull from the source. That means only pulling 5 changesets.
hg clone -r 169 damagedrepo fixedrepo
cd fixedreop
hg verify
And then:
hg pull originalsource
As for manual recovery of repository corruption, this page expounds on that better than I can. See section 4:
I have found corruption once in a while before, and although the above
documentation says it is usually from user error, my instances were on
removable USB drives with empty working directories. Sometimes things
just don't get written correctly or are interfered with somehow: it's
not always user error. But I always have multiple copies I can reclone
from so I've been able to get away with basic fixing.
If the simple fix of a partial local clone and pulling from the server doesn't fix it, you're down to 2 options after backing up your changes (if any) to a bundle or patches:
Manually hacking at Mercurial's files.
Doing a new full clone from the server. Usually the easier and faster of the two.
Beware: This method will change all hashes.
Actually there is another way to recover the repository when it is corrupted like this -
You can do a complete rebuild of the repository by using the convert extension. See Section 4.5 on https://www.mercurial-scm.org/wiki/RepositoryCorruption#Recovery_using_convert_extension
First enable the convert extension by adding the following to your ~/.hgrc file
[extensions]
convert=
Then convert the bad repo to create a fixed repo:
$ hg convert --config convert.hg.ignoreerrors=True REPO REPOFIX
This worked for me when I had the experience of suddenly finding that there were missing files in the manifests - "error 255".
Try remove your file 00manifest.i from repo and next use hg remove 00manifest.i and hg commit commands. Worked for me.
What we ended up doing was making a new copy of our 'central' repository, deleting the .hg folder in this copy, creating a new repository there (hg init), and then working with this as the central repository.
Be aware however this is only an appropriate solution if you don't need your changeset history other than as a reference (which we don't). You can still use your old central repository for this purpose.

Mercurial HG Update Exited With Status 255

When remotely updating a Mercurial Repository, I am getting the following error from the hg update command that is being run on the remote server after the push. I looked around online for some help for this however was unsuccessful in finding anything useful. At this point, I am hoping for some ideas and / or insight as to what would be causing this problem.
The error is just below. It occurred when pushing two changesets. One changeset included an unrelated index.html file change. The other changeset was a merge, which included the index.html change as well as the renaming of the two image files.
levinaris#server01:/home/web/repository$ hg push
pushing to ssh://10.10.1.12//home/web/repository
searching for changes`remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 2 changesets with 1 changes to 1 files
remote: abort: Operation not permitted: /home/web/repository/html/images/image.gif
remote: warning: changegroup hook exited with status 255
Additional details:
Both images are 10385 bytes in size. (yes, this error occurs on two images I have)
The two images had their names changed in changesets that were already pushed and hg updated due to case-folding collisions when attempting to pull the repositories down to Windows PCs.
The target server has the following hook in /etc/mercurial/hgrc:
[hooks]
changegroup = hg update
As a work-around, I did the following:
Deleted image.gif.
Deleted another image file that produced the error.
Ran hg update - success!
Ran hg revert html/image/image.gif
Ran hg revert html/image/otherimage.gif
At this point, I am trying to better understand the cause of this problem, so that I can ensure a solid, easy-to-use implementation in my environment. I really appreciate your help!!
After using hg --debug update in the hook, I received this output:
levinaris#server01:/home/web/repository$ hg push
pushing to /home/web/staging/repository
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 1 changes to 1 files
resolving manifests
overwrite False partial False
ancestor 58a5edb95c9a local 58a5edb95c9a+ remote 3aafb97b148c
searching for copies back to rev 6
html/index.php: remote is newer -> g
html/images/otherimage.gif.casefolding: update permissions -> e
html/images/image.gif: update permissions -> e
abort: Operation not permitted: /home/web/staging/repository/html/images/image.gif
warning: changegroup hook exited with status 255
Additional Permission Information:
All 3 files in the 2 changesets have 775 permission with the webuser:dev user:group.
My Global hgrc file has the webuser trusted
[trusted]
users = webuser
Is it possible that the permissions that file on the server were such that it couldn't be overwitten by the person doing the push?
If, for example, two different people have done that push (and thus update) the second person isn't going to be able to overwrite the files created by the first person's push triggered update.
Maybe try changing the hook to this for a test (you don't actually have those single quotes on your hook, right?):
[hooks]
changegroup = hg --debug update
If it is a permissions issue the usual fix is to put everyone who will be pushing and updating into the same group (I call mine 'hg') and then using the sticky group bit on all the directories in the repo to make sure new files have that group.