comparison hgext3rd/topic/flow.py @ 3226:5dfe4e5cf9e4 stable

topic: use more protective code to access publishing code There are some code path where the operation is not properly initialized and lack the new attributes. While the lack of initialization, is suspicious and I've not be able to pin point case where this happens. Currently the code crash when it encounter this situation. So we make the code more resistant to this case to prevent bad user experience.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 05 Dec 2017 13:21:57 +0100
parents a342c454ccf3
children 8a772f0c54d9
comparison
equal deleted inserted replaced
3210:df8d535216af 3226:5dfe4e5cf9e4
46 orig(self, *args, **kwargs) 46 orig(self, *args, **kwargs)
47 self.publish = publish 47 self.publish = publish
48 48
49 def wrapphasediscovery(orig, pushop): 49 def wrapphasediscovery(orig, pushop):
50 orig(pushop) 50 orig(pushop)
51 if pushop.publish: 51 if getattr(pushop, 'publish', False):
52 if not util.safehasattr(pushop, 'remotephases'): 52 if not util.safehasattr(pushop, 'remotephases'):
53 msg = _('--publish flag only supported from Mercurial 4.4 and higher') 53 msg = _('--publish flag only supported from Mercurial 4.4 and higher')
54 raise error.Abort(msg) 54 raise error.Abort(msg)
55 if not pushop.remotephases.publishing: 55 if not pushop.remotephases.publishing:
56 unfi = pushop.repo.unfiltered() 56 unfi = pushop.repo.unfiltered()