changeset 21272:4aeb7a6029ba

merge: prevent simplemerge from mutating label list simplemerge was using list.pop() to remove items from the labels list. This mutated the list and made it unusable by other calls (for instance, it might be used in both the premerge and actual merge stages).
author Durham Goode <durham@fb.com>
date Thu, 08 May 2014 16:33:06 -0700
parents 4adc090fa2fb
children 20b8090d8125
files mercurial/simplemerge.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/simplemerge.py	Fri May 09 08:44:53 2014 +0900
+++ b/mercurial/simplemerge.py	Thu May 08 16:33:06 2014 -0700
@@ -416,11 +416,11 @@
     name_a = local
     name_b = other
     labels = opts.get('label', [])
-    if labels:
-        name_a = labels.pop(0)
-    if labels:
-        name_b = labels.pop(0)
-    if labels:
+    if len(labels) > 0:
+        name_a = labels[0]
+    if len(labels) > 1:
+        name_b = labels[1]
+    if len(labels) > 2:
         raise util.Abort(_("can only specify two labels."))
 
     try: