DJ Delorie - Re: svn url shortcuts (original) (raw)
This is the mail archive of the gcc@gcc.gnu.orgmailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] |
- From: DJ Delorie
- To: gcc at gcc dot gnu dot org
- Date: Thu, 3 Nov 2005 18:43:56 -0500
- Subject: Re: svn url shortcuts
This is crude, but it lets you use "tag:foo/bar/grill" as a repository, and it replaces the "tag:foo" with a matching entry in ~/.svnrc like this:
tag foo svn://gcc.gnu.org/svn/gcc/trunk/whatever
So, with a .svnrc like this:
tag trunk svn://gcc.gnu.org/svn/gcc/trunk tag 4.0 svn://gcc.gnu.org/svn/gcc/branches/gcc-4_0-branch
You could just "svn co tag:4.0/gcc/config/i386"
It probably screams for lots more prettying up, but at least I did something about it ;-)
If you want it shorter, I could rewrite this so that the tag name goes before the colon, like "4.0:gcc/config/i386"
DJ
Index: subversion/libsvn_subr/path.c
--- subversion/libsvn_subr/path.c (revision 17180) +++ subversion/libsvn_subr/path.c (working copy) @@ -1103,6 +1103,50 @@ }
+ +static const char * +replace_tag (const char *path, apr_pool_t *pool) +{
FILE *svnrc;
char *svnrc_name;
const char *home;
const char *tb, *te;
char *newpath;
char line[1000];
tb = path + 4;
te = strchr (tb, '/');
if (!te)
te = tb + strlen(tb);
home = getenv("HOME");
if (!home)
return path;
svnrc_name = apr_pcalloc (pool, strlen(home) + 8);
strcpy (svnrc_name, home);
strcat(svnrc_name, "/.svnrc");
svnrc = fopen(svnrc_name, "r");
if (!svnrc)
return path;
while (fgets(line, 1000, svnrc))
{
if (memcmp (line, "tag ", 4))continue;
if (strncmp (line+4, tb, te-tb))continue;
if (line[4+te-tb] != ' ')continue;
newpath = apr_pcalloc (pool, strlen(line+4+(te-tb)+1) + strlen(te) + 1);strcpy (newpath, line+4+(te-tb)+1);while (newpath[strlen(newpath)-1] == '\n')newpath[strlen(newpath)-1] = 0;
strcat (newpath, te);fclose(svnrc);return newpath;}
fclose(svnrc);
return path; +}
const char * svn_path_canonicalize (const char *path, apr_pool_t *pool) { @@ -1112,6 +1156,9 @@ apr_size_t canon_segments = 0; svn_boolean_t uri;
if (strncmp (path, "tag:", 4) == 0)
path = replace_tag (path, pool);
dst = canon = apr_pcalloc (pool, strlen (path) + 1);
/* Copy over the URI scheme if present. */
- Follow-Ups:
- Re: svn url shortcuts
* From: Vincent Lefevre
- Re: svn url shortcuts
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |