##// END OF EJS Templates
histedit: protect against duplicated entries...
Pierre-Yves David -
r19047:81de87f8 default
parent child Browse files
Show More
@@ -717,6 +717,7 b' def verifyrules(rules, repo, ctxs):'
717 """
717 """
718 parsed = []
718 parsed = []
719 expected = set(str(c) for c in ctxs)
719 expected = set(str(c) for c in ctxs)
720 seen = set()
720 if len(rules) != len(expected):
721 if len(rules) != len(expected):
721 raise util.Abort(_('must specify a rule for each changeset once'))
722 raise util.Abort(_('must specify a rule for each changeset once'))
722 for r in rules:
723 for r in rules:
@@ -731,6 +732,9 b' def verifyrules(rules, repo, ctxs):'
731 if ha not in expected:
732 if ha not in expected:
732 raise util.Abort(
733 raise util.Abort(
733 _('may not use changesets other than the ones listed'))
734 _('may not use changesets other than the ones listed'))
735 if ha in seen:
736 raise util.Abort(_('duplicated command for changeset %s') % ha)
737 seen.add(ha)
734 if action not in actiontable:
738 if action not in actiontable:
735 raise util.Abort(_('unknown action "%s"') % action)
739 raise util.Abort(_('unknown action "%s"') % action)
736 parsed.append([action, ha])
740 parsed.append([action, ha])
@@ -124,6 +124,19 b' Test unknown command'
124 abort: unknown action "coin"
124 abort: unknown action "coin"
125 [255]
125 [255]
126
126
127 Test duplicated changeset
128 ---------------------------------------
129
130 So one is missing and one appear twice.
131
132 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
133 > pick eb57da33312f 2 three
134 > pick eb57da33312f 2 three
135 > pick 08d98a8350f3 4 five
136 > EOF
137 abort: duplicated command for changeset eb57da33312f
138 [255]
139
127 Test short version of command
140 Test short version of command
128 ---------------------------------------
141 ---------------------------------------
129
142
General Comments 0
You need to be logged in to leave comments. Login now