Comment #6 on issue 2341 by [email protected]: post-review doesn't handle
multiple repositories based on the same vob (clearcase)
http://code.google.com/p/reviewboard/issues/detail?id=2341
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 ?
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/reviewboard-issues.
For more options, visit https://groups.google.com/groups/opt_out.