{"thread":{"id":"51647","subject":"git log --graph with a sort of local revision number","startedAt":"2019-08-15T08:35:32Z","lastAt":"2019-08-21T12:37:49Z","messageCount":13,"participants":["Uwe Brauer","Rafael Ascensão","SZEDER Gábor","Junio C Hamano","Phil Hord"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"380469","messageId":"87blwq7rn5.fsf@mat.ucm.es","threadId":"51647","inReplyTo":null,"subject":"git log --graph with a sort of local revision number","fromName":"Uwe Brauer","fromEmail":"oub@mat.ucm.es","sentAt":"2019-08-15T08:35:26Z","receivedAt":"2019-08-15T08:35:32Z","isPatch":false,"sender":{"key":"oub@mat.ucm.es","avatar":null},"body":"\n\nHi\n\nI am an occasionally git user and am very used to local revision numbers\nmercurial provides in its log command. I don't want to start the\ndiscussion whether  local revision numbers are useful or not, nor\nwhether mercurial is better or not.\n\nI only want to know whether there is any possibility to have this number\nin the log.\n\nI have seen \n\nhttps://stackoverflow.com/questions/4120001/what-is-the-git-equivalent-for-revision-number\n\nThat \ngit rev-list --count HEAD\n\nBut I would like to have it in the \n\n git log --graph --decorate\n\nSo something like this \n\no  changeset:   5:d3ae13222c31\n|  tag:         tip\n|  user:        Uwe Brauer <oub@mat.ucm.es>\n|  date:        Wed Aug 14 14:23:29 2019 +0200\n|  summary:     Six\n|\no  changeset:   4:64a3eee07e93\n|  user:        Uwe Brauer <oub@mat.ucm.es>\n|  date:        Wed Aug 14 14:23:28 2019 +0200\n|  summary:     Fifth\n\n\nAnybody know who to achieve it?\n\nI presume \n\n git checkout revnumber\n\nWould not work?\n\nI know that \n\n git checkout HEAD~somenumber\n\nWorks\n\nUwe Brauer \n"},{"id":"380633","messageId":"20190818190032.GA11185@rigel","threadId":"51647","inReplyTo":"87blwq7rn5.fsf@mat.ucm.es","subject":"Re: git log --graph with a sort of local revision number","fromName":"Rafael Ascensão","fromEmail":"rafa.almas@gmail.com","sentAt":"2019-08-18T19:00:32Z","receivedAt":"2019-08-18T19:01:16Z","isPatch":false,"sender":{"key":"rafa.almas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1923789?v=4"},"body":"You can achieve something close (on small repos, more on that later) with:\n\n$ git log --graph --color \\\n  --format='%C(auto)changeset: %h:%H%nuser:      %an%ndate:      %ad%nsummary:   %s%n' \\\n  | git name-rev --refs=$(git rev-parse --abbrev-ref HEAD) --name-only --stdin\n\n\n    * changeset: 5fa0f52:master\n    | user:      Junio C Hamano\n    | date:      Fri Aug 16 10:28:23 2019 -0700\n    | summary:   Git 2.23\n    |\n    *   changeset: 8e0fa0e:master~1\n    |\\  user:      Junio C Hamano\n    | | date:      Fri Aug 16 10:22:51 2019 -0700\n    | | summary:   Merge tag 'l10n-2.23.0-rnd2' of git://github.com/git-l10n/git-po\n    | | \n    | * changeset: a6cd2cc:master~1^2\n    | | user:      Jiang Xin\n    | | date:      Tue Jul 30 10:02:22 2019 +0800\n    | | summary:   l10n: zh_CN: for git v2.23.0 l10n round 1~2\n\nAnd in this case, since we are using HEAD to describe the commits by\nusing --refs=$(git rev-parse --abbrev-ref HEAD), you can refer to\na6cd2cc either as master~1^2 or HEAD~1^2.\n\nNow, git-name-rev has some memory/performance problems in repos with a\nhigh number of references. Alban Gruin was working on this issue[1], but\nI don't know what's the status of it.\n\n[1]:https://github.com/agrn/git/tree/ag/fix-name-rev-leak\n"},{"id":"380634","messageId":"87k1bamghg.fsf@mat.ucm.es","threadId":"51647","inReplyTo":"20190818190032.GA11185@rigel","subject":"Re: git log --graph with a sort of local revision number","fromName":"Uwe Brauer","fromEmail":"oub@mat.ucm.es","sentAt":"2019-08-18T19:16:27Z","receivedAt":"2019-08-18T19:16:40Z","isPatch":false,"sender":{"key":"oub@mat.ucm.es","avatar":null},"body":">>> \"RA\" == Rafael Ascensão <rafa.almas@gmail.com> writes:\n\n   > You can achieve something close (on small repos, more on that later) with:\n   > $ git log --graph --color \\\n   >   --format='%C(auto)changeset: %h:%H%nuser:      %an%ndate:      %ad%nsummary:   %s%n' \\\n   >   | git name-rev --refs=$(git rev-parse --abbrev-ref HEAD) --name-only --stdin\n\nHi thanks, this was precisely what I was looking for. However \n\nI run \n\n git log --graph --color --format='%C(auto)changeset: %h:%H%nuser:      %an%ndate:      %ad%nsummary:   %s%n'   | git name-rev --refs=$(git rev-parse --abbrev-ref HEAD) --name-only --stdin\n\nAnd it does not work\n\n git log --graph --color --format='%C(auto)changeset: %h:%H%nuser:      %an%ndate:      %ad%nsummary:   %s%n'   \n\nWorks but what comes after the pipe is not recognized\nI obtain\n\n\nIllegal variable name.\n\n\nI am running \n\n\ngit --version\ngit version 2.7.4\n"},{"id":"380681","messageId":"87blwmmcbp.fsf@mat.ucm.es","threadId":"51647","inReplyTo":"20190818190032.GA11185@rigel","subject":"Re: git log --graph with a sort of local revision number","fromName":"Uwe Brauer","fromEmail":"oub@mat.ucm.es","sentAt":"2019-08-18T20:46:18Z","receivedAt":"2019-08-18T20:46:32Z","isPatch":false,"sender":{"key":"oub@mat.ucm.es","avatar":null},"body":">>> \"RA\" == Rafael Ascensão <rafa.almas@gmail.com> writes:\n\n   > You can achieve something close (on small repos, more on that later) with:\n   > $ git log --graph --color \\\n   >   --format='%C(auto)changeset: %h:%H%nuser:      %an%ndate:      %ad%nsummary:   %s%n' \\\n   >   | git name-rev --refs=$(git rev-parse --abbrev-ref HEAD) --name-only --stdin\n\nOk I see this is bash syntaxes.\n\nIn that case it works, but I see\n\n* changeset: f40c01e:f40c01e41afbb87c7321147242354d46ddaee231\n| user:      Uwe Brauer\n| date:      Thu Aug 15 15:13:00 2019 +0200\n| summary:   This is a test.\n|\n* changeset: 4dcf721:4dcf721042cd8f73d78876caf8f4796153c07023\n| user:      Uwe Brauer\n| date:      Wed Aug 14 14:33:29 2019 +0200\n| summary:   Third\n|\n* changeset: 93083c8:93083c8b65141047c8346765fb663d5962076246\n| user:      Uwe Brauer\n| date:      Wed Aug 14 14:33:29 2019 +0200\n| summary:   Second\n|\n* changeset: f59470f:f59470feb19d325accaad634025c229d6977df65\n  user:      Uwe Brauer\n  date:      Wed Aug 14 14:33:29 2019 +0200\n  summary:   First commit\n\nBut on the GNU emacs repository which is reasonable old (has about 130\n000 commits) and is around 700 MB, your command gives:\n\n\n* changeset: ee1c638:master\n| user:      Lars Ingebrigtsen\n| date:      Sat Aug 17 17:30:42 2019 -0700\n| summary:   Make `browse-url-of-buffer' work from zip files\n|\n* changeset: 3d1c9a7:master~1\n| user:      Paul Eggert\n| date:      Sat Aug 17 17:19:13 2019 -0700\n| summary:   Fix org-timer-show-remaining-time > 1 hour\n|\n* changeset: f38a16e:master~2\n| user:      Lars Ingebrigtsen\n| date:      Sat Aug 17 16:56:13 2019 -0700\n| summary:   Make `describe-function' say that disabled functions are disabled\n|\n* changeset: 3efe59a:master~3\n| user:      Lars Ingebrigtsen\n| date:      Sat Aug 17 16:47:16 2019 -0700\n| summary:   Make newline-and-indent take a numeric prefix\n\nWhich is precisely what you said.\n\n\nWhat did I do wrong in my test repo?\n\nWhich I generated via the following script\n\n\ngit init\necho \"First\" > test.org\ngit add test.org\ngit add create.sh\ngit commit -a -m \"First commit\"\necho \"Second\" >> test.org\ngit commit -a -m \"Second\"\necho \"Third\" >> test.org\ngit commit -a -m \"Third\"\necho \"Forth\" >> test.org\ngit commit  -a -m \"Fourth\"\necho \"Fifth\" >> test.org\ngit commit  -a -m \"Fifth\"\necho \"Six\" >> test.org\ngit commit  -a -m \"Six\"\n\n\n   >     * changeset: 5fa0f52:master\n   >     | user:      Junio C Hamano\n   >     | date:      Fri Aug 16 10:28:23 2019 -0700\n   >     | summary:   Git 2.23\n   >     |\n   >     *   changeset: 8e0fa0e:master~1\n   >     |\\  user:      Junio C Hamano\n   >     | | date:      Fri Aug 16 10:22:51 2019 -0700\n   >     | | summary:   Merge tag 'l10n-2.23.0-rnd2' of git://github.com/git-l10n/git-po\n   >     | | \n   >     | * changeset: a6cd2cc:master~1^2\n   >     | | user:      Jiang Xin\n   >     | | date:      Tue Jul 30 10:02:22 2019 +0800\n   >     | | summary:   l10n: zh_CN: for git v2.23.0 l10n round 1~2\n\n   > And in this case, since we are using HEAD to describe the commits by\n   > using --refs=$(git rev-parse --abbrev-ref HEAD), you can refer to\n   > a6cd2cc either as master~1^2 or HEAD~1^2.\n\n   > Now, git-name-rev has some memory/performance problems in repos with a\n   > high number of references. Alban Gruin was working on this issue[1], but\n   > I don't know what's the status of it.\n\n   > [1]:https://github.com/agrn/git/tree/ag/fix-name-rev-leak\n"},{"id":"380682","messageId":"8736hymbw0.fsf_-_@mat.ucm.es","threadId":"51647","inReplyTo":"87blwmmcbp.fsf@mat.ucm.es","subject":"[SOLVED] (was: git log --graph with a sort of local revision number)","fromName":"Uwe Brauer","fromEmail":"oub@mat.ucm.es","sentAt":"2019-08-18T20:55:43Z","receivedAt":"2019-08-18T20:56:59Z","isPatch":false,"sender":{"key":"oub@mat.ucm.es","avatar":null},"body":">>> \"UB\" == Uwe Brauer <oub@mat.ucm.es> writes:\n\n>>> \"RA\" == Rafael Ascensão <rafa.almas@gmail.com> writes:\n   >> You can achieve something close (on small repos, more on that later) with:\n   >> $ git log --graph --color \\\n   >> --format='%C(auto)changeset: %h:%H%nuser:      %an%ndate:      %ad%nsummary:   %s%n' \\\n   >> | git name-rev --refs=$(git rev-parse --abbrev-ref HEAD) --name-only --stdin\n\nThe script to generate a test repo is\ngit init\necho \"First\" > test.org\ngit add test.org\ngit add create.sh\ngit commit -a -m \"First commit\"\ngit checkout master   \necho \"Second\" >> test.org\ngit commit -a -m \"Second\"\necho \"Third\" >> test.org\ngit commit -a -m \"Third\"\necho \"Forth\" >> test.org\ngit commit  -a -m \"Fourth\"\necho \"Fifth\" >> test.org\ngit commit  -a -m \"Fifth\"\necho \"Six\" >> test.org\ngit commit  -a -m \"Six\"\n\nThen your command even in a short shell script\n#!/bin/bash\n git log --graph --color --format='%C(auto)changeset: %h:%H%nuser:      %an%ndate:      %ad%nsummary:   %s%n'   | git name-rev --refs=$(git rev-parse --abbrev-ref HEAD) --name-only --stdin | more\n\n\nWorks as you described.\n\nThanks\n\nUwe Brauer \n"},{"id":"380802","messageId":"87pnkzkivn.fsf_-_@mat.ucm.es","threadId":"51647","inReplyTo":"20190818190032.GA11185@rigel","subject":"[problem with name-rev] (was: git log --graph with a sort of local revision number)","fromName":"Uwe Brauer","fromEmail":"oub@mat.ucm.es","sentAt":"2019-08-20T14:32:12Z","receivedAt":"2019-08-20T14:32:24Z","isPatch":false,"sender":{"key":"oub@mat.ucm.es","avatar":null},"body":">>> \"RA\" == Rafael Ascensão <rafa.almas@gmail.com> writes:\n\n   > You can achieve something close (on small repos, more on that later) with:\n   > $ git log --graph --color \\\n   >   --format='%C(auto)changeset: %h:%H%nuser:      %an%ndate:      %ad%nsummary:   %s%n' \\\n   >   | git name-rev --refs=$(git rev-parse --abbrev-ref HEAD) --name-only --stdin\n\n\nIt seems that there is problem with name-rev.\n\nHere's what I get when I start committing on master, then switch to a\nbranch foo and finally merge foo into master:\n\ngit init \necho 1 > 1\ngit add 1\ngit commit -m 1\necho 1.1 > 1\ngit add .\ngit commit -m 1.1\ngit checkout -b foo master~1\necho 1.2 > 1\ngit add .\ngit commit -m 1.2\necho 1.2.1 > 1\ngit add .\ngit commit -m 1.2.1\ngit checkout master\ngit merge foo\necho 1.2.1/1.1 > 1\ngit add .\ngit commit -m \"1.2.1/1.1\"\n\nThen \n git log --graph --color --format='%C(auto)changeset: %h:%H%nuser:      %an%ndate:      %ad%nsummary:   %s%n'   | git name-rev --refs=$(git rev-parse --abbrev-ref HEAD) --name-only --stdin | more\n\nGives\n*   changeset: ae68dbe:master\n|\\  user:      Uwe Brauer\n| | date:      Tue Aug 20 16:25:53 2019 +0200\n| | summary:   1.2.1/1.1\n| |\n| * changeset: c00bb5d:master^2\n| | user:      Uwe Brauer\n| | date:      Tue Aug 20 16:25:53 2019 +0200\n| | summary:   1.2.1\n| |\n| * changeset: 54c9230:master^2~1\n| | user:      Uwe Brauer\n| | date:      Tue Aug 20 16:25:53 2019 +0200\n| | summary:   1.2\n| |\n* | changeset: da0712f:master~1\n|/  user:      Uwe Brauer\n|   date:      Tue Aug 20 16:25:53 2019 +0200\n|   summary:   1.1\n|\n* changeset: 8eb999d:master~2\n  user:      Uwe Brauer\n  date:      Tue Aug 20 16:25:53 2019 +0200\n  summary:   1\n\nThat looks odd.\n\nAny comments?\n\nUwe Brauer\n"},{"id":"380803","messageId":"20190820150631.GW20404@szeder.dev","threadId":"51647","inReplyTo":"87pnkzkivn.fsf_-_@mat.ucm.es","subject":"Re: [problem with name-rev] (was: git log --graph with a sort of local revision number)","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-08-20T15:06:31Z","receivedAt":"2019-08-20T15:06:37Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Tue, Aug 20, 2019 at 04:32:12PM +0200, Uwe Brauer wrote:\n> Here's what I get when I start committing on master, then switch to a\n> branch foo and finally merge foo into master:\n\n> *   changeset: ae68dbe:master\n> |\\  user:      Uwe Brauer\n> | | date:      Tue Aug 20 16:25:53 2019 +0200\n> | | summary:   1.2.1/1.1\n> | |\n> | * changeset: c00bb5d:master^2\n> | | user:      Uwe Brauer\n> | | date:      Tue Aug 20 16:25:53 2019 +0200\n> | | summary:   1.2.1\n> | |\n> | * changeset: 54c9230:master^2~1\n> | | user:      Uwe Brauer\n> | | date:      Tue Aug 20 16:25:53 2019 +0200\n> | | summary:   1.2\n> | |\n> * | changeset: da0712f:master~1\n> |/  user:      Uwe Brauer\n> |   date:      Tue Aug 20 16:25:53 2019 +0200\n> |   summary:   1.1\n> |\n> * changeset: 8eb999d:master~2\n>   user:      Uwe Brauer\n>   date:      Tue Aug 20 16:25:53 2019 +0200\n>   summary:   1\n> \n> That looks odd.\n\nWhat exactly do you think looks odd?  That \"master^2~1\", perhaps?\nThat's how commits on different branches are named, see 'man\ngitrevisions', and 'git name-rev' works as designed.\n\n"},{"id":"380820","messageId":"20190820174929.GA6753@rigel","threadId":"51647","inReplyTo":"87pnkzkivn.fsf_-_@mat.ucm.es","subject":"Re: [problem with name-rev] (was: git log --graph with a sort of local revision number)","fromName":"Rafael Ascensão","fromEmail":"rafa.almas@gmail.com","sentAt":"2019-08-20T17:49:29Z","receivedAt":"2019-08-20T17:49:37Z","isPatch":false,"sender":{"key":"rafa.almas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1923789?v=4"},"body":"On Tue, Aug 20, 2019 at 04:32:12PM +0200, Uwe Brauer wrote:\n> \n> It seems that there is problem with name-rev.\n> \n\nIn git, branches are just pointers to a commits. Commits do not store\nany information about branches. They're similar to mercurial bookmarks.\n\nThus, git is not able to answer \"Was commit X was made in branch Y?\".\n\nWhat that command does is describe each entry in the log in function of\nyour active branch. Keep in mind that these descriptions are relative,\nand they'll change as you make more commits.\n\nIt is basically asking git the following:\n\n    \"Is commit X (each log entry) an ancestor of the commit pointed by\n    branch Y? (HEAD, meaning your active branch) If yes, describe the\n    relationship between them\"\n\nConsidering your example,\n\n*   changeset: ae68dbe:master\n    |\\  user:      Uwe Brauer\n    | | date:      Tue Aug 20 16:25:53 2019 +0200\n    | | summary:   1.2.1/1.1\n    | |\n    | * changeset: c00bb5d:master^2\n    | | user:      Uwe Brauer\n    | | date:      Tue Aug 20 16:25:53 2019 +0200\n    | | summary:   1.2.1\n    | |\n    | * changeset: 54c9230:master^2~1\n    | |\n\n54c9230 is the parent (~1) of master's second parent (master^2).\n\nIf you make an additional commit on master, the same 54c9230 will be\ndescribed as master~1^2~1\n\nCheck the documentation to learn the syntax: git help revisions\n\nIf want a permanent reference for a commit, you'll need to:\n    1) Use an unambiguous prefix of the commit ID.\n    2) Make a tag to the commit you want to reference.\n\nCheers,\nRafael Ascensão\n"},{"id":"380825","messageId":"xmqqh86bvgsz.fsf@gitster-ct.c.googlers.com","threadId":"51647","inReplyTo":"87pnkzkivn.fsf_-_@mat.ucm.es","subject":"Re: [problem with name-rev]","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-08-20T18:21:32Z","receivedAt":"2019-08-20T18:21:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Uwe Brauer <oub@mat.ucm.es> writes:\n\n> Gives\n> *   changeset: ae68dbe:master\n> |\\  user:      Uwe Brauer\n> | | date:      Tue Aug 20 16:25:53 2019 +0200\n> | | summary:   1.2.1/1.1\n> | |\n> | * changeset: c00bb5d:master^2\n> | | user:      Uwe Brauer\n> | | date:      Tue Aug 20 16:25:53 2019 +0200\n> | | summary:   1.2.1\n> | |\n> | * changeset: 54c9230:master^2~1\n> | | user:      Uwe Brauer\n> | | date:      Tue Aug 20 16:25:53 2019 +0200\n> | | summary:   1.2\n> | |\n> * | changeset: da0712f:master~1\n> |/  user:      Uwe Brauer\n> |   date:      Tue Aug 20 16:25:53 2019 +0200\n> |   summary:   1.1\n> |\n> * changeset: 8eb999d:master~2\n>   user:      Uwe Brauer\n>   date:      Tue Aug 20 16:25:53 2019 +0200\n>   summary:   1\n>\n> That looks odd.\n>\n> Any comments?\n\nWhen you make a merge like the ae68dbe, merging a topic with two\ncommits 54c9230 and c00bb5d into the then-current tip of the master\nbranch da0712f, _all_ direct parents are recorded in the resulting\nmerge commit, so the first parent of it is denoted as ae68dbe~1\n(which is da0712f) and the second parent of it ae68dbe^2 (which is\nc00bb5d).\n\nThere is no linear ordering between these two commits, so c00bb5d\nwill *never* be named as master~<some-number>.  As a commit on a\nside branch, its description from the tip of 'master' will always\ninvolve some ^2 (the second parent of some merge commit) somewhere\nin its name-rev result.\n\nIf you are saying that the $commit^$nth_parent notation \"looks odd\",\nthen you are shooting the messenger with your title.  The problem is\nnot with name-rev; the problem is with the way the world works.\n\n"},{"id":"380845","messageId":"87k1b7k4w1.fsf@mat.ucm.es","threadId":"51647","inReplyTo":"xmqqh86bvgsz.fsf@gitster-ct.c.googlers.com","subject":"Re: [problem with name-rev]","fromName":"Uwe Brauer","fromEmail":"oub@mat.ucm.es","sentAt":"2019-08-20T19:34:22Z","receivedAt":"2019-08-20T19:34:36Z","isPatch":false,"sender":{"key":"oub@mat.ucm.es","avatar":null},"body":">>> \"JCH\" == Junio C Hamano <gitster@pobox.com> writes:\n\n   > Uwe Brauer <oub@mat.ucm.es> writes:\n   >> Gives\n   >> *   changeset: ae68dbe:master\n   >> |\\  user:      Uwe Brauer\n   >> | | date:      Tue Aug 20 16:25:53 2019 +0200\n   >> | | summary:   1.2.1/1.1\n   >> | |\n   >> | * changeset: c00bb5d:master^2\n   >> | | user:      Uwe Brauer\n   >> | | date:      Tue Aug 20 16:25:53 2019 +0200\n   >> | | summary:   1.2.1\n   >> | |\n   >> | * changeset: 54c9230:master^2~1\n   >> | | user:      Uwe Brauer\n   >> | | date:      Tue Aug 20 16:25:53 2019 +0200\n   >> | | summary:   1.2\n   >> | |\n   >> * | changeset: da0712f:master~1\n   >> |/  user:      Uwe Brauer\n   >> |   date:      Tue Aug 20 16:25:53 2019 +0200\n   >> |   summary:   1.1\n   >> |\n   >> * changeset: 8eb999d:master~2\n   >> user:      Uwe Brauer\n   >> date:      Tue Aug 20 16:25:53 2019 +0200\n   >> summary:   1\n   >> \n   >> That looks odd.\n   >> \n   >> Any comments?\n\n   > When you make a merge like the ae68dbe, merging a topic with two\n   > commits 54c9230 and c00bb5d into the then-current tip of the master\n   > branch da0712f, _all_ direct parents are recorded in the resulting\n   > merge commit, so the first parent of it is denoted as ae68dbe~1\n   > (which is da0712f) and the second parent of it ae68dbe^2 (which is\n   > c00bb5d).\n\n\n\n\n   > There is no linear ordering between these two commits, so c00bb5d\n   > will *never* be named as master~<some-number>.  As a commit on a\n   > side branch, its description from the tip of 'master' will always\n   > involve some ^2 (the second parent of some merge commit) somewhere\n   > in its name-rev result.\n\nHm I realize that I understand git much less than I thought (I thought\nit is like mercurial, where git branches are mercurial bookmarks more or\nless). It turns out that this is not the case.\n\nTake the following part of what I did\n\ngit init \necho 1 > 1\ngit add 1\ngit commit -m 1\necho 1.1 > 1\ngit add .\ngit commit -m 1.1\ngit checkout -b foo master~1\necho 1.2 > 1\ngit add .\ngit commit -m 1.2\necho 1.2.1 > 1\ngit add .\ngit commit -m 1.2.1\ngit checkout master\n\nThere are 4  commits.\n\nBut \n\nGit --log --graph --decorate \n\nReturns\n* commit 98922f82932cd1bef58bebf0229367922bca45fc (HEAD -> master)\n| Author: Uwe Brauer <oub@mat.ucm.es>\n| Date:   Tue Aug 20 21:19:59 2019 +0200\n|\n|     1.1\n|\n* commit 8f565d59c356a6038e3d8a7f5dcd2e4a39ae1bb4\n  Author: Uwe Brauer <oub@mat.ucm.es>\n  Date:   Tue Aug 20 21:19:59 2019 +0200\n\n\nIf I would do the same with mercurial (either with bookmarks or with\nnamed branches) I receive \n\nhg init \necho 1 > 1\nhg add 1\nhg commit -m 1\nhg branch foo\necho 1.1 > 1\nhg add .\nhg commit -m 1.1\nhg branch master \necho 1.2 > 1\nhg add .\nhg commit -m 1.2\necho 1.2.1 > 1\nhg add .\nhg commit -m 1.2.1\nhg checkout master\n\n\n\n\n@  changeset:   3:9ebcc17a6389\n|  branch:      master\n|  tag:         tip\n|  user:        Uwe Brauer <oub@mat.ucm.es>\n|  date:        Tue Aug 20 21:27:05 2019 +0200\n|  summary:     1.2.1\n|\no  changeset:   2:e02d297e2f75\n|  branch:      master\n|  user:        Uwe Brauer <oub@mat.ucm.es>\n|  date:        Tue Aug 20 21:27:04 2019 +0200\n|  summary:     1.2\n|\no  changeset:   1:7ddaef206d57\n|  branch:      foo\n|  user:        Uwe Brauer <oub@mat.ucm.es>\n|  date:        Tue Aug 20 21:27:04 2019 +0200\n|  summary:     1.1\n|\no  changeset:   0:dbf3c9975cf3\n   user:        Uwe Brauer <oub@mat.ucm.es>\n   date:        Tue Aug 20 21:27:03 2019 +0200\n   summary:     1\n\n\n\nFunny enough if I convert the git repo, to a hg repo either with hg\nconvert or with hg clone (and the hg-git plugin)\n\nI receive a different graph\n\no  changeset:   3:e7b2696c94fb\n|  bookmark:    master\n|  tag:         tip\n|  parent:      0:5dfd9027787a\n|  user:        Uwe Brauer <oub@mat.ucm.es>\n|  date:        Tue Aug 20 21:19:59 2019 +0200\n|  summary:     1.1\n|\n| o  changeset:   2:277f6423b9c8\n| |  bookmark:    foo\n| |  user:        Uwe Brauer <oub@mat.ucm.es>\n| |  date:        Tue Aug 20 21:19:59 2019 +0200\n| |  summary:     1.2.1\n| |\n| o  changeset:   1:3529c82f37ae\n|/   user:        Uwe Brauer <oub@mat.ucm.es>\n|    date:        Tue Aug 20 21:19:59 2019 +0200\n|    summary:     1.2\n|\no  changeset:   0:5dfd9027787a\n   user:        Uwe Brauer <oub@mat.ucm.es>\n   date:        Tue Aug 20 21:19:59 2019 +0200\n   summary:     1\n\n\nAnyhow, I don't want this message to be interpreted as a flamewar of\nsorts.\n\nI don't really know how the import functions work, but I see that git\nand mercurial treat commits which look simple to me very differently. \n\nUwe Brauer \n"},{"id":"380851","messageId":"CABURp0qHnzpwr8dPtPZpA+1C=tEsoybh2V00iHpyrJ2AM8XHzQ@mail.gmail.com","threadId":"51647","inReplyTo":"87k1b7k4w1.fsf@mat.ucm.es","subject":"Re: [problem with name-rev]","fromName":"Phil Hord","fromEmail":"phil.hord@gmail.com","sentAt":"2019-08-20T19:57:04Z","receivedAt":"2019-08-20T19:57:20Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"On Tue, Aug 20, 2019 at 12:35 PM Uwe Brauer <oub@mat.ucm.es> wrote:\n>\n> Take the following part of what I did\n>\n> git init\n> echo 1 > 1\n> git add 1\n> git commit -m 1\n> echo 1.1 > 1\n> git add .\n> git commit -m 1.1\n> git checkout -b foo master~1\n> echo 1.2 > 1\n> git add .\n> git commit -m 1.2\n> echo 1.2.1 > 1\n> git add .\n> git commit -m 1.2.1\n> git checkout master\n>\n> There are 4  commits.\n>\n> But\n>\n> Git --log --graph --decorate\n>\n> Returns\n> * commit 98922f82932cd1bef58bebf0229367922bca45fc (HEAD -> master)\n> | Author: Uwe Brauer <oub@mat.ucm.es>\n> | Date:   Tue Aug 20 21:19:59 2019 +0200\n> |\n> |     1.1\n> |\n> * commit 8f565d59c356a6038e3d8a7f5dcd2e4a39ae1bb4\n>   Author: Uwe Brauer <oub@mat.ucm.es>\n>   Date:   Tue Aug 20 21:19:59 2019 +0200\n\nTry adding '--all' to include all refs, not just the current HEAD, to\nbegin logging from. Here is what I see after running your setup\nscript.\n\n$  git log --graph --decorate --all\n* commit 3262040f2d8d5f31b4918bda9987e6b5f788531f (foo)\n| Author: Phil Hord <phord@purestorage.com>\n| Date:   Tue Aug 20 12:44:32 2019\n|\n|     1.2.1\n|\n* commit fc66c4311bf954d455f468581f2913dffa0f9c2b\n| Author: Phil Hord <phord@purestorage.com>\n| Date:   Tue Aug 20 12:44:32 2019\n|\n|     1.2\n|\n| * commit 109e5d4baef4e99cf636189ba1499af817ab0bb1 (HEAD -> master)\n|/  Author: Phil Hord <phord@purestorage.com>\n|   Date:   Tue Aug 20 12:44:32 2019\n|\n|       1.1\n|\n* commit 5c1e93ed7c5b3b241d5adfadb365a6bca5d60d3a\n  Author: Phil Hord <phord@purestorage.com>\n  Date:   Tue Aug 20 12:44:32 2019\n\n      1\n\n\nYou could also mention only the refs you are interested in instead of\nincluding all of them.\n$  git log --graph --decorate foo master\n"},{"id":"380878","messageId":"87pnkz2bzy.fsf@mat.ucm.es","threadId":"51647","inReplyTo":"CABURp0qHnzpwr8dPtPZpA+1C=tEsoybh2V00iHpyrJ2AM8XHzQ@mail.gmail.com","subject":"Re: [problem with name-rev]","fromName":"Uwe Brauer","fromEmail":"oub@mat.ucm.es","sentAt":"2019-08-21T07:50:25Z","receivedAt":"2019-08-21T07:52:45Z","isPatch":false,"sender":{"key":"oub@mat.ucm.es","avatar":null},"body":"\n   > On Tue, Aug 20, 2019 at 12:35 PM Uwe Brauer <oub@mat.ucm.es> wrote:\n\n   > Try adding '--all' to include all refs, not just the current HEAD, to\n   > begin logging from. Here is what I see after running your setup\n   > script.\n\n   > $  git log --graph --decorate --all\n   > * commit 3262040f2d8d5f31b4918bda9987e6b5f788531f (foo)\n   > | Author: Phil Hord <phord@purestorage.com>\n   > | Date:   Tue Aug 20 12:44:32 2019\n   > |\n   > |     1.2.1\n   > |\n   > * commit fc66c4311bf954d455f468581f2913dffa0f9c2b\n   > | Author: Phil Hord <phord@purestorage.com>\n   > | Date:   Tue Aug 20 12:44:32 2019\n   > |\n   > |     1.2\n   > |\n   > | * commit 109e5d4baef4e99cf636189ba1499af817ab0bb1 (HEAD -> master)\n   > |/  Author: Phil Hord <phord@purestorage.com>\n   > |   Date:   Tue Aug 20 12:44:32 2019\n   > |\n   > |       1.1\n   > |\n   > * commit 5c1e93ed7c5b3b241d5adfadb365a6bca5d60d3a\n   >   Author: Phil Hord <phord@purestorage.com>\n   >   Date:   Tue Aug 20 12:44:32 2019\n\n   >       1\n\nThat's it, thanks. Interestingly enough the \n\n git graph looks differently from the mercurial one.\n\nThe mercurial one looks purely linear (with two branches) while the git one is not,\nbut maybe it is not clear to me who to translate the git command \n\ngit checkout -b foo master~1\n\nTo mercurial?\n\nAnyhow the original question was about having a sort of local revision\nnumber and I see that this is somehow possible, which was not clear to\nme before. \n\nThanks\n"},{"id":"380883","messageId":"87k1b63d9m.fsf@mat.ucm.es","threadId":"51647","inReplyTo":"87pnkz2bzy.fsf@mat.ucm.es","subject":"Re: [problem with name-rev]","fromName":"Uwe Brauer","fromEmail":"oub@mat.ucm.es","sentAt":"2019-08-21T12:37:41Z","receivedAt":"2019-08-21T12:37:49Z","isPatch":false,"sender":{"key":"oub@mat.ucm.es","avatar":null},"body":"\n\n\n\n\n   > That's it, thanks. Interestingly enough the \n\n   >  git graph looks differently from the mercurial one.\n\nIt does not. I just did not understand the git commands at first sight\nwell enough. Both graphs look the same. Sorry for the noise.\n"}]}