Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#6784 closed defect (fixed)

Multiple svn:externals not recognized when same host?

Reported by: jeanluc@… Owned by: Christian Boos
Priority: normal Milestone: 0.11
Component: version control Version: 0.11b1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When I use multiple svn:externals conversions from the same host:

  [svn:externals]
  svn://myhost.net/proj1  http://myhost.net:8080/proj1/browser/$path?rev=$rev
  svn://myhost.net/proj2  http://myhost.net:8080/proj2/browser/$path?rev=$rev

only the last one is recognized by Trac. In the browser, I see:

  Property svn:externals set to

      * proj1
      * proj2 at revision 21 in svn://myhost.net/proj2

where proj1 is not a link, but proj2 is.

Attachments (1)

svn_externals_use_dummy_keys-r6505.diff (1.1 KB ) - added by Christian Boos 16 years ago.
Rework the [svn:externals] syntax to avoid the key/value separator issue

Download all attachments as: .zip

Change History (14)

comment:1 by Christian Boos, 16 years ago

Irk. That must be the ConfigParser overwritting the first entry by the second (':' is an alternative key/value pair delimiter).

So the syntax for that section needs to be fixed, ideas welcomed (preferably something backward compatible).

in reply to:  1 comment:2 by Emmanuel Blot, 16 years ago

Replying to cboos:

So the syntax for that section needs to be fixed, ideas welcomed (preferably something backward compatible).

If we want to have URL as keys, maybe the easier path is to fix the RE, such as in

  • trac/trunk/trac/config.py

     
    1414
    1515from ConfigParser import ConfigParser
    1616import os
     17import re
    1718
    1819from trac.core import ExtensionPoint, TracError
    1920from trac.util.compat import set, sorted
     
    3738    the last modification time of the configuration file, and reparses it
    3839    when the file has changed.
    3940    """
     41   
     42    OPTRE = r'(?P<option>[^=\s][^=]*)\s*(?P<vi>[=])\s*(?P<value>.*)$'
     43   
    4044    def __init__(self, filename):
    4145        self.filename = filename
    4246        self.parser = ConfigParser()
     47        self.parser.OPTCRE = re.compile(self.OPTRE)
    4348        self.parent = None
    4449        self._lastmtime = 0
    4550        self._sections = {}

although this is more a hack than a robust solution ;-(

I keep wondering why the syntax of [svn:externals] does not follow the usual key = value notation ?

comment:3 by Christian Boos, 16 years ago

Well, I started with key = value:

[svn:externals]
svn://myhost.net/proj2 = http://myhost.net:8080/proj2/browser/$path?rev=$rev

then I wondered why I had svn as the key and //myhost.net/proj2 = http://myhost.net:8080/proj2/browser/$path?rev=$rev as the value, and only then found out about this alternative ":" key/value separator.

So if we can get rid of that separator ":" and force "=" to be the only one, as your patch suggests we can, then I'm all for it.

in reply to:  3 comment:4 by anonymous, 16 years ago

Replying to cboos:

So if we can get rid of that separator ":" and force "=" to be the only one, as your patch suggests we can, then I'm all for it.

Ok, but is it a problem that "=" is a valid URL character?

comment:5 by Christian Boos, 16 years ago

Ah, yes of course :-(

What about:

[svn:externals]
proj1 = svn://myhost.net/proj1  http://myhost.net:8080/proj1/browser/$path?rev=$rev
proj2 = svn://myhost.net/proj2  http://myhost.net:8080/proj2/browser/$path?rev=$rev

The keys proj1 and proj2 could eventually be used as informative label somewhere.

comment:6 by jeanluc@…, 16 years ago

Yes, true. In fact at first I tried to hack the code to get this to work:

[svn:externals]
svn://myhost.net     http://myhost.net:8080/$proj/browser/$path?rev=$rev

where $proj would get substituted for whatever project this is. But of course since I know no python I failed. One problem with the above is that then we need to strip $proj from the beginning of the path, I think. Also, this is only a solution to my particular problem, not the general problem.

Jean-Luc

comment:7 by jeanluc@…, 16 years ago

Another idea is to enforce the space between = and keys, as in " = "? But maybe this is too prone to break.

in reply to:  7 comment:8 by jeanluc@…, 16 years ago

Replying to jeanluc@mailaps.org:

Another idea is to enforce the space between = and keys, as in " = "? But maybe this is too prone to break.

…or just enclose in double-quotes URL's that contain = signs?

in reply to:  5 comment:9 by Emmanuel Blot, 16 years ago

Replying to cboos:

What about:

[svn:externals]
proj1 = svn://myhost.net/proj1  http://myhost.net:8080/proj1/browser/$path?rev=$rev
proj2 = svn://myhost.net/proj2  http://myhost.net:8080/proj2/browser/$path?rev=$rev

The keys proj1 and proj2 could eventually be used as informative label somewhere.

I thought about this solution as well, but it looked like a bit artifical. However it avoid patching the ConfigParser instance, so that may be a better approach.

by Christian Boos, 16 years ago

Rework the [svn:externals] syntax to avoid the key/value separator issue

comment:10 by Christian Boos, 16 years ago

Status: newassigned

in reply to:  10 comment:11 by jeanluc@…, 16 years ago

Replying to cboos:

attachment:svn_externals_use_dummy_keys-r6505.diff implements the proposal from comment:5.

Works great for me! Thanks!

Jean-Luc

comment:12 by Christian Boos, 16 years ago

Resolution: fixed
Status: assignedclosed

Applied in r6579.

Thanks for having tested it!

comment:13 by Christian Boos, 16 years ago

Doc updated in TracIni@128

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.