{"thread":{"id":"267","subject":"git-changes-script to show inter tree changes","startedAt":"2005-04-23T18:43:12Z","lastAt":"2005-04-24T12:48:12Z","messageCount":5,"participants":["James Bottomley","Petr Baudis"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"1385","messageId":"1114281792.5068.10.camel@mulgrave","threadId":"267","inReplyTo":null,"subject":"git-changes-script to show inter tree changes","fromName":"James Bottomley","fromEmail":"james.bottomley@steeleye.com","sentAt":"2005-04-23T18:43:12Z","receivedAt":"2005-04-23T18:43:12Z","isPatch":false,"sender":{"key":"james.bottomley@steeleye.com","avatar":null},"body":"One of the features I found most useful about bk changes was the ability\nto see changes in my tree that weren't in the other tree (I use this to\nkeep track of what patches I actually have).\n\nI've modified the gitlog script to take the -L and -R options (local\ndirectories only; won't work on remotes like bk changes would) to add\nthis functionality.\n\nJames\n\n#!/bin/bash\n#\n# Make a log of changes in a GIT branch.\n#\n# This script was originally written by (c) Ross Vandegrift.\n# Adapted to his scripts set by (c) Petr Baudis, 2005.\n# Major optimizations by (c) Phillip Lougher.\n# Rendered trivial by Linus Torvalds.\n# Added -L|-R option by James Bottomley\n#\n# options:\n# script [-L <dir> | -R <dir> |-r <from_sha1> [ -r <to_sha1] ] [<sha1>]\n#\n# With no options shows all the revisions from HEAD to the root\n# -L shows all the changes in the local tree compared to the tree at <dir>\n# -R shows all the changes in the remote tree at <dir> compared to the local\n# -r shows all the changes in one commit or between two\n\ntmpfile=/tmp/git_changes.$$\nr1=\nr2=\n\nshowcommit() {\n\tcommit=\"$1\"\n\techo commit ${commit%:*};\n\tcat-file commit $commit | \\\n\t\twhile read key rest; do\n\t\t\tcase \"$key\" in\n\t\t\t\"author\"|\"committer\")\n\t\t\t\tdate=(${rest#*> })\n\t\t\t\tsec=${date[0]};\n\t\t\t\tpdate=\"$(date -Rd \"1970-01-01 UTC + $sec sec\" 2>/dev/null)\"\n\t\t\t\tif [ \"$pdate\" ]; then\n\t\t\t\t\techo $key $rest | sed \"s/>.*/> ${pdate/+0000/$tz}/\"\n\t\t\t\telse\n\t\t\t\t\techo $key $rest\n\t\t\t\tfi\n\t\t\t\t;;\n\t\t\t\"\")\n\t\t\t\techo; cat\n\t\t\t\t;;\n\t\t\t*)\n\t\t\t\techo $key $rest\n\t\t\t\t;;\n\t\t\tesac\n\n\t\tdone\n}\n\nwhile true; do\n\tcase \"$1\" in\n\t\t-R)\tshift;\n\t\t\tdiffsearch=+\n\t\t\tremote=\"$1\"\n\t\t\tshift;;\n\t\t-L)\tshift;\n\t\t\tdiffsearch=-\n\t\t\tremote=\"$1\"\n\t\t\tshift;;\n\t\t-r)\tshift;\n\t\t\tif [ -z \"$r1\" ]; then\n\t\t\t\tr1=\"$1\"\n\t\t\telse\n\t\t\t\tr2=\"$1\"\n\t\t\tfi\n\t\t\tshift;;\n\t\t*)\tbase=\"$1\"\n\t\t\tbreak;;\n\tesac\ndone\n\nif [ -n \"$r1\" ]; then\n\tif [ -z \"$r2\" ]; then\n\t\tshowcommit $r1\n\t\texit 0\n\tfi\n\tdiffsearch=+\n\tremote=`pwd`;\n\ttobase=\"$r2\";\n\tbase=\"$r1\"\nfi\n\t\nif [ -z \"$base\" ]; then\n\tbase=$(cat .git/HEAD) || exit 1\nfi\n\nrev-tree $base | sort -rn  > ${tmpfile}.base\nif [ -n \"$remote\" ]; then\n\t[ -d $remote/.git ] || exit 1\n\tif [ -z \"$tobase\" ]; then\n\t\ttobase=$(cat $remote/.git/HEAD) || exit 1\n\tfi\n\tpushd $remote > /dev/null\n\trev-tree $tobase | sort -rn > ${tmpfile}.remote\n\tdiff -u ${tmpfile}.base ${tmpfile}.remote | grep \"^${diffsearch}[^${diffsearch}]\" | cut -c 1- > ${tmpfile}.diff\n\trm -f ${tmpfile}.base ${tmpfile}.remote\n\tmv ${tmpfile}.diff ${tmpfile}.base\n\tif [ $diffsearch = \"-\" ]; then\n\t\tpopd > /dev/null\n\tfi\nfi\n\n[ -s \"${tmpfile}.base\" ] || exit 0\n\ncat ${tmpfile}.base | while read time commit parents; do\n\tshowcommit $commit\n\techo -e \"\\n--------------------------\"\n\ndone\nrm -f ${tmpfile}.base\n\n\n"},{"id":"1426","messageId":"20050423230937.GF13222@pasky.ji.cz","threadId":"267","inReplyTo":"1114281792.5068.10.camel@mulgrave","subject":"Re: git-changes-script to show inter tree changes","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-23T23:09:37Z","receivedAt":"2005-04-23T23:09:37Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sat, Apr 23, 2005 at 08:43:12PM CEST, I got a letter\nwhere James Bottomley <James.Bottomley@SteelEye.com> told me that...\n> One of the features I found most useful about bk changes was the ability\n> to see changes in my tree that weren't in the other tree (I use this to\n> keep track of what patches I actually have).\n> \n> I've modified the gitlog script to take the -L and -R options (local\n> directories only; won't work on remotes like bk changes would) to add\n> this functionality.\n\nLinus isn't probably the right person to Cc on this, since this is\ngit-pasky thing.  Can you please post it as a signed-off patch?\n\nI don't get what are you doing anyway. I don't know the \"bk changes\"\ntool. Can't you just do\n\n\tgit log theothertree yourtree\n\n?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"1478","messageId":"1114306762.4805.3.camel@mulgrave","threadId":"267","inReplyTo":"20050423230937.GF13222@pasky.ji.cz","subject":"Re: git-changes-script to show inter tree changes","fromName":"James Bottomley","fromEmail":"james.bottomley@steeleye.com","sentAt":"2005-04-24T01:39:22Z","receivedAt":"2005-04-24T01:39:22Z","isPatch":false,"sender":{"key":"james.bottomley@steeleye.com","avatar":null},"body":"On Sun, 2005-04-24 at 01:09 +0200, Petr Baudis wrote:\n> Linus isn't probably the right person to Cc on this, since this is\n> git-pasky thing.  Can you please post it as a signed-off patch?\n\nI'm just offering it as one of the scripts I need to operate a git tree\nas a maintainer.  I don't have git-pasky installed, so I can't patch it\nagainst anything.  However, feel free to incorporate any pieces you\nneed.\n\n> I don't get what are you doing anyway. I don't know the \"bk changes\"\n> tool. Can't you just do\n> \n> \tgit log theothertree yourtree\n\nNo idea .. not used it.  However, how does this show the -L and -R diffs\nsince there are two possible views of changes between trees?  It's\nprimarily -L (changes in local) I need to keep the changes in my local\ntree.  -R (changes in remote) is just useful to show what changes I'm\nmissing and might need to merge.\n\nJames\n\n\n"},{"id":"1512","messageId":"20050424123621.GB1507@pasky.ji.cz","threadId":"267","inReplyTo":"1114306762.4805.3.camel@mulgrave","subject":"Re: git-changes-script to show inter tree changes","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-24T12:36:21Z","receivedAt":"2005-04-24T12:36:21Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Apr 24, 2005 at 03:39:22AM CEST, I got a letter\nwhere James Bottomley <James.Bottomley@SteelEye.com> told me that...\n> On Sun, 2005-04-24 at 01:09 +0200, Petr Baudis wrote:\n> > Linus isn't probably the right person to Cc on this, since this is\n> > git-pasky thing.  Can you please post it as a signed-off patch?\n> \n> I'm just offering it as one of the scripts I need to operate a git tree\n> as a maintainer.  I don't have git-pasky installed, so I can't patch it\n> against anything.  However, feel free to incorporate any pieces you\n> need.\n\nAha,  I thought this is based on the current gitlog.sh, sorry.\n\n> > I don't get what are you doing anyway. I don't know the \"bk changes\"\n> > tool. Can't you just do\n> > \n> > \tgit log theothertree yourtree\n> \n> No idea .. not used it.  However, how does this show the -L and -R diffs\n> since there are two possible views of changes between trees?  It's\n> primarily -L (changes in local) I need to keep the changes in my local\n> tree.  -R (changes in remote) is just useful to show what changes I'm\n> missing and might need to merge.\n\nFor -R, you'd probably do\n\n\tgit log yourtree theothertree\n\n(the range of changes between yourtree and theothertree, literally).\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"1515","messageId":"1114346892.4997.5.camel@mulgrave","threadId":"267","inReplyTo":"20050424123621.GB1507@pasky.ji.cz","subject":"Re: git-changes-script to show inter tree changes","fromName":"James Bottomley","fromEmail":"james.bottomley@steeleye.com","sentAt":"2005-04-24T12:48:12Z","receivedAt":"2005-04-24T12:48:12Z","isPatch":false,"sender":{"key":"james.bottomley@steeleye.com","avatar":null},"body":"On Sun, 2005-04-24 at 14:36 +0200, Petr Baudis wrote:\n> Aha,  I thought this is based on the current gitlog.sh, sorry.\n\nI think it is ... such a beast briefly appeared in the git tree, which\nis where I got the skeleton from.\n\n> For -R, you'd probably do\n> \n> \tgit log yourtree theothertree\n> \n> (the range of changes between yourtree and theothertree, literally).\n\nAs long as that's a true what's in the other tree only, -L should appear\nif you simply reverse the arguments.\n\nJames\n\n\n"}]}