In the series of shell one liners, today I wanted to stalk someone, so I came up with this one liner to show all diffs ever created by a specific user in a give bzr repository:
bzr log -n0 | grep -B 1 henrik | grep revno | grep -v merge | \ awk -F'revno: ' '{print $2}' | while read revno; do echo; \ echo '#####################################################################'; \ echo revno: $revno; bzr diff -c$revno; done
bzr log -n0
prints out the full log history of your repo. It may look something like this:
------------------------------------------------------------ revno: 2441.2.16 [merge] committer: Henrik Ingobranch nick: drizzle-json_server-keyvalue timestamp: Sun 2012-05-20 17:21:22 +0300 message: Merging the documentation for 0.2. ------------------------------------------------------------ revno: 2441.4.3 committer: Henrik Ingo branch nick: drizzle-json_server-doc timestamp: Sat 2012-05-19 19:26:37 +0300 message: More JSON Server documentation: Revert back from using sphinxcontrib.httpdomain to document JSON Server HTTP API. While this was nice, we don't want to introduce a dependency to download additional sphinx modules to all build slaves and devs. Instead we simply use .. code-block:: none Add documentation on the /sql API. Add more intro and a list of parameters for the /json API.
As you can see, the committer name is just below the revno. We want to extract the revno, so we do it like this:
grep -B 1 henrik | grep revno | grep -v merge | awk -F'revno: ' '{print $2}'
This says:
* Print one line above each occurence of "henrik"
* Print only the lines including "revno" (This excludes the "committer" lines)
* Do not print lines including the word "merge" (only real commits, not merges)
* Use awk to extract the revno number from the rest of the line
We then use the while loop to run bzr diff -c
for each revno.
- Log in to post comments
- 7297 views