Package: svn-load
Version: 0.6-1
Severity: normal
Tags: patch

When including several lines in a move-map file which use the
convenience feature of specifying a string instead of a lambda,
that string is not stored properly for each line.  Instead, the
last string in the file will be used with each regexp.  For example,
if the move-map file contains

^foo$ "hello"
^bar$ "world"

this will in fact be interpreted as

^foo$ "world"
^bar$ "world"

The reason for this is that the variable "value" used in the lambda
is shared between all the lambdas.  In lieu of proper lexical scoping,
there is a trick to get around this:  Add a second parameter with a
default value.  Since default values are stored in the lambda, this
will allow the lambdas to keep different values.

Patch:

--- svn-load.orig       2007-08-02 17:32:16.000000000 +0200
+++ svn-load    2007-08-02 17:19:13.000000000 +0200
@@ -504,7 +504,7 @@ def parse_move_map(filename):
         
         # If it's actually a string, let's turn it into a trivial lambda
         if type(value) == types.StringType:
-            func = lambda m: value
+            func = lambda m,v=value: v
         elif type(value) != types.FunctionType:
             sys.stderr.write("Error: right field in map must be a lambda or "
                              "a string\n")


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.21-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=sv_SE.ISO-8859-1 (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages svn-load depends on:
ii  python                        2.4.4-6    An interactive high-level object-o
ii  python-svn                    1.5.1-2    A(nother) Python interface to Subv

svn-load recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to