I am currently using RB 3.0.18. I've configured our instance, which runs in Docker, with a number of Git repos.
The configuration uses ssh; so entries look like this:
ssh://gitoliteuser@gitserver/mygitrepo.git
We link to our own internal gitweb instance, and entries for the raw url file mask look like this:
Initial access to the repo, and linking reviews for new code works just fine:
rbt post -d a23476f834ef86d8f9549f3c35b258422911421fe
...
...
Review request #5 posted.
However, if I edit a file that already exists in my Git branch, commit, and then try to submit code for review, I get an Error 207 (File not found):
rbt post -d a08f68f834ef86d8f9549fa3eb258422911421fe
>>> RBTools 1.0.3
>>> Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0]
>>> Running on Linux-5.4.0-0.bpo.4-amd64-x86_64-with-debian-10.0
>>> Home = /home/myuser
>>> Current directory = /home/myuser/src/mygitrepo
>>> Command line: rbt post -d a08f68f834ef86d8f9549fa3eb258422911421fe
>>> Running: tf vc help
>>> Checking for a Git repository...
>>> Running: git rev-parse --git-dir
>>> Running: git config core.bare
>>> Running: git rev-parse --show-toplevel
>>> Running: git symbolic-ref -q HEAD
>>> Running: git config --get branch.master.merge
>>> Running: git config --get branch.master.remote
>>> Running: git config --get remote.origin.url
>>> Repository info: Path: git:mygitrepo, Base path: , Supports changesets: False
>>> Making HTTP GET request to
http://reviewboard.oursite.com/api/>>> Running: git rev-parse a08f68f834ef86d8f9549fa3eb258422911421fe
>>> Running: git rev-parse a08f68f834ef86d8f9549fa3eb258422911421fe^
>>> Running: git config --get branch.master.merge
>>> Running: git config --get branch.master.remote
>>> Running: git branch --remotes
>>> Running: git rev-list e66800919f5d3dfba8a6416ad393794485aa2b9c --not --remotes=origin
>>> Running: git version
>>> Running: git -c core.quotepath=false -c diff.noprefix=false diff --no-color --full-index --ignore-submodules -M --no-ext-diff e66800919f5d3dfba8a6416ad393794485aa2b9c..a08f68f834ef86d8f9549fa3eb258422911421fe
>>> Generated diff size: 310 bytes
>>> Making HTTP GET request to
http://reviewboard.oursite.com/api/validation/diffs/>>> Cached response for HTTP GET
http://reviewboard.oursite.com/api/validation/diffs/ expired and was modified
>>> Making HTTP POST request to
http://reviewboard.oursite.com/api/validation/diffs/>>> Got API Error 207 (HTTP code 400): The file was not found in the repository.
>>> Error data: {u'stat': u'fail', u'file': u'test.foo', u'err': {u'msg': u'The file was not found in the repository.', u'code': 207}, u'revision': u'b646fadbca709a770dfcca95cadaeb50aac92627'}
Traceback (most recent call last):
File "/usr/local/bin/rbt", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/rbtools/commands/main.py", line 120, in main
command.run_from_argv([RB_MAIN, command_name] + args)
File "/usr/local/lib/python2.7/dist-packages/rbtools/commands/__init__.py", line 725, in run_from_argv
exit_code = self.main(*args) or 0
File "/usr/local/lib/python2.7/dist-packages/rbtools/commands/post.py", line 874, in main
(msg_prefix, e))
rbtools.commands.CommandError: Error validating diff
test.foo: The file was not found in the repository. (HTTP 400, API Error 207)
Note the very first git diff command:
>>> Running: git -c core.quotepath=false -c diff.noprefix=false diff --no-color --full-index --ignore-submodules -M --no-ext-diff e66800919f5d3dfba8a6416ad393794485aa2b9c..a08f68f834ef86d8f9549fa3eb258422911421fe
This command has the actual, correct git hashes.
Note the API error:
>>> Got API Error 207 (HTTP code 400): The file was not found in the repository.
>>> Error data: {u'stat': u'fail', u'file': u'test.foo', u'err': {u'msg': u'The file was not found in the repository.', u'code': 207}, u'revision': u'b646fadbca709a770dfcca95cadaeb50aac92627'}
This has an incorrect hash, one that doesn't seem to exist in the remote repo, or my local working copy at all.
I put some debugging code in rbtools/api/request.py in "def make_request(self, request)" on the client to see if I could figure out what was going on, and I can confirm that the rbt client is in fact sending the wrong hash:
print("BODY: ", request.url, " ", body, " ", headers)
I get the following output:
rbt post a08f68f834ef86d8f9549fa3eb258422911421fe
(u'BODY: ', '
http://reviewboard.oursite.com/api/', u' ', None, u' ', {u'Content-Length': u'0'})
(u'BODY: ', '
http://reviewboard.oursite.com/api/validation/diffs/', u' ', None, u' ', {u'Content-Length': u'0'})
(u'BODY: ', '
http://reviewboard.oursite.com/api/validation/diffs/', u' ', '--===============6823395440781781946==\r\nContent-Disposition: form-data; name="base_commit_id"\r\n\r\ne66800919f5d3dfba8a6416ad393794485aa2b9c\r\n--===============6823395440781781946==\r\nContent-Disposition: form-data; name="repository"\r\n\r\nmygitrepo\r\n--===============6823395440781781946==\r\nContent-Disposition: form-data; name="path"; filename="diff"\r\nContent-Type: application/octet-stream\r\n\r\ndiff --git a/test.foo b/test.foo\nindex b646fadbca709a770dfcca95cadaeb50aac92627..0c3894442990dcaf42f8099cc3c0d9a731332174 100644\n--- a/test.foo\n+++ b/test.foo\n@@ -2,3 +2,5 @@\n exec /bin/bash\n # oh no I forgot another thing\n exec /bin/anotherthing\n+# boy do I love forgetting things\n+exec /bin/forgettingthings\n\r\n--===============6823395440781781946==--\r\n\r\n', u' ', {u'Content-Length': '741', u'Content-Type': u'multipart/form-data; boundary================6823395440781781946=='})
ERROR: Error validating diff
There's that git hash that doesn't exist:
diff --git a/test.foo b/test.foo\nindex
b646fadbca709a770dfcca95cadaeb50aac92627..0c3894442990dcaf42f8099cc3c0d9a731332174
100644\n--- a/test.foo\n+++ b/test.foo\n@@ -2,3 +2,5
Where is the rbt client getting this hash? Should I have my RB repostories configured differently?
Thanks,
Ed