changeset 5093:88803a69b24a

fancyopts: Copy list arguments in command table before modifying. Before this, executing commands.dispatch(['log', '-r', '0']) commands.dispatch(['log', '-r', 'tip']) would look like: hg log -r 0 hg log -r 0 -r tip Reported by TK Soh, patch by Alexis S. L. Carvalho
author Thomas Arendsen Hein <thomas@intevation.de>
date Sat, 11 Aug 2007 13:07:47 +0200
parents 6e040f6c2c9c
children ce21f76751f4
files mercurial/fancyopts.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/fancyopts.py	Sat Aug 11 12:47:58 2007 +0200
+++ b/mercurial/fancyopts.py	Sat Aug 11 13:07:47 2007 +0200
@@ -9,7 +9,10 @@
     for s, l, d, c in options:
         pl = l.replace('-', '_')
         map['-'+s] = map['--'+l] = pl
-        state[pl] = d
+        if isinstance(d, list):
+            state[pl] = d[:]
+        else:
+            state[pl] = d
         dt[pl] = type(d)
         if (d is not None and d is not True and d is not False and
             not callable(d)):