Folks,

Talking to Lele about a source CVS repository which was reporting an
error

  "Something went wrong: unable to determine the exact upstream revision
  of the checked out tree in '%s'" % self.repository.basedir),

it became obvious that tailor did not support CVS source repositories
that used "modules" on the server side.

Modules have a side-effect that 'rlog' lines in the changelog start
referring to the physical module paths on the server instead to the
relative locations that are valid in a checked-out tree.

We've come up with two solutions:

  1) Parse CVS/Entries files which could be used to provide translation
     from module paths on the server to relative paths in the repository

  2) Alternatively, at least in the repository I had problems with,
     the relative paths could be determined simply by stripping a certain
     number of elements from module paths. Something like:

        pkg/project/build/      <- module_path
         1     2    build/      <- relative_path = module_path - 2


Attached is an experimental patch that implements solution (2). It works
here and I am successfuly importing the repository as we speak.

    Note: the patch has a hardcoded value of "2" for the number of path
    elements to strip. As an ad-hoc python programmer, I did not bother
    with reading the [suggested] strip-module-paths option from the config.

    Lele, please provide me with an updated version of the patch that
    honors the config file option instead of value "2", and feel free to
    commit the patch.

Regards,
-docelic
--- /mnt/tailor/vcpx/repository/cvs.py	2007-07-09 15:58:39.000000000 +0200
+++ vcpx/repository/cvs.py	2007-07-09 21:54:33.000000000 +0200
@@ -240,9 +240,26 @@
                 l = self.cvslog.readline()
         while l.startswith('cvs rlog: Logging '):
             currentdir = l[18:-1]
+            # If the source repository uses modules, 'rlog' lines contain
+            # paths as seen physically on the server, not the way you see
+            # them relative-to-root in the repository, so tailor can't work
+            # with that. Fortunately, most of the time we just need to strip
+            # some number of path components from the beginning, and then
+            # the rest of the path matches the relative location.
+            if 2:
+                strip_slashes = 2
+                while strip_slashes:
+                    slash = currentdir.find('/')
+                    if slash >= 0:
+                        currentdir = currentdir[slash+1:]
+                        strip_slashes = strip_slashes - 1
+                    else:
+                        currentdir = ''
+                        break
+                self.__currentdir = currentdir
             # If the directory starts with the module name, keep
             # just the remaining part
-            if currentdir.startswith(self.module):
+            elif currentdir.startswith(self.module):
                 self.__currentdir = currentdir[len(self.module)+1:]
             else:
                 # strip away first component, the name of the product
_______________________________________________
Tailor mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/tailor

Reply via email to