2

There is a commit in my hg repository with hash 123abc. This is the last commit I made in the repo. When I run hg diff --from 123abc, I see no output. When I run hg log --graph, I see an @ next to 123abc.

In Git this commit would be called "HEAD". I'm not sure what it's called in Mercurial. It is not the "tip", because I pulled other changes after the last time I committed (and hg log -r tip shows commit 456def).

What is this commit/head called?

Kerrick Staley
  • 1,583
  • 2
  • 20
  • 28

2 Answers2

2

Mercurial calls this the "parent" or the "parent revision of the working directory", and you can see it by running hg parent, hg id, or hg summary.

You can refer to it as . with the hg log command:

hg log -r .  # show the commit message for the parent
Kerrick Staley
  • 1,583
  • 2
  • 20
  • 28
1

If 123abc has no children, then it is a "head".

A head is a changeset with no child changesets. The tip is the most recently changed head. Other heads are recent pulls into a repository that have not yet been merged.

(https://www.mercurial-scm.org/wiki/Head)


Regardless whether the current working directory derives from a head or a non-head, I would refer to the commit that precedes it as the "working directory parent" changeset or commit. (That may just be the term my team uses - not sure it is "official".)

The parent may be visible in a GUI tool (like Tortoise) or you can get it using hg parent.


Based on the statements about 456def I'm a little confused whether it has no children, or not? (Maybe update the question to clarify / add more detail)

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
  • But what is the name of the specific head that corresponds to the files I can see in my repository? It's not just any head, it's special. What is it called? – Kerrick Staley Feb 14 '22 at 17:09
  • Are you asking, if and only if the working directory corresponds to a head, what is the special name for that head? I don't think I've ever heard a special term for that, not that this proves there isn't one. – StayOnTarget Feb 14 '22 at 17:11
  • Regardless whether the current working directory derives from a head or a non-head, I would refer to the commit that precedes it as the "working directory parent" changeset or commit. That may just be the term my team uses. – StayOnTarget Feb 14 '22 at 17:13
  • I think "parent of the working directory" is what I want. You can get it by running "hg parent" (although that command says that it is deprecated). Thanks! – Kerrick Staley Feb 14 '22 at 17:20
  • Related: https://stackoverflow.com/questions/4330631/how-can-i-find-my-working-revision-in-mercurial – Kerrick Staley Feb 14 '22 at 17:21
  • I happen to use the Tortoise HG GUI which always makes the parent easily visible, but yes `hg parent` should be the same thing. – StayOnTarget Feb 14 '22 at 17:21