-> chromium-dev

On Fri, Jun 12, 2009 at 1:18 PM, Jim Roskind<[email protected]> wrote:
> I really like Erik's suggestion. Automatic assistance, without having to
> learn to use a pile of new tools, and manually enter file names (yet again)
> in svn blame, etc.

Patches to Rietveld are welcome, but implementing this would be a
significant effort.


> It would be very sweet if, whenever I did a gcl upload, and then looked at
> my uploaded changes, that I could automatically see who had provided (most
> recently) the lines I was editing, and/or who was hacking recently on each
> file.

Patches to Rietveld are welcome, but implementing this would be a
significant effort. (e.g. a svn blame beside the side-by-side diff
view). Instead, run this script:

---- CUT HERE ---
#!/bin/python
# Copyright (c) 2009 Marc-Antoine Ruel. No rights reserved. :)
import re
import subprocess

__author__ = '[email protected]'

def SVN(args):
  return subprocess.Popen(['svn'] + args,
      stdout=subprocess.PIPE).communicate()[0].splitlines()

files = SVN(['status'])
# Filter unwanted files.
files = filter(lambda x: x[0] not in ('?', 'D', 'A', 'C'), files)
files = map(lambda x: x[7:].strip(), files)

for i in files:
  hunks = []
  # Strip the header.
  diff = SVN(['diff', i])[4:]
  # Parse hunks.
  for line in diff:
    if line[0] in (' ', '+', '-', '\\'):
      hunks[-1].append(line)
    elif line[0] == '@':
      hunks.append([line])
  if not hunks:
    continue
  # Grab only the attribution, not the content.
  f = lambda x: re.match(r"^ (\d+ [...@]+).*$", x).group(1) + ' '
  blame = map(f, SVN(['blame', i]))

  print i
  for hunk in hunks:
    print hunk[0]
    start_line = int(re.match(r"@@ -(\d+),.*", hunk[0]).group(1))
    for line in hunk[1:]:
      if line[0] in (' ', '-'):
        print blame[start_line] + line
        start_line += 1
      else:
        print (' ' * len(blame[start_line])) + line
    print ''
--- CUT HERE ---

You have to set your console to 100+ column to have this script
usable. Alt-space, Properties (or defaults), Config.


> It would be very nice for each file I edited, if I could see a list of the
> most recent folks to have committed to that file (head of svn log).... and
> perhaps links to change lists.  That could give me clues about who did
> reviews last time ;-).

#!/bin/sh
for i in $(svn status | grep -v '^A' | cut -c 9-); do svn log -q
--limit 2 $i; done | grep r | uniq | sort -r


Now back to work...

M-A

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: [email protected] 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to