My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
CodeReviewHelp  
Help for Rietveld, the code review web app at http://codereview.appspot.com.
Featured
Updated Aug 1, 2011 by techtonik@gmail.com

Starting a Code Review

A patch set is a set of diffs relative to a specific revision of the files in a particular VCS repository. The format used is a unified diff as output by the diff command of the underlying version control system.

There are three ways to start a code review:

1. Recommended way is to use a small command line utility upload.py (requires Python 2.5+ - no Python 3 yet). In *nix you may want to install it in your personal bin directory with mode 755. This is by far the most convenient and versatile approach, because the utility is able to extract all required information automatically, and all you have to do is enter a brief message to be used as the subject line. The utility prints the URL for your newly created issue.

2. Upload a patch set to the web app using the Create Issue form. Not recommended, because most contributors use upload.py, and its interface is supported better.

3. Let the web part of Rietveld fetch the patch set from another web server, for example the Python issue tracker. This is also done via the Create Issue form, using the "Url" field.

Adding patch sets

It is possible to add a new patch set to an existing issue. When you used the "Create Issue" form initially, you can use the "Add Another Patch Set" section that appears below the last patch set added. When you used the upload.py utility, you can pass the "-i NNNN" flag to the utility, where NNNN is the numeric Issue ID.

Once you have two or more patch sets in an issue, you can view the delta between any two patch sets by using the "Delta from patch set" links in the last column of the file list for any patch set.

All but the most recent patch set listings are normally collapsed; you must click on the patch set heading to reveal the list of files in older patch sets.

Inviting a Reviewer

To invite a reviewer for a particular issue, go to the page with details about the issue, and follow the "Publish+Mail Comments" link. This brings you to a simple form where you can add the reviewer's email address or nickname to the "Reviewers" field and enter a brief message explaining to them the purpose of the review. Clicking on "Publish All My Drafts" (the odd label will become clear later) will then send them an email. You can invite multiple reviewers by entering their email addresses or nicknames separated by commas. Only the "user@domain.suffix" part of the email must be entered: do not enter the real name.

Anybody can change the list of reviewers this way. The issue owner can also edit the list of reviewers using the "Edit Issue" form.

When you use the upload.py utility, you can pass the "-r REVIEWER" flag to the utility, where REVIEWER is the reviewers email address or nickname.

Conducting a Review

If you're invited to a review, you'll follow the link in the email, which takes you to the issue detail page. On that page you'll see a list of files. Selecting the filename will take you to a copy of the unified diff, which is not too interesting. However, following the link labeled "View" takes you to a double source listing, a so-called side-by-side diff where the old version of the file is on the left and the new version is on the right. Deletions on the left are shown with a red background, additions on the right with a green background.

Navigating the Diff

In order to jump straight to the first diff chunk, hit the 'n' key once or twice. Each time you hit 'n' you are taken to the next chunk, until you have reached the end of the file. You can also use 'p' to move back up. Later, once there are in-line comments, these commands also stop at comments; use 'N' and 'P' to jump between comments only.

Long stretches of matching lines are suppressed; you'll see the text (...skipping N matching lines...) on a light blue background. this is done to avoid exceeding the strict limits enforced by App Engine on response size (1 MB) and request processing time (10 seconds).

