[PATCH] convert: Separate trunk detection from branch layout detection
Edouard Gomez
ed.gomez at free.fr
Tue Jan 1 12:58:02 CST 2008
# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1199210123 -3600
# Node ID 96a2c66f4bb1a68d85715fd331ec5d53feed4b51
# Parent 51776e50bc8c05de42a04208ccd91e7326ede6c8
convert: Separate trunk detection from branch layout detection
In some subversion repositories, trunk is present but no branches
are used. The current code is assuming that both trunk and branches
must exist before adding trunk's head to the heads list.
It's just better to separate the branch layout stuff from the trunk one.
diff -r 51776e50bc8c -r 96a2c66f4bb1 hgext/convert/subversion.py
--- a/hgext/convert/subversion.py Mon Dec 31 18:20:34 2007 -0600
+++ b/hgext/convert/subversion.py Tue Jan 01 18:55:23 2008 +0100
@@ -187,14 +187,19 @@ class svn_source(converter_source):
trunk = (cfgtrunk or 'trunk').strip('/')
branches = (cfgbranches or 'branches').strip('/')
tags = (cfgtags or 'tags').strip('/')
- if self.exists(trunk, rev) and self.exists(branches, rev) and self.exists(tags, rev):
- self.ui.note('found trunk at %r, branches at %r and tags at %r\n' %
- (trunk, branches, tags))
+ oldmodule = None
+ if self.exists(trunk, rev):
+ self.ui.note('found trunk at %r\n' % trunk)
oldmodule = self.module
self.module += '/' + trunk
lt = self.latest(self.module, self.last_changed)
self.head = self.revid(lt)
self.heads = [self.head]
+ elif cfgtrunk:
+ raise util.Abort('expected trunk to be at %r, but not found' % trunk)
+
+ if self.exists(branches, rev):
+ self.ui.note('found branches at %r\n' % branches)
branchnames = svn.client.ls(rpath + '/' + branches, rev, False,
self.ctx)
for branch in branchnames.keys():
@@ -206,15 +211,19 @@ class svn_source(converter_source):
brev = self.revid(brevnum, module)
self.ui.note('found branch %s at %d\n' % (branch, brevnum))
self.heads.append(brev)
+ elif cfgbranches:
+ raise util.Abort('expected branches to be at %r, but not found' % branches)
+ if self.exists(tags, rev):
+ self.ui.note('found tags at %r\n' % tags)
if oldmodule:
self.tags = '%s/%s' % (oldmodule, tags)
else:
self.tags = '/%s' % tags
+ elif cfgtags:
+ raise util.Abort('expected tags to be at %r, but not found' % tags)
- elif cfgtrunk or cfgbranches or cfgtags:
- raise util.Abort('trunk/branch/tags layout expected, but not found')
- else:
+ if not self.heads:
self.ui.note('working with one branch\n')
self.heads = [self.head]
self.tags = tags
More information about the Mercurial
mailing list