Patchwork [1,of,2] bundle2: raise ProgrammingError for invalid call of addhookargs()

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 14, 2017, 7:53 a.m.
Message ID <1643bad8116707fb6e16.1502697229@mimosa>
Download mbox | patch
Permalink /patch/22968/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 14, 2017, 7:53 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1502589956 -32400
#      Sun Aug 13 11:05:56 2017 +0900
# Node ID 1643bad8116707fb6e162a509682b470e9223fba
# Parent  9d9186f859585f2513e3bde3a304cc72cb534565
bundle2: raise ProgrammingError for invalid call of addhookargs()

It should be hard error. Also fixed the error message as s/hooks/hookargs/.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -318,9 +318,8 @@  class bundleoperation(object):
 
     def addhookargs(self, hookargs):
         if self.hookargs is None:
-            raise error.Abort(
-                _('attempted to add hooks to operation after transaction '
-                  'started'))
+            raise error.ProgrammingError('attempted to add hookargs to '
+                                         'operation after transaction started')
         self.hookargs.update(hookargs)
 
 class TransactionUnavailable(RuntimeError):