4779: Trying to update a review wiht --diff-filename instead created a new review on perforce

zgeorgiev

What version are you running?

rbt 1.0.1

What steps will reproduce the problem?

  1. create a review with rbt post --diff-filename <CLN>
  2. make changes to your perforce changelist
  3. try to update the review with rbt post --diff-filename <CLN>

What is the expected output? What do you see instead?

I know that using -r <rid> would fix my problem it just seem counter intuitive that rbt post <CLN> updates the existing review for <CLN> and adding --diff-filename breaks that behaviour.

From looking at the code it seems that running get_revisions before the if which checks for self.options.diff_filename in commands/post.py (line 772) would fix my issue. Since I am providing a CLN get_revisions() will succeed and in cases in which this is not true it will just return None. I am just not sure why it's so important to keep self.revision None in the case --diff-filename is provided. I looked at the code for the alpha version on github (master branch) and this is also true there.

What operating system are you using?

CentOS 6.6

Debug output:

$ rbt post --diff-filename <diff_location> -d <CLN> 
DEBUG:root:RBTools 1.0.1
>>> RBTools 1.0.1
DEBUG:root:Python 2.7.5 (default, Jul 18 2013, 18:13:04)
[GCC 4.1.2]
>>> Python 2.7.5 (default, Jul 18 2013, 18:13:04)
[GCC 4.1.2]
DEBUG:root:Running on Linux-2.6.32-642.6.2.el6.x86_64-x86_64-with-centos-6.6-Final
>>> Running on Linux-2.6.32-642.6.2.el6.x86_64-x86_64-with-centos-6.6-Final
DEBUG:root:Home = /mts-sof/home/zgeorgiev
>>> Home = /mts-sof/home/zgeorgiev
DEBUG:root:Current directory = /dbc/sof4-dbc302/zgeorgiev/post-review-test/bora/vim/lib/vmacore/http
>>> Current directory = /dbc/sof4-dbc302/zgeorgiev/post-review-test/bora/vim/lib/vmacore/http
DEBUG:root:Command line: rbt post --description-file /tmp/tmpJRUT69 --testing-done-file /tmp/tmpIwRdT_ --summary "post-review test      " --diff-filename /tmp/tmp4yxIlC -d 6745477
>>> Command line: rbt post --description-file /tmp/tmpJRUT69 --testing-done-file /tmp/tmpIwRdT_ --summary "post-review test     " --diff-filename /tmp/tmp4yxIlC -d 6745477
DEBUG:root:Running: tf vc help
>>> Running: tf vc help
DEBUG:root:Checking for a Subversion repository...
>>> Checking for a Subversion repository...
DEBUG:root:Running: svn --non-interactive info
>>> Running: svn --non-interactive info
DEBUG:root:Command exited with rc 1: [u'svn', u'--non-interactive', u'info']
>>> Command exited with rc 1: [u'svn', u'--non-interactive', u'info']
DEBUG:root:Checking for a Git repository...
>>> Checking for a Git repository...
DEBUG:root:Running: git rev-parse --git-dir
>>> Running: git rev-parse --git-dir
DEBUG:root:Command exited with rc 128: [u'git', u'rev-parse', u'--git-dir']
fatal: Not a git repository (or any parent up to mount point /dbc/sof4-dbc302)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
---
>>> Command exited with rc 128: [u'git', u'rev-parse', u'--git-dir']
fatal: Not a git repository (or any parent up to mount point /dbc/sof4-dbc302)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
---
DEBUG:root:Checking for a Mercurial repository...
>>> Checking for a Mercurial repository...
DEBUG:root:Running: hg root
>>> Running: hg root
DEBUG:root:Command exited with rc 255: [u'hg', u'root']
abort: There is no Mercurial repository here (.hg not found)!
---
>>> Command exited with rc 255: [u'hg', u'root']
abort: There is no Mercurial repository here (.hg not found)!
---
DEBUG:root:Checking for a CVS repository...
>>> Checking for a CVS repository...
DEBUG:root:Checking for a Perforce repository...
>>> Checking for a Perforce repository...
DEBUG:root:Running: p4 info
>>> Running: p4 info
DEBUG:root:Running: diff --version
>>> Running: diff --version
DEBUG:root:Repository info: Path: [u'perforce.eng.vmware.com:1666', u'sof4-build-rdev2.eng.vmware.com:1666'], Base path: None, Supports changesets: True
>>> Repository info: Path: [u'perforce.eng.vmware.com:1666', u'sof4-build-rdev2.eng.vmware.com:1666'], Base path: None, Supports changesets: True
DEBUG:root:Checking for a Plastic repository...
>>> Checking for a Plastic repository...
DEBUG:root:Unable to execute "cm version": skipping Plastic
>>> Unable to execute "cm version": skipping Plastic
DEBUG:root:Checking for a ClearCase repository...
>>> Checking for a ClearCase repository...
DEBUG:root:Unable to execute "cleartool help": skipping ClearCase
>>> Unable to execute "cleartool help": skipping ClearCase
DEBUG:root:Checking for a Bazaar repository...
>>> Checking for a Bazaar repository...
DEBUG:root:Unable to execute "bzr help": skipping Bazaar
>>> Unable to execute "bzr help": skipping Bazaar
DEBUG:root:Checking for a Team Foundation Server repository...
>>> Checking for a Team Foundation Server repository...
DEBUG:root:Unable to execute "tf help": skipping TFS
>>> Unable to execute "tf help": skipping TFS
DEBUG:root:Running: p4 counters
>>> Running: p4 counters
DEBUG:root:Making HTTP GET request to https://reviewboard.eng.vmware.com/api/
>>> Making HTTP GET request to https://reviewboard.eng.vmware.com/api/
DEBUG:root:Making HTTP GET request to https://reviewboard.eng.vmware.com/api/repositories/?only-links=&only-fields=path%2Cmirror_path
>>> Making HTTP GET request to https://reviewboard.eng.vmware.com/api/repositories/?only-links=&only-fields=path%2Cmirror_path
DEBUG:root:Cached response for HTTP GET https://reviewboard.eng.vmware.com/api/repositories/?only-links=&only-fields=path%2Cmirror_path expired and was modified
>>> Cached response for HTTP GET https://reviewboard.eng.vmware.com/api/repositories/?only-links=&only-fields=path%2Cmirror_path expired and was modified
DEBUG:root:Making HTTP GET request to https://reviewboard.eng.vmware.com/api/validation/diffs/
>>> Making HTTP GET request to https://reviewboard.eng.vmware.com/api/validation/diffs/
DEBUG:root:Cached response for HTTP GET https://reviewboard.eng.vmware.com/api/validation/diffs/ expired and was modified
>>> Cached response for HTTP GET https://reviewboard.eng.vmware.com/api/validation/diffs/ expired and was modified
DEBUG:root:Making HTTP POST request to https://reviewboard.eng.vmware.com/api/validation/diffs/
>>> Making HTTP POST request to https://reviewboard.eng.vmware.com/api/validation/diffs/
DEBUG:root:Making HTTP GET request to https://reviewboard.eng.vmware.com/api/review-requests/?only-links=create&only-fields=
>>> Making HTTP GET request to https://reviewboard.eng.vmware.com/api/review-requests/?only-links=create&only-fields=
DEBUG:root:Cached response for HTTP GET https://reviewboard.eng.vmware.com/api/review-requests/?only-links=create&only-fields= expired and was modified
>>> Cached response for HTTP GET https://reviewboard.eng.vmware.com/api/review-requests/?only-links=create&only-fields= expired and was modified
DEBUG:root:Making HTTP POST request to https://reviewboard.eng.vmware.com/api/review-requests/
>>> Making HTTP POST request to https://reviewboard.eng.vmware.com/api/review-requests/
DEBUG:root:Making HTTP GET request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/diffs/?only-fields=
>>> Making HTTP GET request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/diffs/?only-fields=
DEBUG:root:Added cache entry for HTTP GET request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/diffs/?only-fields=
>>> Added cache entry for HTTP GET request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/diffs/?only-fields=
DEBUG:root:Making HTTP POST request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/diffs/
>>> Making HTTP POST request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/diffs/
DEBUG:root:Making HTTP GET request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/draft/?only-fields=commit_id
>>> Making HTTP GET request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/draft/?only-fields=commit_id
DEBUG:root:Added cache entry for HTTP GET request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/draft/?only-fields=commit_id
>>> Added cache entry for HTTP GET request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/draft/?only-fields=commit_id
DEBUG:root:Making HTTP PUT request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/draft/
>>> Making HTTP PUT request to https://reviewboard.eng.vmware.com/api/review-requests/1459014/draft/
Review request #1459014 posted.