Question

I'm working on a golang dependency manager, and I need help with one aspect of Mercurial. I want to grab a remote repository, then reset it to a particular revision. I can do this using hg update -r rev, and that works. But the problem with that is that it doesn't reset the local repository so that hg incoming works as I'd expect it to, which is to show me all commits between the now current revision on my local repository and the tip of the remote repository. I can do this with git, using git reset --hard rev. Anything similar in Mercurial?

Was it helpful?

Solution

Since you talk about grabbing the remote repository, I assume you're cloning it. In that case, you should probably simply clone up to the revision you want:

$ hg clone http://server/repo -r revision_you_want

That will simply clone all revisions up to the specified revision and hg incoming will then show you the later revisions.

If you don't know the revision you want before you've cloned the repository, then you can use hg strip to delete the extra revisions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top