Edited the MercurialBackend to support the repo defined in .hg/hgrc

Review Request #255 — Created Feb. 15, 2008 and submitted


Review Board SVN (deprecated)


Edited the MercurialBackend to support the repo defined in .hg/hgrc

  1. Oh, I can see the usefulness of the patch for your use case, but it, as is, would make post-review useless for my use case. Where:
    your use case = "The registered mercurial repository on ReviewBoard is the default 'remote' path" 
    my use case = "The registered mercurial repository on ReviewBoard is the *local* path of the repository where post-review is being running (as a commit hook)"
    I would say that both use cases are valid. A solution that comes to my mind would be to change the line commented below to fall-back to the previous behaviour. So it would return the local path when no default path is found on hgrc. Another solution would be selecting the desired behaviour using a command line argument. I would prefer the later, as it would respect the principle of least surprise.
    [An extra feature would be to validate the repository path, using /api/json/repositories/ to retrieve the paths registered on ReviewBoard]
    1. By the way, I am not a core developer of review board, so don't take my words as an authoritative source. Just my opinion and ideas.
    2. You are right, and I am not a core developer either, so I am waiting for some offical words (Only for the implementation, I understand what you mean and agree with you that both use cases are perfectly valid).
  2. Why return None, when data.strip() [or a local variable holding its value] already has a perfectly valid Mercurial repository path?
    1. Should be fixed now
  1. [I do not know if it is OK for third-party people (that is, those who are not core developers) to do reviews here. If it is considered impolite or impractical, please say so and forgive me.]
    There are small problems on the updated patch, as commented below. But I would like to insist that a command line switch to let the user specify if he wants to use the path of the local or remote depository would be better, because random changes on hgrc would not change the behaviour of post-review. And people using a default "remote" repository could still use the local path (that is not my use case, but it seems possible).
    1. We're thrilled that third parties are doing reviews here. Thanks!
      We'll of course give these a look as well but we welcome anybody to contribute in the review process. It helps the people you're reviewing and it helps yourself to learn the codebase better.
    2. The issues below should be fixed now (hopefully).
      I think a switch like repo-path should be fine, and would override the default detection mechanism. I'll look into it tomorrow, maybe a core dev could tell us, what they would like to see...
  2. This should be data.strip().
    I would also name the variable 'local_repository' or something similar and use it on the line 800 instead of calling data.strip() again.
  3. I think this comment should be keep just after the end of the previous if.
  4. The second parameter of os.path.join should be split in two: '.hg' and 'hgrc'.
  5. I missed this return on the previous review. If the selected strategy is to fall-back to the previous behaviour, this should not be a 'return None'.
  1. Looks good.  Committed to SVN.  Thanks!