{"issue":{"created_at":"2011-09-02T08:44:54Z","state":"open","updated_at":"2011-11-23T23:34:36Z","comments":4,"user":{"gravatar_id":"9e211bd21b9441c3176d4258892cbfc1","id":277318,"url":"https://api.github.com/users/mcclure","login":"mcclure","avatar_url":"https://secure.gravatar.com/avatar/9e211bd21b9441c3176d4258892cbfc1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"A thing I've noticed while using hg-git is that when I interact with git users, maybe I'll be talking to another developer or I'll be looking at the github page, periodically someone will say something about \"revision 4898e\" and I'll have no idea what that means and no way to look it up, because all the hashes in MY copy of the repository are in hg format. The git users and I do not have a common way of referring to revisions that we both understand, unless someone wrote really good commit messages. In an attempt to address this I made three changes:\r\n\r\n* There is now an `hg gsummary` or `hg gsum` which prints the git-equivalent revision number (if any) of the current working directory state. It looks like:\r\n\r\n```git-rev: 4898e77458a287789dd5f42b51685f84d1fdf431```\r\n\r\n* You may now, in any hg command which would normally take an hg revision number, hg revision hash, or tag, just haul off and use a git revision number, like `hg up 4898e` to get the git revision from my example above. \r\n\r\n(A small note: If you say `hg up 4898e`, and 4898e as a prefix just happens to match both an hg revision and a git revision, the current code will silently use the hg revision. You can specify you wanted the git revision by using a \"g\" prefix to the revision number, like `hg up g4898e`.)\r\n\r\n* Most commands which show information about a changeset will now voluntarily mention the git revision number (if any) along with the tags, etc for that changeset. For example `hg sum` now looks like:\r\n\r\n```parent: 432:2740d263255c git:4898e77458a2 default/default/master default/master tip master\r\n Mercurial 1.8 compatibility for git-rev show\r\nbranch: default\r\ncommit: 1832 unknown (clean)\r\nupdate: (current)```\r\n\r\nAnd lines in `hg log` now look like:\r\n\r\n```changeset:   431:9d486e95cf37\r\ngit-rev:     bd372664271b\r\nuser:        mcc <andrew.mcclure@gmail.com>\r\ndate:        Fri Sep 02 00:49:22 2011 -0700\r\nfiles:       hggit/__init__.py hggit/hgrepo.py\r\ndescription:\r\ngit-rev code cleanup```\r\n\r\nThe overall goal was to make addressing a revision by git-revision number as seamless as addressing it by tag or bookmark.\r\n\r\nThe patch also adds to the tests/ directory a small script I wrote named virtualenv-setup.py which uses virtualenv to locally deploy some self-contained copies of mercurial using specific known versions of mercurial and dulwich. This might be redundant with some of the existing test scripts but I found it helpful. I used this to test this checkin back to 1.8.\r\n\r\nDoes this sound good? Two caveats I have noticed:\r\n\r\n- The hg sum / hg log additions only appear if you are not using styles or templates. I think this is desirable, BUT I think that some change should be made such that *if* someone wants to write a template which is aware of hg-git, there should be some way for that template to read the git-revision of a changeset it is displaying. I don't know a lot about the template system though so I couldn't really figure out how to do this (though I've made a post to the mercurial mailing list asking for help).\r\n\r\n- For reasons I don't really understand, this doesn't work with `hg outgoing`. git revisions are not displayed in hg outgoing even if they are known.\r\n\r\nEDIT: Here's my mercurial mailing list post btw, it includes gory implementation details for the above if that interests you. http://selenic.com/pipermail/mercurial-devel/2011-September/034064.html","assignee":null,"id":1549266,"number":233,"pull_request":{"patch_url":"https://github.com/schacon/hg-git/pull/233.patch","html_url":"https://github.com/schacon/hg-git/pull/233","diff_url":"https://github.com/schacon/hg-git/pull/233.diff"},"labels":[],"title":"Enable use and display of git revision numbers","closed_at":null,"html_url":"https://github.com/schacon/hg-git/issues/233","milestone":null,"url":"https://api.github.com/repos/schacon/hg-git/issues/233"},"action":"created","comment":{"created_at":"2011-11-23T23:34:36Z","updated_at":"2011-11-23T23:34:36Z","user":{"gravatar_id":"9e211bd21b9441c3176d4258892cbfc1","id":277318,"url":"https://api.github.com/users/mcclure","login":"mcclure","avatar_url":"https://secure.gravatar.com/avatar/9e211bd21b9441c3176d4258892cbfc1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"So to update, there was some discussion about this on the hg git google group / mailing list (where I posted the ~12 commits above as 3 patches broken down by feature). I *believe* the conclusion was that the \"reference by git-id\" patch was a candidate for inclusion but that my for printing git revisions in hg sum, hg log etc. was a little too brute force and I should instead explore an alternate method of inserting the git-rev information based on leveraging the hg template feature. However I don't know how to do this and I haven't since had sufficient time to research it. (In the meantime I've just been using my fork on my personal machines...)\r\n\r\nIf anyone with a little more understanding of Mercurial than me could assist with converting the git-rev display mechanism to use templates, I think it would help a lot with getting these changes integrated.","id":2856470,"url":"https://api.github.com/repos/schacon/hg-git/issues/comments/2856470"}}