Negative revision when checking HG repository - mercurial

I'm getting errors when pushing and pulling from a repo on a server. We have a repository (a folder) on a LAN-server which we push our commits to. This worked from the beginning but now it seems to not find the changesets on the server anymore, so tortoisehg ends up by trying to push all the revisions it locally has, to the server.
Also, when I view the repository on the LAN-server in HG workbench, it doesn't show any revision, the only one I can see is a revision -1?
So my question is, what have could gone wrong? And is there a way to fix this? I already replaced the repository on the server with my local one, and that went well for a few days until it happened again.

Revision -1 is what mercurial shows on an empty repository right after a hg init without any commit whatsoever.
If your LAN server exports the repository over a windows network share, indeed it might have been a serious bug fixed in Mercurial 3.3.2 (see https://bz.mercurial-scm.org/show_bug.cgi?id=4546 - maybe you can reproduce that with a new test repo. Upgrade, if that's the case for you)

What Mercurial version are you using?
It's possible that you have been impacted by the bug fixed in Mercurial 3.3.2 (released yesterday).
The solution in that case is to upgrade to Mercurial 3.3.2.

Related

Mercurial branch using clone - how to share

I would like to know how is it supposed to do the following in mercurial.
My repository is on our server where mercurial-server is running. I develop on Windows and because my project is supposed to be multiplatform, I've set up Jenkins build server which builds using a Linux slave machine automatically after each push.
Now what I need:
Quite often the build on Linux does not work, because I'm using "treat warnings as errors" and gcc gives different warnings than MSVC. Then I need to fix the build and I don't want to mess the repository with "fixing" commits (often more commits are needed to fix all gcc warnings). It would be ok for me to have a single commit in the repo for a fix of the linux build.
I thought I could just clone the repository to a 'fixing repo' (like a branch using clone) and do as many fixing commits as needed. Then just merge all these commits to the main repo as a single fixing commit. But then I need to make my 'fixing repo' public (i.e. clone the fixing repo to the remote server) to allow jenkins to build the sources. But how to get rid of the 'fixing repo' when the fix is finished? It is probably not a good idea to allow users delete remote repositories, is it?
Possibilities I see:
1) forgot about branching using clone, do a named branch, fix, merge to master branch and close the fixing branch - probably not a common solution in mercurial to create a named branch for this
2) just create a new head (possibly set a bookmark), fix, merge to master head (branch) and close the fixing head (can I close a head?) - better but I still have to do with all fixing commits in the main repository
3) using the cloned 'fixing repo', set up ssh access or even mercurial-server for Jenkins to my personal machine and let it clone from it, build and when the build is fixed, just merge all commit from local 'fixing repo' to remote repository as a single commit
Some better solution? Or do I want to do something unusual?
Thanks.

hg largefile XXX missing from store (needs to be uploaded)

A coworker got this error after pulling from the repo. I searched for an answer online on how to solve it but couldn't find anything. I figured out a way to solve it so posting it below for anyone else with the same issue.
I asked everyone else working on the repository to check their user cache folder (C:\Users\username\AppData\Local\largefiles on Windows) to see if they had a file with that id ("XXX" from the title).
One of them did, the original author of the file.
I asked him to send it to me, I remote connected to the server that has the central repo. I then copied the file both to the server's cache and into .hg\largefiles
The user could then pull again and push and everything worked.
LF extension seems not compatible with keyword extension.
With these both extensions, at the commit, the LF is NOT put in the configured folder on the PC and then raises this error at push.
If you disable the keyword extension, it's perfectly working.
Unfortunately, I've not found any additional explanations.
If someone could provide a stable solution, it will be great.
It looks like hg pull is happily sparse, but hg push is not; thus you need all largefiles for every revision not already present on the new remote, so that it can populate for history and allow clients to successfully pull at any revision. Which makes sense.
When migrating to a new hg server, I hit this issue. The "within Mercurial" solution was to download all largefiles, for all commits, to my local repo, and then push to the new server repo:
$ hg lfpull --rev 1-tip
$ hg push newbox
(Disclaimer: my Mercurial-fu is weak, I only use it for this one largefile repo)

