[PATCH] Default-exclude symbol strategy
Jon Foster <[email protected]> Thu, 4 Mar 2010 19:12:31 -0000
| Newsgroups | gmane.comp.version-control.subversion.cvs2svn.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
When migrating a large CVS repository, there are many branches to
consider migrating. One option is to say "we'll migrate everything
except [some list of branches]". Cvs2svn has good support for that,
with "--exclude" and it's options-file equivalents. But I want to do
something a bit different - by default I want to exclude everything,
and only include what's specifically asked for.
So, in our options.py file, I will be specifying a ManualSymbolRule
for every branch I want to keep. (Equivalently I could use a
SymbolHintsFileRule, but as a matter of personal preference I'd
rather have all the cvs2svn configuration in a single file).
This patch adds an ExcludeRemainingStrategyRule that can be used as
the last entry in symbol_strategy_rules[], and will exclude every
branch or tag that hasn't been explicitly kept.
E.g.:
run_options.add_project(
...
symbol_strategy_rules=[
ManualSymbolRule(None, 'release-82-branch',
convert_as_branch, None, '.trunk.'),
ManualSymbolRule(None, 'release-82',
convert_as_tag, None, 'release-82-branch'),
ManualSymbolRule(None, 'release-83-branch',
convert_as_branch, None, '.trunk.'),
ManualSymbolRule(None, 'release-83',
convert_as_tag, None, 'release-83-branch'),
ExcludeRemainingStrategyRule(),
],
...
I'd welcome any feedback or review of this patch.
Kind regards,
Jon
**********************************************************************
This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Cabot Communications Ltd.
If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone.
Cabot Communications Limited
Verona House, Filwood Road, Bristol BS16 3RY, UK
+44 (0) 1179584232
Co. Registered in England number 02817269
Please contact the sender if you believe you have received this email in error.
**********************************************************************
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1667&dsMessageId=2455113
To unsubscribe from this discussion, e-mail: [[email protected]].
cvs2svn_symbol_strategy_exclude_patch.txt
(text/plain, 774 B)
Index: cvs2svn_lib/symbol_strategy.py
===================================================================
--- cvs2svn_lib/symbol_strategy.py (revision 5065)
+++ cvs2svn_lib/symbol_strategy.py (working copy)
@@ -682,4 +682,18 @@
del self._rules
+class ExcludeRemainingStrategyRule(StrategyRule):
+ """A Strategy rule that excludes all remaining branches/tags.
+ Useful if you have used a SymbolHintsFileRule or several ManualSymbolRules
+ to define all the branches/tags to keep, and you want to exclude the rest.
+ """
+
+ def get_symbol(self, symbol, stats):
+ if isinstance(symbol, (Trunk, TypedSymbol)):
+ return symbol
+ else:
+ Log().verbose('Excluding symbol %s by catch-all rule.' % (symbol,))
+ return ExcludedSymbol(symbol)
+
+