Review Board 2.x and "hg postreview"

209 views
Skip to first unread message

Bruce Cran

unread,
Jun 2, 2014, 2:22:09 PM6/2/14
to revie...@googlegroups.com
I'm investigating upgrading our installation to Review Board 2.x and one issue I've come across is that with the existing code, "hg postreview" doesn't work correctly. I've submitted a ticket to https://bitbucket.org/ccaughie/hgreviewboard, but I was wondering - are people still planning to use the hg postreview extension, or are you all switching to the rbt client?

-- 
Bruce

Christian Hammond

unread,
Jun 2, 2014, 2:27:33 PM6/2/14
to revie...@googlegroups.com
We made a number of improvements to the Mercurial support in RBTools 0.6. I don't have personal experience with hg subversion myself, so I don't know whether it's still at all necessary for any workflows. Certainly, we'd rather time be spent updating RBTools for any missing functionality.

Christian

--
Christian Hammond - chi...@chipx86.com
Review Board - http://www.reviewboard.org
Beanbag, Inc. - http://www.beanbaginc.com


--
Get the Review Board Power Pack at http://www.reviewboard.org/powerpack/
---
Sign up for Review Board hosting at RBCommons: https://rbcommons.com/
---
Happy user? Let us know at http://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups "reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sara Rayburn

unread,
Jun 2, 2014, 2:27:43 PM6/2/14
to revie...@googlegroups.com
Hi Bruce,

Most of the developers at my company are still using postreview with RB 2.0. We've always seen the error you reported in the bug, both with and without postreview. It seems to be a reviewboard issue. As a workaround, you might be able to make your parent diff include more changesets. The trick is that all of the changed files in your diff must be referenced in the parent diff as well. Hope that helps.

Sara

Colin Caughie

unread,
Jun 3, 2014, 10:33:42 AM6/3/14
to revie...@googlegroups.com
I and my team are still using "hg postreview" daily, including after upgrading to RB 2.0.1, and I'm still maintaining it as and when I have time (although I admit I've fallen behind on some of the requests in the issues list).

I haven't worked much with RBTools; I'm sure it works fine but what we like about postreview is that it follows the same syntax and logic as other Mercurial commands, which means you don't have to learn a new tool. It also integrates with TortoiseHg, which is handy for those who prefer a GUI.

As I mentioned in the bug report, and as Sara noted, the problem you're experiencing does not seem to be specific to hg postreview and does not seem to have changed since the upgrade to 2.x. It is something I'd like to get to the bottom of though so if you have any further information, e.g. what's going on in the particular diffs and parent diffs that cause this issue, I'd be glad to take a look at it.

Colin

Bruce Cran

unread,
Jun 4, 2014, 10:16:16 AM6/4/14
to revie...@googlegroups.com, Colin Caughie
On Tue, Jun 3, 2014 at 8:33 AM, Colin Caughie <c.ca...@gmail.com> wrote:
> It is something I'd like to get to the bottom of though so if you have any further information,
> e.g. what's going on in the particular diffs and parent diffs that cause this issue, I'd be  glad to take a look at it.


I've managed to recreate the problem such that 'rbt post' works and 'hg postreview' fails: first, on the remote server create a new repository with "hg init". Then, in Windows (with Python 2.7), run:

hg clone <repo> rbtest01
cd rbtest01
echo Line1 > file1.txt
hg add file1.txt
hg commit -m "initial commit"
hg push
echo Line1 > file2.txt
hg qnew first
echo Line2 >> file2.txt
hg qnew second
hg postreview


If you don't create file1.txt and try and create a review with an empty repo then 'rbt post' fails too, with:

>>> 1 outgoing changesets between remote and base.
>>> Running: hg parents --hidden -r 00d28ac9c6c6 --template {node|short} --config extensions.rbtoolsnormalize=C:\Python27\lib\site-packages\
rbtools-0.6-py2.7.egg\rbtools\helpers\hgext.py
Traceback (most recent call last):
  File "C:\Python27\Scripts\rbt-script.py", line 9, in <module>
    load_entry_point('RBTools==0.6', 'console_scripts', 'rbt')()
  File "C:\Python27\lib\site-packages\rbtools-0.6-py2.7.egg\rbtools\commands\main.py", line 134, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "C:\Python27\lib\site-packages\rbtools-0.6-py2.7.egg\rbtools\commands\__init__.py", line 422, in run_from_argv
    exit_code = self.main(*args) or 0
  File "C:\Python27\lib\site-packages\rbtools-0.6-py2.7.egg\rbtools\commands\post.py", line 717, in main
    revisions = self.get_revisions()
  File "C:\Python27\lib\site-packages\rbtools-0.6-py2.7.egg\rbtools\commands\post.py", line 619, in get_revisions
    self._revisions = self.tool.parse_revision_spec(self.cmd_args)
  File "C:\Python27\lib\site-packages\rbtools-0.6-py2.7.egg\rbtools\clients\mercurial.py", line 267, in parse_revision_spec
    '--template', '{node|short}']).split()[0]
IndexError: list index out of range

--
Bruce

Colin Caughie

unread,
Jun 4, 2014, 6:36:25 PM6/4/14
to Bruce Cran, revie...@googlegroups.com
Following those instructions exactly I get an error message of "The specified diff file is empty", which is not surprising since file2.txt was never added to the repository.

If I do "hg add file2.txt" before the first qnew on the other hand, "hg postreview" works fine and correctly shows Line2 being added to file2.txt.

If it is still breaking for you even with the hg add, can you let me know what versions of mercurial, ReviewBoard and the reviewboard extension you're using?

If you're using the latest versions and it still doesn't work, please send me the output of

hg postreview --debug --apitrace

Thanks,
Colin

Bruce Cran

unread,
Jun 4, 2014, 7:37:16 PM6/4/14
to revie...@googlegroups.com
I'm using Mercurial 3.0, ReviewBoard 2.0.1 and as of today, the latest code from https://bitbucket.org/ccaughie/hgreviewboard . I did forget to add "hg add file2.txt" to the list of steps, but I ran it during testing.   Should the code figure out which revision to use for the parent diff base? It works if I specify "--master qparent".

--
Bruce

Colin Caughie

unread,
Jun 4, 2014, 9:14:06 PM6/4/14
to revie...@googlegroups.com
Ah - yes, you have to use the -o option to tell ReviewBoard to figure out the parent diff base by doing the equivalent of "hg outgoing". For this to work you need to make sure that your default push repository is the same as the one that ReviewBoard sees; if it isn't you can use -O instead. ("hg help postreview" has all of this information.)

--master also works but means you have to figure it out yourself.

Apologies for not thinking of that earlier. I have it configured in my default args for the postreview command so I never actually have to type it.

Colin
--

Jeremie Jost

unread,
Jun 17, 2014, 11:15:20 AM6/17/14
to revie...@googlegroups.com
Hi,

We're using the postreview extension and have been hitting that issue pretty regularly. It's particularly annoying because I think that reviewboard caches the diff so if you messed up, even if you push afterwards and run hg postreview again it will still fail. I've finally stumbled on the -o option which seems to solve the issue, so that's pretty awesome. But that left me wondering, is there any reason why this isn't the default behaviour? From what I understand, it looks like rbt now does this by default.

Or otherwise, at least have postreview abort if it cannot find the parent in the remote repository rather than create a corrupted review request?

(Sure, I could use defaults, but the Mercurial guys told me defaults are bad and I should feel bad even thinking about it.)

Cheers
Jeremie
Reply all
Reply to author
Forward
0 new messages