4
votes

I use Mercurial and i have a weird problem, i have a very big history and the local revisions in Mercurial now has 5 characters. In Mercurial you can execute "hg up " and it can choose between the local revision or the hash changeset ( i have no idea the policy it uses to choose between each other ), in my case the local revision coincide with the 5 first characters of another hash changeset. For example:

I want to update to the local revision: 80145 If i execute:

"hg up 80145"

Mercurial doesn't update to the revision i want, it updates to an old one because its hash changeset is:

801454d1cd5e

So, does anyone know if there is a way to specify to which type of revision you want to update to? local revision or hash changeset.

Thanks all!

====

Problem solved. After some investigation i realized that Mercurial always update to the local revision if it exists, and to the hash changeset otherwise. In my case the local revision didn't exist, so it was updating to the hash changeset

1

1 Answers

2
votes

Sounds like you found your own answer (and should enter it as an answer instead of a comment and then select it -- that's not just allowed but encouraged around here), but for reference here's where that information lived:

$ hg help revisions
Specifying Single Revisions

Mercurial supports several ways to specify individual revisions.

A plain integer is treated as a revision number. Negative integers are
treated as sequential offsets from the tip, with -1 denoting the tip, -2
denoting the revision prior to the tip, and so forth.

A 40-digit hexadecimal string is treated as a unique revision identifier.

A hexadecimal string less than 40 characters long is treated as a unique
revision identifier and is referred to as a short-form identifier. A
short-form identifier is only valid if it is the prefix of exactly one
full-length identifier.

Any other string is treated as a bookmark, tag, or branch name. A bookmark
is a movable pointer to a revision. A tag is a permanent name associated
with a revision. A branch name denotes the tipmost revision of that
branch. Bookmark, tag, and branch names must not contain the ":"
character.

The reserved name "tip" always identifies the most recent revision.

The reserved name "null" indicates the null revision. This is the revision
of an empty repository, and the parent of revision 0.

The reserved name "." indicates the working directory parent. If no
working directory is checked out, it is equivalent to null. If an
uncommitted merge is in progress, "." is the revision of the first parent.

So as you found the first interpretation was as a revision number and when that didn't match anything it was tried as the prefix of a revision id. In theory this could happen with even the number 1 if your only changeset was revision 0 and its hash started with 1.