Mercurial > hgsubversion
comparison hgsubversion/editor.py @ 434:3e2259fe3c93
editor: move exception data into RevisionData class
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Tue, 16 Jun 2009 08:42:15 +0200 |
parents | a2a15fa7afb1 |
children | 7c576ae19d80 |
comparison
equal
deleted
inserted
replaced
433:a2a15fa7afb1 | 434:3e2259fe3c93 |
---|---|
34 """ | 34 """ |
35 def fun(self, *args, **kwargs): | 35 def fun(self, *args, **kwargs): |
36 try: | 36 try: |
37 return fn(self, *args, **kwargs) | 37 return fn(self, *args, **kwargs) |
38 except: #pragma: no cover | 38 except: #pragma: no cover |
39 if not hasattr(self, '_exception_info'): | 39 if self.current.exception is not None: |
40 self._exception_info = sys.exc_info() | 40 self.current.exception = sys.exc_info() |
41 raise | 41 raise |
42 return fun | 42 return fun |
43 | 43 |
44 | 44 |
45 class RevisionData(object): | 45 class RevisionData(object): |
46 | 46 |
47 __slots__ = [ | 47 __slots__ = [ |
48 'file', 'files', 'deleted', 'rev', 'execfiles', 'symlinks', 'batons', | 48 'file', 'files', 'deleted', 'rev', 'execfiles', 'symlinks', 'batons', |
49 'copies', 'missing', 'emptybranches', 'base', 'externals', 'ui', | 49 'copies', 'missing', 'emptybranches', 'base', 'externals', 'ui', |
50 'exception', | |
50 ] | 51 ] |
51 | 52 |
52 def __init__(self, ui): | 53 def __init__(self, ui): |
53 self.ui = ui | 54 self.ui = ui |
54 self.clear() | 55 self.clear() |
65 self.copies = {} | 66 self.copies = {} |
66 self.missing = set() | 67 self.missing = set() |
67 self.emptybranches = {} | 68 self.emptybranches = {} |
68 self.base = None | 69 self.base = None |
69 self.externals = {} | 70 self.externals = {} |
71 self.exception = None | |
70 | 72 |
71 def set(self, path, data, isexec=False, islink=False): | 73 def set(self, path, data, isexec=False, islink=False): |
72 if islink: | 74 if islink: |
73 data = 'link ' + data | 75 data = 'link ' + data |
74 self.files[path] = data | 76 self.files[path] = data |
125 self.current.set(path, external.write(), False, False) | 127 self.current.set(path, external.write(), False, False) |
126 else: | 128 else: |
127 self.current.delete(path) | 129 self.current.delete(path) |
128 | 130 |
129 def commit_current_delta(self, tbdelta): | 131 def commit_current_delta(self, tbdelta): |
130 if hasattr(self, '_exception_info'): #pragma: no cover | 132 if self.current.exception is not None: #pragma: no cover |
131 traceback.print_exception(*self._exception_info) | 133 traceback.print_exception(*self.current.exception) |
132 raise ReplayException() | 134 raise ReplayException() |
133 if self.current.missing: | 135 if self.current.missing: |
134 raise MissingPlainTextError() | 136 raise MissingPlainTextError() |
135 self._updateexternals() | 137 self._updateexternals() |
136 # paranoidly generate the list of files to commit | 138 # paranoidly generate the list of files to commit |