Re: Where do CVS "descriptions" get stored?

Tim Landscheidt <[email protected]>
Newsgroups gmane.comp.version-control.subversion.cvs2svn.user
Organization <URI:http://www.tim-landscheidt.de/>
Message-ID <[email protected]>
Michael Haggerty <[email protected]> wrote some time ago:

> [...]
> If you submit a clean patch I would be happy to include it in the
> cvs2svn source tree.

I finally got around to take a look at it (despite your in-
structions for dummies :-)); it works for me. Things to con-
sider:

1. I have absolutely no experience in Python.
2. "make check" passes (minus one "SKIP" and three
   "XFAIL"s), so it does not seem to break anything.
3. I have not added test cases though I tried whether a de-
   scription "0" would get lost in the if clause (it does
   not).
4. There seems to have been some discussion in the past if
   Subversion should standardize a "description" property.
   It is my reading that the "svn:" namespace is improper
   for such use; I dislike polluting the main namespace and
   therefore followed a pointer to Dublin Core and settled
   on "dc:description" (cf.
   <URI:http://dcmi.kc.tsukuba.ac.jp/dcregistry/detailServlet?reqType=detail&item=http://purl.org/dc/elements/1.1/description>).
   YMMV. Ideally, this would be configurable, but cf. 1.

Thanks again,
Tim

------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1670&dsMessageId=2415333

To unsubscribe from this discussion, e-mail: [[email protected]].
cvs2svn-description.patch (text/x-patch, 4.8 KB)
Index: cvs2svn-example.options
===================================================================
--- cvs2svn-example.options	(Revision 4950)
+++ cvs2svn-example.options	(Arbeitskopie)
@@ -99,6 +99,7 @@
 from cvs2svn_lib.property_setters import DefaultEOLStyleSetter
 from cvs2svn_lib.property_setters import EOLStyleFromMimeTypeSetter
 from cvs2svn_lib.property_setters import ExecutablePropertySetter
+from cvs2svn_lib.property_setters import DescriptionPropertySetter
 from cvs2svn_lib.property_setters import KeywordsPropertySetter
 from cvs2svn_lib.property_setters import MimeMapper
 from cvs2svn_lib.property_setters import SVNBinaryFileKeywordsPropertySetter
@@ -483,6 +484,10 @@
     # being executable:
     ExecutablePropertySetter(),
 
+    # Set the svn:description property on any files that have a CVS
+    # description:
+    DescriptionPropertySetter(),
+
     # Uncomment the following line to include the original CVS revision
     # numbers as file properties in the SVN archive:
     #CVSRevisionNumberSetter(),
Index: cvs2svn_lib/cvs_file.py
===================================================================
--- cvs2svn_lib/cvs_file.py	(Revision 4950)
+++ cvs2svn_lib/cvs_file.py	(Arbeitskopie)
@@ -233,11 +233,12 @@
       'executable',
       'file_size',
       'mode',
+      'description'
       ]
 
   def __init__(
         self, id, project, parent_directory, basename, in_attic,
-        executable, file_size, mode
+        executable, file_size, mode, description
         ):
     """Initialize a new CVSFile object."""
 
@@ -246,6 +247,7 @@
     self.executable = executable
     self.file_size = file_size
     self.mode = mode
+    self.description = description
 
     assert self.parent_directory is not None
 
@@ -266,13 +268,13 @@
   def __getstate__(self):
     return (
         CVSPath.__getstate__(self),
-        self._in_attic, self.executable, self.file_size, self.mode,
+        self._in_attic, self.executable, self.file_size, self.mode, self.description
         )
 
   def __setstate__(self, state):
     (
         cvs_path_state,
-        self._in_attic, self.executable, self.file_size, self.mode,
+        self._in_attic, self.executable, self.file_size, self.mode, self.description
         ) = state
     CVSPath.__setstate__(self, cvs_path_state)
 
Index: cvs2svn_lib/property_setters.py
===================================================================
--- cvs2svn_lib/property_setters.py	(Revision 4950)
+++ cvs2svn_lib/property_setters.py	(Arbeitskopie)
@@ -65,6 +65,19 @@
       s_item.svn_props[self.propname] = '*'
 
 
+class DescriptionPropertySetter(SVNPropertySetter):
+  """Set the svn:description property based on cvs_rev.cvs_file.description."""
+
+  propname = 'dc:description'
+
+  def set_properties(self, s_item):
+    if self.propname in s_item.svn_props:
+      return
+
+    if s_item.cvs_rev.cvs_file.description:
+      s_item.svn_props[self.propname] = s_item.cvs_rev.cvs_file.description
+
+
 class CVSBinaryFileEOLStyleSetter(SVNPropertySetter):
   """Set the eol-style to None for files with CVS mode '-kb'."""
 
Index: cvs2svn_lib/run_options.py
===================================================================
--- cvs2svn_lib/run_options.py	(Revision 4950)
+++ cvs2svn_lib/run_options.py	(Arbeitskopie)
@@ -63,6 +63,7 @@
 from cvs2svn_lib.property_setters import DefaultEOLStyleSetter
 from cvs2svn_lib.property_setters import EOLStyleFromMimeTypeSetter
 from cvs2svn_lib.property_setters import ExecutablePropertySetter
+from cvs2svn_lib.property_setters import DescriptionPropertySetter
 from cvs2svn_lib.property_setters import KeywordsPropertySetter
 from cvs2svn_lib.property_setters import MimeMapper
 from cvs2svn_lib.property_setters import SVNBinaryFileKeywordsPropertySetter
@@ -1059,6 +1060,8 @@
 
     ctx.svn_property_setters.append(ExecutablePropertySetter())
 
+    ctx.svn_property_setters.append(DescriptionPropertySetter())
+
   def process_options(self):
     """Do the main configuration based on command-line options.
 
Index: cvs2svn_lib/collect_data.py
===================================================================
--- cvs2svn_lib/collect_data.py	(Revision 4950)
+++ cvs2svn_lib/collect_data.py	(Arbeitskopie)
@@ -609,6 +609,11 @@
 
     self.cvs_file.mode = mode
 
+  def set_description(self, description):
+    """This is a callback method declared in Sink."""
+
+    self.cvs_file.description = description
+
   def define_tag(self, name, revision):
     """Remember the symbol name and revision, but don't process them yet.
 
@@ -1220,7 +1225,7 @@
     return CVSFile(
         self.file_key_generator.gen_id(),
         parent_directory.project, logical_parent_directory, basename[:-2],
-        in_attic, file_executable, file_size, None
+        in_attic, file_executable, file_size, None, None
         )
 
   def _get_attic_file(self, parent_directory, basename):
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.