2341: Add support for multiple repositories based on the same vob (clearcase)
- WontFix
- Review Board
dren*****@gmai***** (Google Code) (Is this you? Claim this profile.) | |
May 2, 2014 |
What version are you running? RBTools 0.3.4 What's the URL of the page containing the problem? n/a What steps will reproduce the problem? 1. Create 2 repositories A and B based on Clearcase (A followed by B). Where A and B are based on the same vob however due to the project configuration (Clearcase UCM) A and B are comprised of different components found in the same vob. 2. Perform a post-review where the code is only accessible via B. post-review --revision-range=..etc.. ----server=..etc.. What is the expected output? What do you see instead? I expected success, however what I got was.. >>> Got API Error 207 (HTTP code 400): The file was not found in the repository >>> Error data: {'stat': 'fail', 'file': '/view/..etc..@@/main/blah/1', 'err': {'msg': 'The file was not found in the repository', 'code': 207}, 'revision': '/main/blah/1' What operating system are you using? What browser? CentOS 5 Please provide any additional information below. What I found is the code is picking the repository based on the vob uuid. So in my case both repositories are a match base on vob uuid, so that's not enough. It picked the first matching repository (A) when in fact B was the one I needed to use. I worked around this by introducing a --repository-name option which takes the repository name as listed in the reviewboard ui. --- a/postreview.py +++ b/postreview.py @@ -296,6 +296,10 @@ class ClearCaseRepositoryInfo(RepositoryInfo): if not info or uuid != info['uuid']: continue + if options.repository_name and \ + options.repository_name != repository['name']: + continue + debug('Matching repository uuid:%s with path:%s' %(uuid, info['repopath'])) return ClearCaseRepositoryInfo(info['repopath'], @@ -3834,6 +3838,9 @@ def parse_options(args): "paths outside the view). For git, this specifies" "the origin url of the current repository, " "overriding the origin url supplied by the git client.") + parser.add_option("--repository-name", + dest="repository_name", default=None, + help="the name for a repository for creating a diff ") parser.add_option("-d", "--debug", action="store_true", dest="debug", default=DEBUG, help="display debug output")
HI , We are having base clearcase having multiple source vobs .if i have chnages from mutiple vobs ,then post-review just upload the diff of the vob change where i ran the post-review not all the vob changes at once . Could you please help me on this i.e how reviewboard post-review will upload the diff of multiple vob changes . Thanks Aks
I am not anything close to an expert on clearcase, but I believe each vob is treated as a repository, yes? post-review can only post to one review request at a time, and a review request is on one repository at a time. So I don't believe you can do what you want to do.
Hi, Right now Review Board does not support multiple source vobs views nor UCM model. I've hard to translate oids outside of vob context so I've implement everything considering you are working inside vob. Becuase in vob oids translation works. This is something we of course want to deliver but right now I'm straggling some technical problems how to implement that. If you can share some input or ideas how this could be implement I'm happy to hear anything which could help.
Well I shared how I'm solving this right now with the diff provided in the bug report. Where I worked we have multiple repositories in the same vob, so the uuids are the same in both cases however the repository name is different. So the code above (to introduce an additional check based on repository name) was sufficient for things to work. I've been using this 'workaround' code for a while now and have had no issues. For e.g. on the reviewboard server I have two repositories configure, A and B. Where the configuration is like so.. repository name: A Path: /view/reviewboard_A/vobs/MAC repository name: B Path: /view/reviewboard_B/vobs/MAC ..The vob uuid for both A and B is identical, but the UCM project and view are different. I'm using the same config right now with reviewboard using the repository-name to match things up. Repository names are unique. You could also check the 'project' associated with the view being used for the repository, but since repository names are unique I think that's sufficient. In my case I made the repository names the same as the project names so it makes sense to developers using it. Hope that helps.
I updated to using reviewboard 1.7.13 and my old patch broke. So I decide to 'fix' this differently. Basically where I work we're using clearcase UCM. In UCM you have projects which can pull in different components in the same vob. So I'm dealing two projects that use the same vob but the components are different. vobs ids match but projects don't. So I did a new set of patches that does the following.. 1) adds a 'ucm_project' property to the repository info (back-end) 2) In post-review check both for matching vob uuid and 'ucm_project' That the client of post-review doesn't need to specify anything further. I prefer this way but it needs a change in both reviewboard server and post-review. Patches below.. ..reviewboard server change... diff --git a/scmtools/clearcase.py b/scmtools/clearcase.py index e953441..562c3ee 100755 --- a/scmtools/clearcase.py +++ b/scmtools/clearcase.py @@ -145,9 +145,29 @@ class ClearCaseTool(SCMTool): vobstag = self._get_vobs_tag(self.repopath) return { 'repopath': self.repopath, - 'uuid': self._get_vobs_uuid(vobstag) + 'uuid': self._get_vobs_uuid(vobstag), + 'ucm_project': self._get_view_project(self.repopath) } + def _get_view_project(self, repopath): + cmdline = ["cleartool", "lsproject", "-cview"] + p = subprocess.Popen( + cmdline, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + cwd=repopath, + shell=_popen_shell) + + (res, error) = p.communicate() + failure = p.poll() + + if failure: + return None + + # output format is.. + # <creation date> <project> <owner> + return res.split()[1] + def _get_view_type(self, repopath): cmdline = ["cleartool", "lsview", "-full", "-properties", "-cview"] p = subprocess.Popen( ..post-review change.. diff --git a/clients/clearcase.py b/clients/clearcase.py index 2ca6feb..c887aa1 100755 --- a/clients/clearcase.py +++ b/clients/clearcase.py @@ -400,6 +400,9 @@ class ClearCaseRepositoryInfo(RepositoryInfo): # Find VOB's family uuid based on VOB's tag uuid = self._get_vobs_uuid(self.vobstag) logging.debug("Repository's %s uuid is %r" % (self.vobstag, uuid)) + ucm_project = self._get_view_project() + if ucm_project: + logging.debug("Repository's %s UCM project is %r" % (self.vobstag, ucm_project)) repositories = server.get_repositories() for repository in repositories: @@ -411,6 +414,13 @@ class ClearCaseRepositoryInfo(RepositoryInfo): if not info or uuid != info['uuid']: continue + # If the repository has a UCM project make sure the local view's + # project matches since comparing vob UUIDs is not enough in a + # multi-project setup + if ucm_project and info.get('ucm_project', None): + if ucm_project != info['ucm_project']: + continue + logging.debug('Matching repository uuid:%s with path:%s' % (uuid, info['repopath'])) return ClearCaseRepositoryInfo( @@ -426,6 +436,15 @@ class ClearCaseRepositoryInfo(RepositoryInfo): # We'll just return self and hope for the best. return self + def _get_view_project(self): + """Return the UCM project for the view.""" + + proj_info = execute(["cleartool", "lsproject", "-cview"]) + + # output format is.. + # <creation date> <project> <owner> + return proj_info.split()[1] + def _get_vobs_uuid(self, vobstag): """Return family uuid of VOB.""" Thoughts ?
-
- Type-Defect + Type-Enhancement + Component-SCMTools -
+ Add support for multiple repositories based on the same vob (clearcase)