Commits

Nicolas Évrard  committed 91d7814

Adding testing script to hgreview

  • Participants
  • Parent commits eddc4bd

Comments (0)

Files changed (2)

File hgreview/__init__.py

         prompt = "Message describing this patch set:"
     else:
         prompt = "New issue subject:"
-    message = ui.prompt(prompt, '')
+    if opts['message']:
+        message = opts['message']
+    else:
+        message = ui.prompt(prompt, '')
     if not message:
         sys.exit(1)
 
     'review': (review, [
         ('r', 'reviewers', [], 'Add reviewers'),
         ('i', 'issue', '', 'Issue number. Defaults to new issue'),
+        ('m', 'message', '', 'Codereview message'),
         ('', 'rev', '', 'Revision number to diff against'),
         ('', 'send_email', None, 'Send notification email to reviewers'),
         ('', 'id', None, 'ouput issue id'),

File test-hgreview.t

+Creating a repository and initializing hgreview into it:
+
+  $ hg init a
+  $ echo "[extensions]" >> a/.hg/hgrc
+  $ echo "hgreview =" >> a/.hg/hgrc
+  $ echo "[review]" >> a/.hg/hgrc
+  $ echo "server = http://localhost:8080" >> a/.hg/hgrc
+  $ echo "username = test@somewhere.test" >> a/.hg/hgrc
+
+Then we do some changes to it, and submit them to a running rietveld instance:
+
+  $ cd a
+  $ echo 'test' > test
+  $ hg add test
+  $ hg review -m 'Adding test'
+  Server used http://localhost:8080
+  Issue created. URL: http://localhost:8080/* (glob)
+  Uploading base file for test
+  Uploading current file for test
+  $ ISSUENUM=`cat .hg/review_id`
+
+Now prepare another repository:
+
+  $ cd ..
+  $ hg init b
+  $ echo "[extensions]" >> b/.hg/hgrc
+  $ echo "hgreview =" >> b/.hg/hgrc
+  $ echo "[review]" >> b/.hg/hgrc
+  $ echo "server = http://localhost:8080" >> b/.hg/hgrc
+  $ echo "username = test@somewhere.test" >> b/.hg/hgrc
+
+And fetch the issue:
+
+  $ cd b
+  $ hg review --fetch -i $ISSUENUM
+  Looking after issue http://localhost:8080/* patch (glob)
+  applying http://localhost:8080/download/issue*.diff (glob)
+
+The two repositories should be identical
+
+  $ cd ..
+  $ diff -x .hg  -r a b