{"thread":{"id":"15771","subject":"Numeric Revision Names?","startedAt":"2008-10-03T12:37:07Z","lastAt":"2008-10-05T09:19:38Z","messageCount":11,"participants":["marceloribeiro","Robin Burchell","Bruce Stephens","Jakub Narebski","Stephen Haberman","Thomas Rast","Jeff King","André Goddard Rosa","Alex Riesen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"92245","messageId":"19796862.post@talk.nabble.com","threadId":"15771","inReplyTo":null,"subject":"Numeric Revision Names?","fromName":"marceloribeiro","fromEmail":"marcelo@sonnay.com","sentAt":"2008-10-03T12:37:07Z","receivedAt":"2008-10-03T12:37:07Z","isPatch":false,"sender":{"key":"marcelo@sonnay.com","avatar":null},"body":"\nHi,\n\nI am new to git, and my question may be stupid, but anyway...\nI am used to the numeric revision names on svn, and on Git\nall I get are hexadecimal names.\n\nIs there any way to configure it to start a projects revisions on\nlets say, revision 0, and keep incrementing it after each commit?\n\nI tried finding it on git doc but wasnt able to. Maybe I am missing\nsomething....\n\nThanks in advance!\n-- \nView this message in context: http://www.nabble.com/Numeric-Revision-Names--tp19796862p19796862.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"92246","messageId":"b19eae4e0810030541r27aa9af7l78a386263154ba8d@mail.gmail.com","threadId":"15771","inReplyTo":"19796862.post@talk.nabble.com","subject":"Re: Numeric Revision Names?","fromName":"Robin Burchell","fromEmail":"w00t@inspircd.org","sentAt":"2008-10-03T12:41:21Z","receivedAt":"2008-10-03T12:41:21Z","isPatch":false,"sender":{"key":"w00t@inspircd.org","avatar":null},"body":"This can be emulated to some extent by using git tag, and git describe\n--tags. I can't remember specifics off the top of my head though, it's\na while since I set that up.\n\nOn Fri, Oct 3, 2008 at 1:37 PM, marceloribeiro <marcelo@sonnay.com> wrote:\n>\n> Hi,\n>\n> I am new to git, and my question may be stupid, but anyway...\n> I am used to the numeric revision names on svn, and on Git\n> all I get are hexadecimal names.\n>\n> Is there any way to configure it to start a projects revisions on\n> lets say, revision 0, and keep incrementing it after each commit?\n>\n> I tried finding it on git doc but wasnt able to. Maybe I am missing\n> something....\n>\n> Thanks in advance!\n> --\n> View this message in context: http://www.nabble.com/Numeric-Revision-Names--tp19796862p19796862.html\n> Sent from the git mailing list archive at Nabble.com.\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"92247","messageId":"80r66x7srp.fsf@tiny.isode.net","threadId":"15771","inReplyTo":"19796862.post@talk.nabble.com","subject":"Re: Numeric Revision Names?","fromName":"Bruce Stephens","fromEmail":"bruce.stephens@isode.com","sentAt":"2008-10-03T12:44:10Z","receivedAt":"2008-10-03T12:44:10Z","isPatch":false,"sender":{"key":"bruce.stephens@isode.com","avatar":null},"body":"marceloribeiro <marcelo@sonnay.com> writes:\n\n[...]\n\n> Is there any way to configure it to start a projects revisions on\n> lets say, revision 0, and keep incrementing it after each commit?\n\nNo.\n\n[...]\n\n(There's no such numbering system that would work entirely\nsatisfactorily in a distributed system.  Some systems have numbering\nschemes that are perhaps easier to use (at least for some purposes)\nthan the underlying hashes, but no such scheme is used in git.)\n"},{"id":"92258","messageId":"m3d4ihr7as.fsf@localhost.localdomain","threadId":"15771","inReplyTo":"19796862.post@talk.nabble.com","subject":"Re: Numeric Revision Names?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-10-03T16:07:49Z","receivedAt":"2008-10-03T16:07:49Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"marceloribeiro <marcelo@sonnay.com> writes:\n\n> I am new to git, and my question may be stupid, but anyway...\n> I am used to the numeric revision names on svn, and on Git\n> all I get are hexadecimal names.\n> \n> Is there any way to configure it to start a projects revisions on\n> lets say, revision 0, and keep incrementing it after each commit?\n> \n> I tried finding it on git doc but wasnt able to. Maybe I am missing\n> something....\n\nFirst, it is simply not possible to have incremental revision numbers\nin distributed version control system like Git, at least not without\nsome central authority (assigning revision numbers). Other distributed\nSCM use simple revision numbers, but either they are local to branch\nand local to repository (not shared) as in case of Mercurial, or\nrequire centralized workflow where one uses different merge than in\nleaf repositories, as from what I understand is the case with dotted\nrevision numbers in Bazaar-NG.\n\nSecond, in my opinion revision numbers are not that useful for\nprojects with large number of commits (where revision number might be\nsomething like r4321), and nonlinear history (you don't know how r4555\nrelates to r4556: they might be on different branches).  Also you\ndon't have to use full revision numbers: you can use shortened\nrevision numbers (usually 6-8 characters is enough, e.g. 5f2d4160);\nif you use tags to mark released versions you can use git-describe\noutput to count revisions from given tag (output contains sha-1\nbecause history migh branch after tag, and number of commits since tag\nis not enough to determine commit/revision; e.g. v1.6.0-rc3-17-gc14c8ce\nwhich means 17 commits after tag v1.6.0-rc3).\n\nAdditionally when using git you usually use transient revision\nnumbers, counting commits from tip of branch, for example master~5\nmeans 5 commits in first-parent line from what branch 'master' points\nto now.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"92261","messageId":"20081003115557.08d80c2f.stephen@exigencecorp.com","threadId":"15771","inReplyTo":"m3d4ihr7as.fsf@localhost.localdomain","subject":"Re: Numeric Revision Names?","fromName":"Stephen Haberman","fromEmail":"stephen@exigencecorp.com","sentAt":"2008-10-03T16:55:57Z","receivedAt":"2008-10-03T16:55:57Z","isPatch":false,"sender":{"key":"stephen@exigencecorp.com","avatar":"https://gravatar.com/avatar/23b93ad70a06ce53505f17ddba65176edbcfb6588e7a4c1a2dca04aaf0a6aff1?d=mp&s=160"},"body":"\n> Second, in my opinion revision numbers are not that useful for\n> projects with large number of commits (where revision number might be\n> something like r4321), and nonlinear history (you don't know how r4555\n> relates to r4556: they might be on different branches).\n\nFor projects that do have a central authority (e.g. internal corporate\nprojects), revision numbers make more sense.\n\nGranted, they are on separate branches (like svn), but the nice thing\nabout them is that they are monotonically increasing. E.g. our qa\npeople love numbers--the bug fix ticket says dev just put in\nr100...qa/production box says it is on r95. Doesn't matter the\nbranch/whatever, they know the box doesn't have r100. Now, right, if\nits r105, it is trickier, although we also throw in branch name (e.g.\ntopica-r100) which means no false positives but can lead to false\nnegatives.\n\nPer Robin's response and then a thread on the list a year+ ago, a\nhook+tags can be used to fake this, and we're doing that now. I've been\nmeaning to put our hooks repo up somewhere, as we've got several fun\nhooks that are focused on an internal/centralized workflow, but I\nhaven't gotten to it yet. For now I've just attached the commit\nnumbers script.\n\nFor our team, lack of monotonic version numbers was a big deal--as in\ncan't use git sort of big deal. I wouldn't be surprised if it is a\ncontributing factor that keeps other people, especially internal teams,\nfrom git. I understand all of the reasons it can't be in git proper,\nbut an FAQ entry about the hook/tag hack or link to a contrib script\nmight be useful (not necessarily the one attached, given its\nfunctions/etc. baggage).\n\n- Stephen\n\n"},{"id":"92262","messageId":"200810031913.55594.trast@student.ethz.ch","threadId":"15771","inReplyTo":"20081003115557.08d80c2f.stephen@exigencecorp.com","subject":"Re: Numeric Revision Names?","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2008-10-03T17:13:52Z","receivedAt":"2008-10-03T17:13:52Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Stephen Haberman wrote:\n> \n> > Second, in my opinion revision numbers are not that useful for\n> > projects with large number of commits (where revision number might be\n> > something like r4321), and nonlinear history (you don't know how r4555\n> > relates to r4556: they might be on different branches).\n> \n> For projects that do have a central authority (e.g. internal corporate\n> projects), revision numbers make more sense.\n> \n> Granted, they are on separate branches (like svn), but the nice thing\n> about them is that they are monotonically increasing. E.g. our qa\n> people love numbers--the bug fix ticket says dev just put in\n> r100...qa/production box says it is on r95. Doesn't matter the\n> branch/whatever, they know the box doesn't have r100. Now, right, if\n> its r105, it is trickier, although we also throw in branch name (e.g.\n> topica-r100) which means no false positives but can lead to false\n> negatives.\n\nI wonder how that constitutes an argument for revision numbers.\n\nFirst, the _only_ guarantee you get out of monotonically increasing\nrevision numbers is that they're ... monotonically increasing.  You\nmight as well use the commit (not author!) timestamp for that purpose\n(assuming your clocks are all synced).  They do not convey history\nmembership, only history non-membership, for the same obvious reason\nthat commit timestamps do.\n\nSecond, Git can do the check you mention above much more accurately.\nIf you tell QA that the fix is in 123abc, then 'git branch --contains\n123abc' lists all local branches that have the fix, 'git describe\n--contains 123abc' gives you the nearest tag (i.e. usually the\nlowest-numbered release version number) having the fix, etc.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n\n"},{"id":"92722","messageId":"20081003171434.GC30592@coredump.intra.peff.net","threadId":"15771","inReplyTo":"20081003115557.08d80c2f.stephen@exigencecorp.com","subject":"Re: Numeric Revision Names?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-10-03T17:14:34Z","receivedAt":"2008-10-03T17:14:34Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Oct 03, 2008 at 11:55:57AM -0500, Stephen Haberman wrote:\n\n> For projects that do have a central authority (e.g. internal corporate\n> projects), revision numbers make more sense.\n> \n> Granted, they are on separate branches (like svn), but the nice thing\n> about them is that they are monotonically increasing. E.g. our qa\n> people love numbers--the bug fix ticket says dev just put in\n> r100...qa/production box says it is on r95. Doesn't matter the\n> branch/whatever, they know the box doesn't have r100. Now, right, if\n> its r105, it is trickier, although we also throw in branch name (e.g.\n> topica-r100) which means no false positives but can lead to false\n> negatives.\n\nIf you are constraining yourself to a central repo, then you could just\nadd a receive hook that tags each new commit with a monotonically\nincreasing revision number. Clients would get the tags upon fetch.\n\nSomething like the following (totally untested, and probably needs to\nhandle locking and errors more sanely) in the post-receive hook:\n\n  n=`cat revnumber 2>/dev/null || echo 0`\n  while read old new branch; do\n    git rev-list $old..$new |\n      while read rev; do\n        n=$(($n+1))\n        git tag r$n $rev\n      done\n  done\n  echo $n >revnumber\n\n-Peff\n"},{"id":"92264","messageId":"20081003173748.GA31526@coredump.intra.peff.net","threadId":"15771","inReplyTo":"20081003171434.GC30592@coredump.intra.peff.net","subject":"Re: Numeric Revision Names?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-10-03T17:37:48Z","receivedAt":"2008-10-03T17:37:48Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Oct 03, 2008 at 01:14:34PM -0400, Jeff King wrote:\n\n> If you are constraining yourself to a central repo, then you could just\n> add a receive hook that tags each new commit with a monotonically\n> increasing revision number. Clients would get the tags upon fetch.\n\nOh, nevermind. I'm an idiot and didn't bother reading to the end of your\npost, where you clearly attached a hook that does exactly that.\n\nSorry for the noise.\n\n-Peff\n"},{"id":"92265","messageId":"20081003124224.843a5a21.stephen@exigencecorp.com","threadId":"15771","inReplyTo":"200810031913.55594.trast@student.ethz.ch","subject":"Re: Numeric Revision Names?","fromName":"Stephen Haberman","fromEmail":"stephen@exigencecorp.com","sentAt":"2008-10-03T17:42:24Z","receivedAt":"2008-10-03T17:42:24Z","isPatch":false,"sender":{"key":"stephen@exigencecorp.com","avatar":"https://gravatar.com/avatar/23b93ad70a06ce53505f17ddba65176edbcfb6588e7a4c1a2dca04aaf0a6aff1?d=mp&s=160"},"body":"\n> You might as well use the commit (not author!) timestamp for that\n> purpose (assuming your clocks are all synced).\n\nTrue. Revision numbers are typically shorter though. E.g. we're on\n~19,000 now, which is less digits than 20081003122101.\n\n> They do not convey history membership, only history non-membership,\n> for the same obvious reason that commit timestamps do.\n\nI know--see my explicit disclaimer about false negatives in my previous\npost.\n\nI'll nit pick, revision numbers if put together with branch name, can\nactually occassionally convey history membership (subject to false\nnegatives).\n\nFor example, our bug fix hook will say \"hashX committed on topica as\nr100\" and so if qa is looking at a build that was built while on topica\nat r105 (so labeled) \"topica-r105\") then it is very likely hashX is on\nthe box.\n\nOkay, not with branch renames, but for all intents and purposes. Of\ncourse, as you point out, topicb-r106 says nothing about the\navailability of hashX, but that is a less common question for our qa\nteam than the first two. And they ask the question often enough during\nthe day that addressing the major 2 of the 3 cases helps cut down \"hey\ndev--I've got this hash...\" calls.\n\nDo not confuse my willingness to hack commit numbers into our git repo\n(and my willingness to share our hack with the original poster) with\nfull fledged support of the concept. Hashes are superior, but, when\nthey work, revision numbers are nice too. I did not see a reason we\ncould not have both, especially if it made people more comfortable with\ngit.\n\n(I also face/faced a situation where \"monotonic revision numbers\" were\nessentially a check box item on a required list of SCM features, so\ndespite whatever I/the-git-team/etc. thought about their technical\ninferiority, it was a criteria that could have ruled git out for us.\nHence my mentioning an FAQ entry for others faced with my same\npolitical situation.)\n\n- Stephen\n"},{"id":"92320","messageId":"b8bf37780810042013g57fc7073xd638e44bb666bf@mail.gmail.com","threadId":"15771","inReplyTo":"20081003124224.843a5a21.stephen@exigencecorp.com","subject":"Re: Numeric Revision Names?","fromName":"André Goddard Rosa","fromEmail":"andre.goddard@gmail.com","sentAt":"2008-10-05T03:13:43Z","receivedAt":"2008-10-05T03:13:43Z","isPatch":false,"sender":{"key":"andre.goddard@gmail.com","avatar":null},"body":"> For projects that do have a central authority (e.g. internal corporate\n> projects), revision numbers make more sense.\n\nSurely!\n\n> Granted, they are on separate branches (like svn), but the nice thing\n> about them is that they are monotonically increasing. E.g. our qa\n> people love numbers--the bug fix ticket says dev just put in\n> r100...qa/production box says it is on r95. Doesn't matter the\n> branch/whatever, they know the box doesn't have r100. Now, right, if\n> its r105, it is trickier, although we also throw in branch name (e.g.\n> topica-r100) which means no false positives but can lead to false\n> negatives.\n\nYes\n\n> haven't gotten to it yet. For now I've just attached the commit\n> numbers script.\n\nIt would be good to have this feature in git.\n\n> For our team, lack of monotonic version numbers was a big deal--as in\n> can't use git sort of big deal. I wouldn't be surprised if it is a\n\nYes, it's true that this is a big deal for many people out there.\n\n> contributing factor that keeps other people, especially internal teams,\n> from git. I understand all of the reasons it can't be in git proper,\n> but an FAQ entry about the hook/tag hack or link to a contrib script\n> might be useful (not necessarily the one attached, given its\n> functions/etc. baggage).\n\nThat would be helpful, if it cannot go in git proper for real in the\ncentralized model.\n\n> (I also face/faced a situation where \"monotonic revision numbers\" were\n> essentially a check box item on a required list of SCM features, so\n> despite whatever I/the-git-team/etc. thought about their technical\n> inferiority, it was a criteria that could have ruled git out for us.\n> Hence my mentioning an FAQ entry for others faced with my same\n> political situation.)\n>\n\nThis is so true in a corporate environment with centralized\nrepositories, then I completely agree\nthat in the case git is being used in this model (many companies are\nreally used to that), the\nmonotonic revision number is helpful and sometimes is showstopper to\nnot have them.\n\nRegards,\n-- \n[]s,\nAndré Goddard\n"},{"id":"92327","messageId":"81b0412b0810050219t31b0c71dhdafb7b94070657ac@mail.gmail.com","threadId":"15771","inReplyTo":"b8bf37780810042013g57fc7073xd638e44bb666bf@mail.gmail.com","subject":"Re: Numeric Revision Names?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-10-05T09:19:38Z","receivedAt":"2008-10-05T09:19:38Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2008/10/5 André Goddard Rosa <andre.goddard@gmail.com>:\n> This is so true in a corporate environment with centralized\n> repositories, then I completely agree\n> that in the case git is being used in this model (many companies are\n> really used to that), the\n> monotonic revision number is helpful and sometimes is showstopper to\n> not have them.\n\nBut you do have them, even now. With that simple hook script.\n\nAnd outside of your small corporation noone needs them\n(and your company doesn't need them either, they just can't\nget over the mindset of rcs or vms native versioning or whatever\nelse they're plainly used to).\n"}]}