How to clone Mercurial to Subversion?

I'm a VERY happy user of bitbucket and mercurial after years of putting up with subversion (and CVS, SourceSafe and others; anybody remember SCCS?). I've considerable project history now in my local hg repo, pushed daily to bitbucket and thence to my home machines.
Problem is, my company wants me to maintain a copy of this history in subversion. And I've hit a stone wall trying to set this up. I've installed hgsubversion, I think correctly. And I've used svnadmin to create an empty svn repository ready to hold the hg history.
But now what? The instructions say to start by pulling a clone (of nose? what's that? I assume this means checkout a copy of the new empty svn directory. OK did that.
But now what? I assume the next step is to push my real local hg clone to the empty svn repo I just checked out. But nothing I've tried will do this. Pull fails as follows, reporting "unrelated repository" (as I recall I gate it the URL of my master local hg repo to get around the "Needs a URL" popup on everything else I've tried.
found new changeset 139d02f4b233
examining 4e97a23b6815:342df9e52cec
abort: repository is unrelated
[command returned code 255 Mon Apr 25 11:29:33 2011]
The result of all this fumbling around is a directory with .hg, .svn and .hgignore entries and nothing else.
So, I feel I'm missing something basic that hundreds of others must have tried by now. Can someone please help me get started? Thanks!
PS: Currently the intent is to maintain SVN permanently as the team repo and push changes there from Hg periodically which would remain the main client for me indefinitely. In case this matters...
You can use the convert extension:
hg convert --dest-type svn mercurialrepo svnrepo
And hgsubversion allows you keep both of them in sync ( bidirectional)
Answered here at SO already:
Converting from Mercurial to Subversion
Migrating from Mercurial to Subversion
Perhaps look at the answers to this question.
Hgsubversion is for working with a repository cloned from SVN using Hg, not the other way around.

mercurial repository corruption

I’m new to mercurial, about 2 months now. We are using it on a new project and tried to create a new repo, a clone of the trunk, to be used as release “branch”.
We use a central repo, everyone is pulling/pushing to/from it over https using hgwebdir.cgi. Using on server hg 1.5.4 and “clients” various versions, 1.5.2 -> 1.6.3
Everything thing was ok. The clone was good (hg verify after clone), the only problem is that very soon this repo got corrupted (empty or missing ; in manifests not found).
The main repo is ok, only this release get broken very soon.
The names of the repos are (folder names and published names, all reside in the same root folder):
A.B – for the trunk
A.B.Release – for the release repo
(read something in the docs, which sounded like this might be a issue – see
One other very strange thing is that checkins made only to trunk (A.B) are seen as available on the release branch, and they are displayed as errors on verify ( in manifests not found). Don’t understand how these got there.
Any clues?
It's not an answer, but I'll state that what you're doing is definitely supposed to work. Making sure the wire-protocol has full backwards compatibility is very important to the Mercurial folks.
The "cross-talk" between your two repos is very concerning and shouldn't happen unless someone erroniously used the share extension.
What if you try creating the A.B.Release clone by using clone --pull rather than clone by itself?

"Case folding" error trying to clone a mercurial repo

I try to clone a local mercurial repository on windows.
I get this error:
C:\temp\toolkit1.1>hg clone \src\toolkit
destination directory: toolkit
updating working directory
abort: case-folding collision between sdk/Api.h and sdk/api.h
It looks like I changed capitalization of API.H at some point, but I don't know how to resolve this. Any tips?
I am using the version: 1.2.1
This is a problem that sometimes occurs when you work with a Mercurial repository on a case-insensitive file system (Windows). See the Fixing Case Collisions on the Mercurial wiki.
Probably the easiest is if you have access to a Unix computer check out the project there and remove the offending file, merging changes first (if any), then commit and push.
I fixed this by renaming the file in windows to Api.h.old. Committing that. Then renaming to Api.h with corrected capitalization. Commiting again.
Then clone worked.