You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by anatoly techtonik <te...@gmail.com> on 2011/06/02 18:06:05 UTC
[PATCH] svnmerge-migrate-history-remotely.py: move from getopt to optparse
Attached patch fixes svnmerge history conversion script to use
optparse library instead of getopt. This allows further addition of
new options, such as --username and --password.
Please, CC
--
anatoly t.
Re: Attachments silently dropped Re: [PATCH]
svnmerge-migrate-history-remotely.py: move from getopt to optparse
Posted by Stefan Sperling <st...@elego.de>.
On Wed, Jun 08, 2011 at 11:18:36AM +0300, Daniel Shahaf wrote:
> I've raised this issue on the infra list with a suggestion that would
> hopefully allow us to move to a noisy failure mode rather than silent
> lossage.
>
> (I believe it's an ezmlm configuration issue)
Thanks a lot! This slient dropping of attachments has been a serious
annoyance for quite some time.
Attachments silently dropped Re: [PATCH]
svnmerge-migrate-history-remotely.py: move from getopt to optparse
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Daniel Shahaf wrote on Wed, Jun 08, 2011 at 10:50:55 +0300:
> anatoly techtonik wrote on Wed, Jun 08, 2011 at 10:12:14 +0300:
> > The previous patch had wrong handling of naive parameter. I attach new
> > one
>
> It didn't reach the list.
>
> Please try *.txt extension so it has text/plain MIME type.
I've raised this issue on the infra list with a suggestion that would
hopefully allow us to move to a noisy failure mode rather than silent
lossage.
(I believe it's an ezmlm configuration issue)
Re: [PATCH] svnmerge-migrate-history-remotely.py: move from getopt to optparse
Posted by anatoly techtonik <te...@gmail.com>.
On Wed, Jun 8, 2011 at 10:50 AM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
>> On Wed, Jun 8, 2011 at 9:34 AM, anatoly techtonik <te...@gmail.com> wrote:
>> > On Mon, Jun 6, 2011 at 6:32 PM, Stefan Sperling <st...@elego.de> wrote:
>> >> On Thu, Jun 02, 2011 at 07:06:05PM +0300, anatoly techtonik wrote:
>> >>> Attached patch fixes svnmerge history conversion script to use
>> >>> optparse library instead of getopt. This allows further addition of
>> >>> new options, such as --username and --password.
>> >>
>> >> Hi,
>> >>
>> >> Can you explain why you need to convert this script to optparse
>> >> to add new options? Is this a cosmetic fix or is there a technical
>> >> problem with adding more options via getopt? Thanks!
>> >
>> > 1. It makes code more clear
>> > 2. It saves me time on learning what a getopt is
>>
>> The previous patch had wrong handling of naive parameter. I attach new
>> one
>
> It didn't reach the list.
>
> Please try *.txt extension so it has text/plain MIME type.
Done.
--
anatoly t.
Re: [PATCH] svnmerge-migrate-history-remotely.py: move from getopt
to optparse
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
anatoly techtonik wrote on Wed, Jun 08, 2011 at 10:12:14 +0300:
> --
> anatoly t.
>
>
>
> On Wed, Jun 8, 2011 at 9:34 AM, anatoly techtonik <te...@gmail.com> wrote:
> > On Mon, Jun 6, 2011 at 6:32 PM, Stefan Sperling <st...@elego.de> wrote:
> >> On Thu, Jun 02, 2011 at 07:06:05PM +0300, anatoly techtonik wrote:
> >>> Attached patch fixes svnmerge history conversion script to use
> >>> optparse library instead of getopt. This allows further addition of
> >>> new options, such as --username and --password.
> >>
> >> Hi,
> >>
> >> Can you explain why you need to convert this script to optparse
> >> to add new options? Is this a cosmetic fix or is there a technical
> >> problem with adding more options via getopt? Thanks!
> >
> > 1. It makes code more clear
> > 2. It saves me time on learning what a getopt is
>
> The previous patch had wrong handling of naive parameter. I attach new
> one
It didn't reach the list.
Please try *.txt extension so it has text/plain MIME type.
Re: [PATCH] svnmerge-migrate-history-remotely.py: move from getopt to optparse
Posted by anatoly techtonik <te...@gmail.com>.
--
anatoly t.
On Wed, Jun 8, 2011 at 9:34 AM, anatoly techtonik <te...@gmail.com> wrote:
> On Mon, Jun 6, 2011 at 6:32 PM, Stefan Sperling <st...@elego.de> wrote:
>> On Thu, Jun 02, 2011 at 07:06:05PM +0300, anatoly techtonik wrote:
>>> Attached patch fixes svnmerge history conversion script to use
>>> optparse library instead of getopt. This allows further addition of
>>> new options, such as --username and --password.
>>
>> Hi,
>>
>> Can you explain why you need to convert this script to optparse
>> to add new options? Is this a cosmetic fix or is there a technical
>> problem with adding more options via getopt? Thanks!
>
> 1. It makes code more clear
> 2. It saves me time on learning what a getopt is
The previous patch had wrong handling of naive parameter. I attach new
one that also adds config-dir option handling, which allows to deal
with repository permissions by specifying config that allows to cache
them.
Please, CC.
Re: [PATCH] svnmerge-migrate-history-remotely.py: move from getopt to optparse
Posted by Arfrever Frehtes Taifersar Arahesis <ar...@gmail.com>.
2011-06-09 08:28:10 Hyrum K Wright napisał(a):
> On Wed, Jun 8, 2011 at 5:59 AM, anatoly techtonik <te...@gmail.com> wrote:
> > On Wed, Jun 8, 2011 at 12:57 PM, Stefan Sperling <st...@elego.de> wrote:
> >> On Wed, Jun 08, 2011 at 09:34:05AM +0300, anatoly techtonik wrote:
> >>> On Mon, Jun 6, 2011 at 6:32 PM, Stefan Sperling <st...@elego.de> wrote:
> >>> > On Thu, Jun 02, 2011 at 07:06:05PM +0300, anatoly techtonik wrote:
> >>> >> Attached patch fixes svnmerge history conversion script to use
> >>> >> optparse library instead of getopt. This allows further addition of
> >>> >> new options, such as --username and --password.
> >>> >
> >>> > Hi,
> >>> >
> >>> > Can you explain why you need to convert this script to optparse
> >>> > to add new options? Is this a cosmetic fix or is there a technical
> >>> > problem with adding more options via getopt? Thanks!
> >>>
> >>> 1. It makes code more clear
> >>> 2. It saves me time on learning what a getopt is
> >>
> >> So those who already know getopt should learn about optparse for
> >> your convenience? I don't think that's a good argument.
> >> By the same argument you could send a patch that rewrites the script
> >> in your favourite programming language because you don't like Python.
> >
> > optparse is de-facto standard for option parsing in Python. It makes
> > code more maintainable and clear as you may see from the patch. You
> > should waste 15 minutes to play with it if you program Python for
> > terminal scripts as it will really save you a lot of time in future.
>
> Actually, optparse is deprecated as of Python 2.7 in favor of argparse.
>
> Not that I don't like optparse, mind you, but claiming it as a de
> facto standard when it is deprecated is a bit of hyperbole.
>
> My own personal opinion is that we should standardize our Python
> scripts around a particular argument parsing module. If the majority
> of our stuff is already using optparse, I see no reason not to allow
> an enthusiastic volunteer the ability to convert existing scripts to
> it.
>
> Another option is just following the Python deprecation guidelines,
> and moving to argparse throughout, but that would require bumping
> everything to Python 2.7, and I don't want to have that bikeshed
> today. :)
argparse is also externally provided for older versions of Python:
http://pypi.python.org/pypi/argparse
http://code.google.com/p/argparse/
--
Arfrever Frehtes Taifersar Arahesis
Re: [PATCH] svnmerge-migrate-history-remotely.py: move from getopt to optparse
Posted by anatoly techtonik <te...@gmail.com>.
On Thu, Jun 9, 2011 at 9:28 AM, Hyrum K Wright <hy...@hyrumwright.org> wrote:
> On Wed, Jun 8, 2011 at 5:59 AM, anatoly techtonik <te...@gmail.com> wrote:
>> On Wed, Jun 8, 2011 at 12:57 PM, Stefan Sperling <st...@elego.de> wrote:
>>> On Wed, Jun 08, 2011 at 09:34:05AM +0300, anatoly techtonik wrote:
>>>> On Mon, Jun 6, 2011 at 6:32 PM, Stefan Sperling <st...@elego.de> wrote:
>>>> > On Thu, Jun 02, 2011 at 07:06:05PM +0300, anatoly techtonik wrote:
>>>> >> Attached patch fixes svnmerge history conversion script to use
>>>> >> optparse library instead of getopt. This allows further addition of
>>>> >> new options, such as --username and --password.
>>>> >
>>>> > Hi,
>>>> >
>>>> > Can you explain why you need to convert this script to optparse
>>>> > to add new options? Is this a cosmetic fix or is there a technical
>>>> > problem with adding more options via getopt? Thanks!
>>>>
>>>> 1. It makes code more clear
>>>> 2. It saves me time on learning what a getopt is
>>>
>>> So those who already know getopt should learn about optparse for
>>> your convenience? I don't think that's a good argument.
>>> By the same argument you could send a patch that rewrites the script
>>> in your favourite programming language because you don't like Python.
>>
>> optparse is de-facto standard for option parsing in Python. It makes
>> code more maintainable and clear as you may see from the patch. You
>> should waste 15 minutes to play with it if you program Python for
>> terminal scripts as it will really save you a lot of time in future.
>
> Actually, optparse is deprecated as of Python 2.7 in favor of argparse.
>
> Not that I don't like optparse, mind you, but claiming it as a de
> facto standard when it is deprecated is a bit of hyperbole.
>
> My own personal opinion is that we should standardize our Python
> scripts around a particular argument parsing module. If the majority
> of our stuff is already using optparse, I see no reason not to allow
> an enthusiastic volunteer the ability to convert existing scripts to
> it.
>
> Another option is just following the Python deprecation guidelines,
> and moving to argparse throughout, but that would require bumping
> everything to Python 2.7, and I don't want to have that bikeshed
> today. :)
I thought that argparse is solely Python 3 feature, but it appears it
is not. Anyway, it is a logical continuation of optparse, and uses the
same way of adding arguments. It is just more powerful with
subcommands. http://stackoverflow.com/questions/3217673/why-use-argparse-rather-than-optparse
Some coding standard for Python scripts would be nice, because
svnmerge scripts are difficult to compare because of whitespaces and
different imports from svn.
--
anatoly t.
Re: [PATCH] svnmerge-migrate-history-remotely.py: move from getopt to optparse
Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Wed, Jun 8, 2011 at 5:59 AM, anatoly techtonik <te...@gmail.com> wrote:
> On Wed, Jun 8, 2011 at 12:57 PM, Stefan Sperling <st...@elego.de> wrote:
>> On Wed, Jun 08, 2011 at 09:34:05AM +0300, anatoly techtonik wrote:
>>> On Mon, Jun 6, 2011 at 6:32 PM, Stefan Sperling <st...@elego.de> wrote:
>>> > On Thu, Jun 02, 2011 at 07:06:05PM +0300, anatoly techtonik wrote:
>>> >> Attached patch fixes svnmerge history conversion script to use
>>> >> optparse library instead of getopt. This allows further addition of
>>> >> new options, such as --username and --password.
>>> >
>>> > Hi,
>>> >
>>> > Can you explain why you need to convert this script to optparse
>>> > to add new options? Is this a cosmetic fix or is there a technical
>>> > problem with adding more options via getopt? Thanks!
>>>
>>> 1. It makes code more clear
>>> 2. It saves me time on learning what a getopt is
>>
>> So those who already know getopt should learn about optparse for
>> your convenience? I don't think that's a good argument.
>> By the same argument you could send a patch that rewrites the script
>> in your favourite programming language because you don't like Python.
>
> optparse is de-facto standard for option parsing in Python. It makes
> code more maintainable and clear as you may see from the patch. You
> should waste 15 minutes to play with it if you program Python for
> terminal scripts as it will really save you a lot of time in future.
Actually, optparse is deprecated as of Python 2.7 in favor of argparse.
Not that I don't like optparse, mind you, but claiming it as a de
facto standard when it is deprecated is a bit of hyperbole.
My own personal opinion is that we should standardize our Python
scripts around a particular argument parsing module. If the majority
of our stuff is already using optparse, I see no reason not to allow
an enthusiastic volunteer the ability to convert existing scripts to
it.
Another option is just following the Python deprecation guidelines,
and moving to argparse throughout, but that would require bumping
everything to Python 2.7, and I don't want to have that bikeshed
today. :)
-Hyrum
Re: [PATCH] svnmerge-migrate-history-remotely.py: move from getopt to optparse
Posted by anatoly techtonik <te...@gmail.com>.
On Wed, Jun 8, 2011 at 12:57 PM, Stefan Sperling <st...@elego.de> wrote:
> On Wed, Jun 08, 2011 at 09:34:05AM +0300, anatoly techtonik wrote:
>> On Mon, Jun 6, 2011 at 6:32 PM, Stefan Sperling <st...@elego.de> wrote:
>> > On Thu, Jun 02, 2011 at 07:06:05PM +0300, anatoly techtonik wrote:
>> >> Attached patch fixes svnmerge history conversion script to use
>> >> optparse library instead of getopt. This allows further addition of
>> >> new options, such as --username and --password.
>> >
>> > Hi,
>> >
>> > Can you explain why you need to convert this script to optparse
>> > to add new options? Is this a cosmetic fix or is there a technical
>> > problem with adding more options via getopt? Thanks!
>>
>> 1. It makes code more clear
>> 2. It saves me time on learning what a getopt is
>
> So those who already know getopt should learn about optparse for
> your convenience? I don't think that's a good argument.
> By the same argument you could send a patch that rewrites the script
> in your favourite programming language because you don't like Python.
optparse is de-facto standard for option parsing in Python. It makes
code more maintainable and clear as you may see from the patch. You
should waste 15 minutes to play with it if you program Python for
terminal scripts as it will really save you a lot of time in future.
I actually rewrote old awk and perl scripts in Python for projects
like Far Manager and UFO: AI just to make build toolchain more
maintainable on Windows. These are usually land in contrib/ dirs, but
they enable more people to use them and adapt for their own workflow,
which is a good thing IMO.
> I don't mind the change in principle because I don't really care
> strongly about whether this script should optparse or getopt.
> But it is generally better to send minimal patches because they can
> be more easily digested and applied. So if all you really want is another
> option, I'd be much happier with a patch that just adds this option.
My goal was to make this script understand authentication parameters
for closed repositories. So far I've found a workaround by using
special config that allows to do this with 'password-stores ='. It
would be more convenient to have username and password params that
automatically generate this config in temp dir, but I probably won't
have time for that and it will be a much more complicated patch.
If you ever wondered why Bugzilla doesn't have OpenID support, then it
because it requires people to learn Perl and for some strange reason
people don't do that. I guess that's the same reason I don't want to learn
getopt.
--
anatoly t.
Re: [PATCH] svnmerge-migrate-history-remotely.py: move from getopt
to optparse
Posted by Stefan Sperling <st...@elego.de>.
On Wed, Jun 08, 2011 at 09:34:05AM +0300, anatoly techtonik wrote:
> On Mon, Jun 6, 2011 at 6:32 PM, Stefan Sperling <st...@elego.de> wrote:
> > On Thu, Jun 02, 2011 at 07:06:05PM +0300, anatoly techtonik wrote:
> >> Attached patch fixes svnmerge history conversion script to use
> >> optparse library instead of getopt. This allows further addition of
> >> new options, such as --username and --password.
> >
> > Hi,
> >
> > Can you explain why you need to convert this script to optparse
> > to add new options? Is this a cosmetic fix or is there a technical
> > problem with adding more options via getopt? Thanks!
>
> 1. It makes code more clear
> 2. It saves me time on learning what a getopt is
So those who already know getopt should learn about optparse for
your convenience? I don't think that's a good argument.
By the same argument you could send a patch that rewrites the script
in your favourite programming language because you don't like Python.
I don't mind the change in principle because I don't really care
strongly about whether this script should optparse or getopt.
But it is generally better to send minimal patches because they can
be more easily digested and applied. So if all you really want is another
option, I'd be much happier with a patch that just adds this option.
Re: [PATCH] svnmerge-migrate-history-remotely.py: move from getopt to optparse
Posted by anatoly techtonik <te...@gmail.com>.
On Mon, Jun 6, 2011 at 6:32 PM, Stefan Sperling <st...@elego.de> wrote:
> On Thu, Jun 02, 2011 at 07:06:05PM +0300, anatoly techtonik wrote:
>> Attached patch fixes svnmerge history conversion script to use
>> optparse library instead of getopt. This allows further addition of
>> new options, such as --username and --password.
>
> Hi,
>
> Can you explain why you need to convert this script to optparse
> to add new options? Is this a cosmetic fix or is there a technical
> problem with adding more options via getopt? Thanks!
1. It makes code more clear
2. It saves me time on learning what a getopt is
--
anatoly t.
>>
>> Please, CC
>> --
>> anatoly t.
>
>> [[[
>> Switch svnmerge history conversion script from getopt to optparse library.
>>
>>
>> * contrib/client-side/svnmerge/svnmerge-migrate-history-remotely.py
>> (usage_and_exit): Remove.
>> (main): Use optparse instead of getopt for parameter parsing.
>>
>> ]]]
>>
>> Index: contrib/client-side/svnmerge/svnmerge-migrate-history-remotely.py
>> ===================================================================
>> --- contrib/client-side/svnmerge/svnmerge-migrate-history-remotely.py (revision 1127394)
>> +++ contrib/client-side/svnmerge/svnmerge-migrate-history-remotely.py (working copy)
>> @@ -48,12 +48,8 @@
>> import sys
>> import os
>> import urllib
>> -import getopt
>> +import optparse
>> try:
>> - my_getopt = getopt.gnu_getopt
>> -except AttributeError:
>> - my_getopt = getopt.getopt
>> -try:
>> from svn import client, ra, core
>> svn_version = (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_PATCH)
>> if svn_version < (1, 5, 0):
>> @@ -385,9 +381,7 @@ class SvnmergeHistoryMigrator:
>>
>> ### -------------------------------------------------------------------------
>>
>> -def usage_and_exit(errmsg=None):
>> - stream = errmsg and sys.stderr or sys.stdout
>> - stream.write("""Usage: %s [OPTIONS] BRANCH_PATH
>> +USAGE = """Usage: %s [OPTIONS] BRANCH_PATH
>>
>> Convert svnmerge.py tracking data found on the working copy
>> BRANCH_PATH into Subversion merge tracking data as a set of local
>> @@ -406,46 +400,26 @@ NOTE: This script requires remote read access to t
>> repository whose working copy data you are trying to convert, but
>> currently does not implement prompting authentication providers. You
>> must have valid cached credentials for this script to work.
>> +""" % (os.path.basename(sys.argv[0]))
>>
>> -Options:
>> -
>> - --help (-h, -?) Show this usage message
>> - --verbose (-v) Run in verbose mode
>> - --naive Run a naive conversion (faster, but might generate
>> - non-ideal results)
>> -""" % (os.path.basename(sys.argv[0])))
>> - if errmsg:
>> - stream.write("\nERROR: %s\n" % (errmsg))
>> - sys.exit(errmsg and 1 or 0)
>> -
>> def main():
>> - try:
>> - opts, args = my_getopt(sys.argv[1:], "vh?",
>> - ["verbose", "naive-mode", "help"])
>> - except:
>> - raise
>> - usage_and_exit("Unable to process arguments/options.")
>> + parser = optparse.OptionParser(usage=USAGE)
>> + parser.add_option('-v', '--verbose', action="store_true", default=False,
>> + help="run in verbose mode")
>> + parser.add_option('--naive', action="store_true", default=False,
>> + help="run naive conversion (faster, but might generate "
>> + "non-ideal results)")
>> + (opts, args) = parser.parse_args()
>>
>> # Process arguments.
>> if not args:
>> - usage_and_exit("No working copy path provided.")
>> + parser.print_help()
>> + sys.exit("\nERROR: No working copy path provided.\n")
>> else:
>> branch_path = core.svn_path_canonicalize(args[0])
>>
>> - # Process options.
>> - verbose = naive_mode = False
>> - for opt, value in opts:
>> - if opt == "--help" or opt in ("-h", "-?"):
>> - usage_and_exit()
>> - elif opt == "--verbose" or opt == "-v":
>> - verbose = True
>> - elif opt == "--naive-mode":
>> - naive_mode = True
>> - else:
>> - usage_and_exit("Unknown option '%s'" % (opt))
>> -
>> # Do the work.
>> - shm = SvnmergeHistoryMigrator(SvnClient(), verbose, naive_mode)
>> + shm = SvnmergeHistoryMigrator(SvnClient(), opts.verbose, opts.naive_mode)
>> shm.migrate_path(branch_path)
>>
>> if __name__ == "__main__":
>
>
Re: [PATCH] svnmerge-migrate-history-remotely.py: move from getopt
to optparse
Posted by Stefan Sperling <st...@elego.de>.
On Thu, Jun 02, 2011 at 07:06:05PM +0300, anatoly techtonik wrote:
> Attached patch fixes svnmerge history conversion script to use
> optparse library instead of getopt. This allows further addition of
> new options, such as --username and --password.
Hi,
Can you explain why you need to convert this script to optparse
to add new options? Is this a cosmetic fix or is there a technical
problem with adding more options via getopt? Thanks!
>
> Please, CC
> --
> anatoly t.
> [[[
> Switch svnmerge history conversion script from getopt to optparse library.
>
>
> * contrib/client-side/svnmerge/svnmerge-migrate-history-remotely.py
> (usage_and_exit): Remove.
> (main): Use optparse instead of getopt for parameter parsing.
>
> ]]]
>
> Index: contrib/client-side/svnmerge/svnmerge-migrate-history-remotely.py
> ===================================================================
> --- contrib/client-side/svnmerge/svnmerge-migrate-history-remotely.py (revision 1127394)
> +++ contrib/client-side/svnmerge/svnmerge-migrate-history-remotely.py (working copy)
> @@ -48,12 +48,8 @@
> import sys
> import os
> import urllib
> -import getopt
> +import optparse
> try:
> - my_getopt = getopt.gnu_getopt
> -except AttributeError:
> - my_getopt = getopt.getopt
> -try:
> from svn import client, ra, core
> svn_version = (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_PATCH)
> if svn_version < (1, 5, 0):
> @@ -385,9 +381,7 @@ class SvnmergeHistoryMigrator:
>
> ### -------------------------------------------------------------------------
>
> -def usage_and_exit(errmsg=None):
> - stream = errmsg and sys.stderr or sys.stdout
> - stream.write("""Usage: %s [OPTIONS] BRANCH_PATH
> +USAGE = """Usage: %s [OPTIONS] BRANCH_PATH
>
> Convert svnmerge.py tracking data found on the working copy
> BRANCH_PATH into Subversion merge tracking data as a set of local
> @@ -406,46 +400,26 @@ NOTE: This script requires remote read access to t
> repository whose working copy data you are trying to convert, but
> currently does not implement prompting authentication providers. You
> must have valid cached credentials for this script to work.
> +""" % (os.path.basename(sys.argv[0]))
>
> -Options:
> -
> - --help (-h, -?) Show this usage message
> - --verbose (-v) Run in verbose mode
> - --naive Run a naive conversion (faster, but might generate
> - non-ideal results)
> -""" % (os.path.basename(sys.argv[0])))
> - if errmsg:
> - stream.write("\nERROR: %s\n" % (errmsg))
> - sys.exit(errmsg and 1 or 0)
> -
> def main():
> - try:
> - opts, args = my_getopt(sys.argv[1:], "vh?",
> - ["verbose", "naive-mode", "help"])
> - except:
> - raise
> - usage_and_exit("Unable to process arguments/options.")
> + parser = optparse.OptionParser(usage=USAGE)
> + parser.add_option('-v', '--verbose', action="store_true", default=False,
> + help="run in verbose mode")
> + parser.add_option('--naive', action="store_true", default=False,
> + help="run naive conversion (faster, but might generate "
> + "non-ideal results)")
> + (opts, args) = parser.parse_args()
>
> # Process arguments.
> if not args:
> - usage_and_exit("No working copy path provided.")
> + parser.print_help()
> + sys.exit("\nERROR: No working copy path provided.\n")
> else:
> branch_path = core.svn_path_canonicalize(args[0])
>
> - # Process options.
> - verbose = naive_mode = False
> - for opt, value in opts:
> - if opt == "--help" or opt in ("-h", "-?"):
> - usage_and_exit()
> - elif opt == "--verbose" or opt == "-v":
> - verbose = True
> - elif opt == "--naive-mode":
> - naive_mode = True
> - else:
> - usage_and_exit("Unknown option '%s'" % (opt))
> -
> # Do the work.
> - shm = SvnmergeHistoryMigrator(SvnClient(), verbose, naive_mode)
> + shm = SvnmergeHistoryMigrator(SvnClient(), opts.verbose, opts.naive_mode)
> shm.migrate_path(branch_path)
>
> if __name__ == "__main__":