Re: [viewvc-dev] viewvc.branches, viewvc.tags

"Philip M. Gollucci" <[email protected]>
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Organization P6M7G8 Consulting
Message-ID <48458D8B.9040107__32437.4431781054$1212517841$gmane$org@p6m7g8.com>
C. Michael Pilato wrote:
> Philip M. Gollucci wrote:
>> Since I'm looking at it again for $work,

> There are three related topics here (2 required, 1 optional):
> 
>    1. the behavior of the svndbadmin script [required]
>    2. the behavior of the ViewVC query interface [required]
>    3. the behavior of other aspects of ViewVC [optional]
> 
> I think in any case, you first need a flexible way of describing the 
> directory topology for a given root.  Already we run into the first 
> annoyance:  svndbadmin doesn't consult ViewVC's configury for much of 
> anything.  That's probably easy to fix, though.  And I've been toying 
> with the idea of making ViewVC support per-root and 
> per-version-control-system options anyway, so maybe this is yet another 
> motivator for that change.
Maybe.... can't we start out less grandios?  We could just do
with re.compile ---

branch=$1  if   path =~ /branches/([^/])+/
tag=$1     if   path =~ /tags/([^/])+/
trunk=true if   path =~ /trunk/
else
commit.SetBranch(None)

That should work regardless of the layout chosen...


> So, assuming we have a nice configury way to describe the layout, let's 
> talk behaviors.  What does svndbadmin do with this information?  Does it 
> merely populate the branches/tags tables?
At a minimum yes, b/c thats all I really need at the moment I think.... :)

>  Does it also munge all the commit paths so they they appear to be absolute but are actually 
> relative to the /trunk/branch/tag?  
What does this get you ? Why ?

If so, what does it do with files that don't live inside one of those branch
streams?
branches.id = -1 (its a signed medium int so that works db wise)
We can even insert a row here so joins don't break.

For example (untested or tried):

--- svndbadmin.orig 2008-06-03 18:07:17.000000000 +0000
+++ svndbadmin  2008-06-03 18:11:30.000000000 +0000
@@ -87,6 +87,7 @@
          return rev

  _re_diff_change_command = re.compile('(\d+)(?:,(\d+))?([acd])(\d+)(?:,(\d+))?')
+_re_branch = re.compile('branches/([^/]+)/')

  def _get_diff_counts(diff_fp):
      """Calculate the plus/minus counts by parsing the output of a
@@ -210,6 +211,12 @@

      for (path, action, plus, minus) in revision.changes:
          directory, file = os.path.split(path)
+        match = re.match(_re_branch, path)
+        if match:
+            branch = match.group(1)
+        else:
+            branch = None
+
          commit = cvsdb.CreateCommit()
          commit.SetRepository(repo.path)
          commit.SetDirectory(directory)
@@ -220,7 +227,7 @@
          commit.SetTime(revision.date)
          commit.SetPlusCount(plus)
          commit.SetMinusCount(minus)
-        commit.SetBranch(None)
+        commit.SetBranch(branch)

          if action == 'add':
              commit.SetTypeAdd()


I don't think this breaks down unless you try to put mutile repositories in
the same viewvc db that have conflict branch/tag names or both have trunk.
Easily solved by just using multiple dbs -- viewvc_work, viewvc_home,
viewvc_asf .....


-- 
------------------------------------------------------------------------
Philip M. Gollucci ([email protected])
o:703.549.2050x206
Senior System Admin - Riderway, Inc.
http://riderway.com / http://ridecharge.com
1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70  3F8C 75B8 8FFB DB9B 8C1C

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
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.