How can I find my working revision in mercurial

前端 未结 6 525
独厮守ぢ
独厮守ぢ 2021-02-01 12:27

In a mercurial repo I can run hg up {revision} to change the revision of my working directory, but what command can I run to discover what revision I\'m looking at?

6条回答
  •  深忆病人
    2021-02-01 12:44

    The most specific non-DEPRECATED command which due to the presence of --template can print only revision information if that conciseness is required (as implied by the question):

    hg log -l 1 -b . -T '{rev}:{node|short}\n'

    Or:

    hg log -l 1 -b . -T '{rev}\n'

    Or:

    hg log -l 1 -r . -T '{rev}\n'

    Or for unique long form of hash:

    hg log -l 1 -r . -T '{node}\n'

    The -b . or branch(.) (dot for branch name) means the current working directory branch and -r . means the current working directory revision, which is documented in hg help revsets and hg help revisions.

    Note if there is an uncommitted merge, the . (dot) only displays the first parent of two parents of the working group.

提交回复
热议问题