iproetel avatar iproetel committed 2d8b2c7

fix creating new request

Comments (0)

Files changed (1)

check-state.patch

 # HG changeset patch
 # Parent f5d518fb6960aa7d14b1c02bd65839ff4555df7c
 Check if the an existing review is pending or if it should be reopened.
-If modification of an existing review was requested but it is not pending and it must not be reopened create a new request. 
+If modification of an existing review was requested but it is not pending and it must not be reopened create a new request.
 This is helpful for 'qpostreview' to handle alread closed reviews on previously posted patches.
 
 diff -r f5d518fb6960 mercurial_reviewboard/__init__.py
 --- a/mercurial_reviewboard/__init__.py	Tue Jul 05 18:06:34 2011 +0200
-+++ b/mercurial_reviewboard/__init__.py	Tue Jul 05 18:10:02 2011 +0200
++++ b/mercurial_reviewboard/__init__.py	Tue Aug 02 18:29:09 2011 +0200
 @@ -189,12 +189,13 @@
  def send_review(ui, repo, c, parentc, diff, parentdiff, opts):
  
                                     opts)
  
      request_url = '%s/%s/%s/' % (find_server(ui, opts), "r", request_id)
-@@ -262,19 +263,55 @@
+@@ -262,19 +263,56 @@
      except ReviewBoardError, msg:
          raise util.Abort(_(str(msg)))
  
 +        elif r == 0: # abort
 +            raise util.Abort(_('user quit'))
 +        elif r == 1: # new
++            opts['existing'] = None
 +            return False
 +        elif r == 2: # reopen
 +            opts['reopen'] = 'reopen'
 +def update_review(reviewboard, request_id, ui, fields, diff, parentdiff, opts, reopen = False):
      try:
 +        status = reviewboard.get_status(request_id)
-+        if opts['reopen'] :
++        if opts.has_key('reopen') :
 +            ui.debug('reopen request %s\n' % request_id)
 +            reviewboard.set_status(request_id, 'pending')
 +
  
 diff -r f5d518fb6960 mercurial_reviewboard/reviewboard.py
 --- a/mercurial_reviewboard/reviewboard.py	Tue Jul 05 18:06:34 2011 +0200
-+++ b/mercurial_reviewboard/reviewboard.py	Tue Jul 05 18:10:02 2011 +0200
++++ b/mercurial_reviewboard/reviewboard.py	Tue Aug 02 18:29:09 2011 +0200
 @@ -240,7 +240,7 @@
              code = e.reason[0]
              msg = "URL Error: " + e.reason[1]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.