If the patch set consists of multiple files, you can navigate between files using 'j' (next file) and 'k' (previous file). (Vi, Vim or Gmail users can think of these commands moving up ('k) or down ('j') in the list of files that you saw earlier.)

Entering In-line Comments

When you see something in the code you want to comment on, simply double-click the line on which you want to comment. Through the magic of JavaScript, a small text editing dialog will open up below that line, where you can enter as much text as you want. (There's a small '+' icon to the right that makes the text area larger each time you click it.) When you're done with a comment, don't forget to click the "Save" button (hitting Control-s works too). If you clicked "Save" too soon or change your mind, you can always hit the "Edit" link that appears under the completed comment, and edit or discard it.

Publishing In-line Comments

You're not done yet! Once you have splattered comments all over the files in the patch set, there's one more thing to do: you must publish your comments! So far, all your comments have been stored in the database as drafts, which means that only you can see and edit them. To remind you of this "limbo" state, the issue page lists the number of draft comments in red, and displays a pretty alarming warning at the top when you have any draft comments. To get rid of this, follow one of the "Publish+Main Comments" links (there are several on the diff page as well as on the issue page), enter a brief message, and click "Publish All My Drafts". This will send an email to the issue owner and to all reviewers, and publish your drafts on the web app so that others can see them. (If you'd rather not send email, you can uncheck the "Send mail" check box.)

Closing the Issue

An issue's owner can close the issue by using the "Edit Issue" form and checking the "Closed" box. Closed issues are hidden from most overview listings but can otherwise continue to be used. An issue's owner can reopen the issue by unchecking the "Closed" box.

An issue's owner can also delete the issue. This is irrevocable and all traces of the issue are removed from the data store. There is no undo and no backup. Regrets are not accepted.

There are few good reasons to delete an issue: cleaning up test issues is one, removing sensitive information accidentally posted is another.

Access Control

Apart from draft comments, which are only visible to their author, all comments are visible to anyone who visits the site, even if they are not logged in. Anybody can view all issues, too. Only the owner of an issue can edit its subject, description, and list of reviewers, but anybody (even people not listed as reviewers) can add new comments to an issue. Comments however cannot be entered anonymously; you must be logged in.

Using Code Reviews with Google Apps

How do I set up Google Code Reviews for my organization?

Google Code Reviews is available to Google Apps customers as part of Labs for Google Apps.

If you are an existing Google Apps customer, proceed to the Google Solutions Marketplace, click 'Add It Now' and follow the instructions. When installing Google Code Reviews for your domain, you will be prompted to assign a custom URL for the service like 'cr.example.com'.

If you are not currently using Google Apps go sign up before visiting the Solutions Marketplace.

Why should I use Google Code Reviews on my domain?

Using Google Code Reviews on your domain allows you to do the following: host on a custom url for your domain, e.g. cr.example.com make code changes and comments entirely internal to your organization optionally allow outside parties to view your content, but not participate

How do I administer Google Code Reviews for my domain?

Once installed, you can go to http://google.com/a/example.com/LabServiceSettings?appId=codereview to manage or remove the application.

I have private feedback for Google Code Reviews for Google Apps

Please send your feedback to code-reviews-for-apps-feedback@groups.google.com

Comment by sra%chro...@gtempaccount.com, Sep 18, 2009

How do I download and apply a raw patch set?

Comment by project member gvanros...@gmail.com, Sep 18, 2009

Download a patch using the "Download raw patch set" link (it's in the blue box around the list of files on the issue page). You will have to use your brownser's Save As command.

To apply a patch, there's a wonderful Unix utility, patch(1). If you're not running a Unix/Linux variant, search the web for "GNU patch".

Comment by adam.sah, Oct 12, 2009

is there a way to delete a review, e.g. if it accidentally contains confidential data? thanks!!

Comment by project member gvanros...@gmail.com, Oct 12, 2009

You could always make the issue private, assuming you own it. (Go to Edit Issue.)

Comment by srl...@gmail.com, Jan 7, 2010

Is there a way to automatically create a patch from the difference between two spots on the repository? I.e. trunk vs. my branch?

Comment by project member gvanros...@gmail.com, Jan 7, 2010

> Is there a way to automatically create a patch from the difference between two spots on the repository? I.e. trunk vs. my branch?

That is a question for the source control system you use.

Comment by srl...@gmail.com, Jan 7, 2010

> That is a question for the source control system you use.

I guess I can do a review of an 'attempted merge back into the trunk'. Thanks!

Comment by akso...@gmail.com, Feb 3, 2010

Is it possible to restrict access for sources view?

Comment by project member albrecht.andi, Feb 3, 2010

> Is it possible to restrict access for sources view?

Yes, you can create private issues. Private issues are only visible to the issue owners and the reviewers.

Comment by john.gue...@gmail.com, Mar 31, 2010

If I'm using CVS, and I don't have a public url to put in the base field of add issue, is there any way to upload my base files for the side to side diff manually?

Comment by project member gvanros...@gmail.com, Mar 31, 2010

CVS is currently not supported, but it could be added to the list of version control systems supported by upload.py. It would be a fair amount of work to add support for it though.

Comment by aglen...@gmail.com, Apr 26, 2010

When using upload.py, is there a way to exclude particular files from an issue?

Comment by project member gvanros...@gmail.com, Apr 26, 2010

You can pass the set of files or directories you do want to be part of the review to the upload.py command line.

Comment by anthonybaxter@gmail.com, May 2, 2010

Hm. Patch doesn't work with the patchsets if they have binary files in them. The binary files look like:

Index: third_party/runtime/mongodb/mongo-1.3.jar

new file mode 100644 index 0000000000000000000000000000000000000000..101368535846ace5cc4ea04ccca88fb1499b669c GIT binary patch literal 231113 ... encoded binary data...

Any idea how to apply this to a mercurial repo?

Comment by project member gvanros...@gmail.com, May 3, 2010

@anthonybaxter: try asking for help on the codereview-discuss list.

Comment by andy@happyphonoodles.com, Jan 25, 2011

Hi everybody, Rietveld is great - thanks Guido! I'm trying to figure out how to use upload.py with Google Apps and am hoping for some help. I downloaded upload.py using the link from within our Google Apps account. I've tried everything. Here is the command when run from the root of the local SVN project which is checked out: [oracle@cpu2 myproject]$ pwd /home/oracle/Desktop/svn-test/myproject /home/oracle/Desktop/Python-2.7.1/python ../upload.py --server=http://codereview.happyphonoodles.com --email=andy@happyphonoodles.com --rev=2 --noisy

OUTPUT: 2011-01-25 17:49:36 INFO upload.py:688 Running ['hg', 'root'] 2011-01-25 17:49:36 INFO upload.py:1784 Guessed VCS = Subversion 2011-01-25 17:49:36 INFO upload.py:688 Running ['svn', 'info'] Traceback (most recent call last):

File "../upload.py", line 2123, in <module>
main()
File "../upload.py", line 2115, in main
RealMain?(sys.argv)
File "../upload.py", line 1990, in RealMain?
vcs = GuessVCS(options)
File "../upload.py", line 1829, in GuessVCS
return SubversionVCS(options)
File "../upload.py", line 890, in init
self.svn_base = self.GuessBase?(required)
File "../upload.py", line 903, in GuessBase?
info = RunShell?(["svn", "info"])
File "../upload.py", line 715, in RunShell?
universal_newlines, env)
File "../upload.py", line 691, in RunShellWithReturnCode?
env=env)
File "/home/oracle/Desktop/Python-2.7.1/Lib/subprocess.py", line 672, in init
errread, errwrite)
File "/home/oracle/Desktop/Python-2.7.1/Lib/subprocess.py", line 1202, in execute_child
raise child_exception
OSError: 2? No such file or directory

Thank you very much and best regards,

Andy (414) 212-5372

Comment by project member albrecht.andi, Jan 25, 2011

@Andy, it looks like that the "svn" executable couldn't be found. upload.py has detected the ".svn" directories in your project (that is what "Guessed VCS = Subversion" means) and then tries call "svn info".

Comment by andrew.p...@gmail.com, Jan 26, 2011

Thanks Andi! I have a German "brother" from Haltern, so almost in your neighborhood. We have visited a couple of times and have very fond memories of Germany! So I fixed my path, next time I'll remember that programs don't use absolute paths. However now it appears upload.py does not support SVN repos over https? It appears that even though I set --base_url= to the http repo (which I verified works properly) rather than the https repo, and upload.py confirmed this (as shown in the log below), it later defaults back to the https URL, which appears may be causing the error given the message "AttributeError?: 'module' object has no attribute 'HTTPSHandler'". Humph. Here is the log:

[oracle@cpu2 myproject]$ /home/oracle/Desktop/Python-2.7.1/python ../upload.py --server=http://codereview.happyphonoodles.com --email=andy@happyphonoodles.com --base_url=http://mysvn.svn.cvsdude.com/myproject/ --rev=2 --noisy 2011-01-26 11:06:58 INFO upload.py:688 Running ['hg', 'root'] 2011-01-26 11:06:58 INFO upload.py:1784 Guessed VCS = Subversion 2011-01-26 11:06:58 INFO upload.py:688 Running ['svn', 'info'] 2011-01-26 11:06:58 INFO upload.py:922 Guessed base = https://mysvn.svn.cvsdude.com/myproject/ Using base URL "http://mysvn.svn.cvsdude.com/myproject/" from --base_url instead of "https://mysvn.svn.cvsdude.com/myproject/" 2011-01-26 11:06:58 INFO upload.py:688 Running ['svn', 'status', '--ignore-externals'] 2011-01-26 11:06:59 INFO upload.py:688 Running ['svn', 'diff', '-r', '2'] 2011-01-26 11:07:11 INFO upload.py:938 Index: trunk/helloworld.txt 2011-01-26 11:07:11 INFO upload.py:688 Running ['svn', 'list', '-r', '2', 'trunk'] 2011-01-26 11:07:13 INFO upload.py:688 Running ['svn', 'list', 'trunk'] 2011-01-26 11:07:14 INFO upload.py:688 Running ['svn', 'propget', 'svn:mime-type', 'https://mysvn.svn.cvsdude.com/myproject//trunk/helloworld.txt@2']

2011-01-26 11:07:18 INFO upload.py:688 Running ['svn', 'cat', 'https://mysvn.svn.cvsdude.com/myproject//trunk/helloworld.txt@2'] 2011-01-26 11:07:30 INFO upload.py:688 Running ['svn', 'propget', 'svn:keywords', 'https://mysvn.svn.cvsdude.com/myproject//trunk/helloworld.txt@2'] Upload server: http://codereview.happyphonoodles.com (change with -s/--server) New issue subject: test code review Traceback (most recent call last):

File "../upload.py", line 2123, in <module>
main()
File "../upload.py", line 2115, in main
RealMain?(sys.argv)
File "../upload.py", line 2030, in RealMain?
options.account_type)
File "../upload.py", line 624, in GetRpcServer?
save_cookies=save_cookies)
File "../upload.py", line 202, in init
self.opener = self.GetOpener?()
File "../upload.py", line 433, in GetOpener?
opener.add_handler(urllib2.HTTPSHandler())
AttributeError?: 'module' object has no attribute 'HTTPSHandler'

I searched the rietveld wiki and issues though found no discussion of https.

Thanks again and best regards,

Andy

Comment by project member albrecht.andi, Jan 26, 2011

@Andy: It looks like your Python lacks SSL support. Some distributions provide separate packages for it. BTW, please post issue not directly related to this wiki page on the discussion group at http://groups.google.com/group/codereview-discuss

Comment by andrew.p...@gmail.com, Jan 27, 2011

Thanks Andi - that did it! Thanks for the pointer to the group, I'll make sure to use that in the future. After installing openssl-devel and recompiling python, update.pl worked without issue! Thanks again and best regards, Andy

Comment by csegenyz...@gmail.com, Feb 3, 2012

Thank You guys! bed bugs


Sign in to add a comment
Powered by Google Project Hosting