{"thread":{"id":"7228","subject":"[ANNOUNCE] chronoversion: chronological archiving script with temporary commits","startedAt":"2007-03-13T12:26:40Z","lastAt":"2007-03-13T15:54:32Z","messageCount":5,"participants":["David Tweed","Jakub Narebski","Shawn O. Pearce","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"36993","messageId":"e1dab3980703130526t4b573f18h793a065d54c9369@mail.gmail.com","threadId":"7228","inReplyTo":null,"subject":"[ANNOUNCE] chronoversion: chronological archiving script with temporary commits","fromName":"David Tweed","fromEmail":"david.tweed@gmail.com","sentAt":"2007-03-13T12:26:40Z","receivedAt":"2007-03-13T12:26:40Z","isPatch":false,"sender":{"key":"david.tweed@gmail.com","avatar":null},"body":"Hi, I believe that I've now got temporary commits (for bookkeeping,\nhi-granularity bisecting recent changes) working, so I'm just\nmentioning there's a new version of chronoversion at\n\nhttp://www.personal.rdg.ac.uk/~sis05dst/chronoversion.tgz\n\nIt maintains two parallel branches, master and temp, using temp for\nhigh-granularity temporary commits that can be cleaned away at any\ntime. When a filetree state needs to be recorded on both branches it\ndoesn't merge branches but instead writes a commit tree and then\nwrites commit objects using that tree on both branches. Note: I don't\ncompletely understand what all the low-level git stuff is supposed to\ndo so this code was experimented with until it appears to work.\nConsequently, be very careful about entrusting any hyper-important\ndata to this.\n\nA question for those who understand things: I stash the last written\n_tree_'s hash in a tag and then when a new \"commit's\" directory tree\nis written starts look to see if it's the same SHA value. If it is I\nknow I can avoid the commit. At the moment I'm using\n\n    if os.path.exists(lastTreeFile) and\ntree==open(lastTreeFile,\"r\").read()[:40]:\n\nto be safe just in case a user, eg, goes mad and manually deletes that\nrecord. Clearly this is going to hit trouble if git ever decides to\nput this tag into a packed refs file.\nIs there any neat way of using builtin stuff like git-rev-parse to ask\nif a ref has a given SHA1 value and return an easily parsed yes/no\nanswer?\n\nAs a side note to Jon Smirl: I think kernel development is relatively\nspecial in that you really can't safely test things at the same time\nas you're editing the code (since clearly a kernel hang/oops/whatever\nis possible). However, as I work on userspace programs I quite often\nhave my monte-carlo simulation code running on all the cores at the\nsame I edit its source code to try and refine it for the next run. So\nin general if using git is \"free\" it'll be because editing tools and\ngit take tiny portions of current CPU's power rather than because\nthere're unused cores :-) (Actually, that's a serious point: I did put\nin some thought into chronoversion to try and minimise its cpu usage\nso it intruded as little as possible.)\n-- \ncheers, dave tweed__________________________\ndavid.tweed@gmail.com\nRm 124, School of Systems Engineering, University of Reading.\nDetails are all that matters; God dwells there, and you never get to\nsee Him if you don't struggle to get them right. -- Stephen Jay Gould\n"},{"id":"37000","messageId":"et6gkk$ngm$1@sea.gmane.org","threadId":"7228","inReplyTo":"e1dab3980703130526t4b573f18h793a065d54c9369@mail.gmail.com","subject":"Re: [ANNOUNCE] chronoversion: chronological archiving script with temporary commits","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-03-13T15:42:47Z","receivedAt":"2007-03-13T15:42:47Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"[Cc: git@vger.kernel.org]\n\nDavid Tweed wrote:\n\n> Hi, I believe that I've now got temporary commits (for bookkeeping,\n> hi-granularity bisecting recent changes) working, so I'm just\n> mentioning there's a new version of chronoversion at\n> \n> http://www.personal.rdg.ac.uk/~sis05dst/chronoversion.tgz\n\nBy the way, do you have homepage for this project? If not, perhaps\nyou could write a few sentences on git wiki, e.g. at\n  http://git.or.cz/gitwiki/Chronoversion\n(linking it from http://git.or.cz/gitwiki/InterfacesFrontendsAndTools)\n\n[...] \n> Is there any neat way of using builtin stuff like git-rev-parse to ask\n> if a ref has a given SHA1 value and return an easily parsed yes/no\n> answer?\n\nThere is git-show-ref which was made because of introduction of packed\nrefs, and there is git-for-each-ref which _might_ be used to avoid\nextra forking (extra calls).\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"37002","messageId":"20070313154511.GA18890@spearce.org","threadId":"7228","inReplyTo":"e1dab3980703130526t4b573f18h793a065d54c9369@mail.gmail.com","subject":"Re: [ANNOUNCE] chronoversion: chronological archiving script with temporary commits","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-03-13T15:45:11Z","receivedAt":"2007-03-13T15:45:11Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"David Tweed <david.tweed@gmail.com> wrote:\n> A question for those who understand things: I stash the last written\n> _tree_'s hash in a tag and then when a new \"commit's\" directory tree\n> is written starts look to see if it's the same SHA value. If it is I\n> know I can avoid the commit. At the moment I'm using\n> \n>    if os.path.exists(lastTreeFile) and\n> tree==open(lastTreeFile,\"r\").read()[:40]:\n> \n> to be safe just in case a user, eg, goes mad and manually deletes that\n> record. Clearly this is going to hit trouble if git ever decides to\n> put this tag into a packed refs file.\n> Is there any neat way of using builtin stuff like git-rev-parse to ask\n> if a ref has a given SHA1 value and return an easily parsed yes/no\n> answer?\n\nThe common idiom if you want to compare trees to see if you\nneed to make a commit is:\n\n\toldc=`git rev-parse $tagname^{commit}`\n\toldt=`git rev-parse $oldc^{tree}`\n\tnewt`git write-tree`\n\tif [ X$oldt = X$newt ]; then\n\t\t: nothing to save\n\telse\n\t\tnewc=`git commit-tree $newt -p $oldc`\n\t\tgit update-ref $tagname $newc $oldc\n\tfi\n\nYes, a little ugly.  But its safe; if another program were to\nalter the value of $tagname (e.g. \"git branch -f\", \"git tag -f\")\nwhile your script is running the update-ref in the else will fail,\nletting you know that $tagname changed in the process.\n\n-- \nShawn.\n"},{"id":"37003","messageId":"Pine.LNX.4.63.0703131648440.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"7228","inReplyTo":"20070313154511.GA18890@spearce.org","subject":"Re: [ANNOUNCE] chronoversion: chronological archiving script with temporary commits","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-03-13T15:49:34Z","receivedAt":"2007-03-13T15:49:34Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 13 Mar 2007, Shawn O. Pearce wrote:\n\n> David Tweed <david.tweed@gmail.com> wrote:\n> > A question for those who understand things: I stash the last written\n> > _tree_'s hash in a tag and then when a new \"commit's\" directory tree\n> > is written starts look to see if it's the same SHA value. If it is I\n> > know I can avoid the commit. At the moment I'm using\n> > \n> >    if os.path.exists(lastTreeFile) and\n> > tree==open(lastTreeFile,\"r\").read()[:40]:\n> > \n> > to be safe just in case a user, eg, goes mad and manually deletes that\n> > record. Clearly this is going to hit trouble if git ever decides to\n> > put this tag into a packed refs file.\n> > Is there any neat way of using builtin stuff like git-rev-parse to ask\n> > if a ref has a given SHA1 value and return an easily parsed yes/no\n> > answer?\n> \n> The common idiom if you want to compare trees to see if you\n> need to make a commit is:\n> \n> \toldc=`git rev-parse $tagname^{commit}`\n> \toldt=`git rev-parse $oldc^{tree}`\n> \tnewt`git write-tree`\n\n\tnew=`git write-tree`\n\n> \tif [ X$oldt = X$newt ]; then\n> \t\t: nothing to save\n> \telse\n> \t\tnewc=`git commit-tree $newt -p $oldc`\n> \t\tgit update-ref $tagname $newc $oldc\n> \tfi\n> \n> Yes, a little ugly.  But its safe; if another program were to\n> alter the value of $tagname (e.g. \"git branch -f\", \"git tag -f\")\n> while your script is running the update-ref in the else will fail,\n> letting you know that $tagname changed in the process.\n\nCiao,\nDscho\n"},{"id":"37005","messageId":"Pine.LNX.4.63.0703131654130.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"7228","inReplyTo":"Pine.LNX.4.63.0703131648440.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [ANNOUNCE] chronoversion: chronological archiving script with temporary commits","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-03-13T15:54:32Z","receivedAt":"2007-03-13T15:54:32Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 13 Mar 2007, Johannes Schindelin wrote:\n\n> Hi,\n> \n> On Tue, 13 Mar 2007, Shawn O. Pearce wrote:\n> \n> > David Tweed <david.tweed@gmail.com> wrote:\n> > > A question for those who understand things: I stash the last written\n> > > _tree_'s hash in a tag and then when a new \"commit's\" directory tree\n> > > is written starts look to see if it's the same SHA value. If it is I\n> > > know I can avoid the commit. At the moment I'm using\n> > > \n> > >    if os.path.exists(lastTreeFile) and\n> > > tree==open(lastTreeFile,\"r\").read()[:40]:\n> > > \n> > > to be safe just in case a user, eg, goes mad and manually deletes that\n> > > record. Clearly this is going to hit trouble if git ever decides to\n> > > put this tag into a packed refs file.\n> > > Is there any neat way of using builtin stuff like git-rev-parse to ask\n> > > if a ref has a given SHA1 value and return an easily parsed yes/no\n> > > answer?\n> > \n> > The common idiom if you want to compare trees to see if you\n> > need to make a commit is:\n> > \n> > \toldc=`git rev-parse $tagname^{commit}`\n> > \toldt=`git rev-parse $oldc^{tree}`\n> > \tnewt`git write-tree`\n> \n> \tnew=`git write-tree`\n\nD'OH!\n\n\tnewt=`git write-tree`\n\nOh, well...\n"}]}