# HG changeset patch
# User Steve Losh <steve@stevelosh.com>
# Date 1279670373 14400
# Node ID 53aadb5be2b6a6816bbe358e1751f82bd3551b27
# Parent  9cd3f1057ae106eb1ca68c3769a4c32a345a1e20
cli: automatically clone the review data with --web

diff -r 9cd3f1057ae1 -r 53aadb5be2b6 docs/index.rst
--- a/docs/index.rst	Tue Jul 20 19:43:02 2010 -0400
+++ b/docs/index.rst	Tue Jul 20 19:59:33 2010 -0400
@@ -34,11 +34,9 @@
 Now you need a repository that has code review enabled.  Luckily, you've
 already got one -- hg-review uses itself for code review. 
 
-``cd`` into the directory you cloned hg-review to and initialize the review
-data, then start the web interface::
+``cd`` into the directory you cloned hg-review to and start the web interface::
 
     cd hg-review
-    hg review --init
     hg review --web
 
 Open http://localhost:8080/ in your browser of choice and poke around. Check
diff -r 9cd3f1057ae1 -r 53aadb5be2b6 docs/overview.rst
--- a/docs/overview.rst	Tue Jul 20 19:43:02 2010 -0400
+++ b/docs/overview.rst	Tue Jul 20 19:59:33 2010 -0400
@@ -38,11 +38,9 @@
 '''''''''''''''''''''''''''''''''''
 
 If you want to work with a repository that already has code review set up all
-you need to do is cd into that repository, pull down the review data, and fire
-up the web ui::
+you need to do is cd into that repository, and fire up the web ui::
 
     cd ~/src/someproject
-    hg review --init
     hg review --web
 
 Once that's done you can visit http://localhost:8080/ in your browser to start
diff -r 9cd3f1057ae1 -r 53aadb5be2b6 review/cli.py
--- a/review/cli.py	Tue Jul 20 19:43:02 2010 -0400
+++ b/review/cli.py	Tue Jul 20 19:59:33 2010 -0400
@@ -75,6 +75,10 @@
     allow_anon = opts.pop('allow_anon')
     address = opts.pop('address')
     port = int(opts.pop('port'))
+
+    if api.review_initialized(repo) and not api.local_datastore_exists(repo):
+        _init_command(ui, repo, remote_path=None)
+
     rd = _get_datastore(ui, repo)
 
     import web