HowTo read all diffs by certain user in bzr

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 Ingo 
    branch 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.

Add new comment

The content of this field is kept private and will not be shown publicly. Cookie & Privacy Policy
  • No HTML tags allowed.
  • External and mailto links in content links have an icon.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
  • Use [fn]...[/fn] (or <fn>...</fn>) to insert automatically numbered footnotes.
  • Each email address will be obfuscated in a human readable fashion or, if JavaScript is enabled, replaced with a spam resistent clickable link. Email addresses will get the default web form unless specified. If replacement text (a persons name) is required a webform is also required. Separate each part with the "|" pipe symbol. Replace spaces in names with "_".
About the bookAbout this siteAcademicAccordAmazonBeginnersBooksBuildBotBusiness modelsbzrCassandraCloudcloud computingclsCommunitycommunityleadershipsummitConsistencycoodiaryCopyrightCreative CommonscssDatabasesdataminingDatastaxDevOpsDistributed ConsensusDrizzleDrupalEconomyelectronEthicsEurovisionFacebookFrosconFunnyGaleraGISgithubGnomeGovernanceHandlerSocketHigh AvailabilityimpressionistimpressjsInkscapeInternetJavaScriptjsonKDEKubuntuLicensingLinuxMaidanMaker cultureMariaDBmarkdownMEAN stackMepSQLMicrosoftMobileMongoDBMontyProgramMusicMySQLMySQL ClusterNerdsNodeNoSQLodbaOpen ContentOpen SourceOpenSQLCampOracleOSConPAMPPatentsPerconaperformancePersonalPhilosophyPHPPiratesPlanetDrupalPoliticsPostgreSQLPresalespresentationsPress releasesProgrammingRed HatReplicationSeveralninesSillySkySQLSolonStartupsSunSybaseSymbiansysbenchtalksTechnicalTechnologyThe making ofTransactionsTungstenTwitterUbuntuvolcanoWeb2.0WikipediaWork from HomexmlYouTube