# HG changeset patch # User Pierre-Yves David # Date 1316015485 -7200 # Node ID 45afdbf062f4db050ec9bbd38167acbe272c78f4 # Parent e68f6821ae84d6201395de877c0266657df3366c [states] update qimport code so it doesn't fails on qimport without -r diff -r e68f6821ae84 -r 45afdbf062f4 hgext/states.py --- a/hgext/states.py Wed Sep 14 17:40:24 2011 +0200 +++ b/hgext/states.py Wed Sep 14 17:51:25 2011 +0200 @@ -679,14 +679,17 @@ def wrapmqqimport(orig, queue, repo, *args, **kwargs): if 'rev' in kwargs: - # we can take the min as non linear import wil break - base = min(scmutil.revrange(repo, kwargs['rev'])) - basenode = repo.changelog.node(base) - state = repo.nodestate(basenode) - if not state.mutable: - raise util.Abort(_('can not qimport published changeset %s') - % node.short(basenode), - hint=_('see `hg help --extension states` for details')) + # we can take the min as non linear import will break + # anyway + revs = scmutil.revrange(repo, kwargs['rev']) + if revs: + base = min(revs) + basenode = repo.changelog.node(base) + state = repo.nodestate(basenode) + if not state.mutable: + raise util.Abort(_('can not qimport published changeset %s') + % node.short(basenode), + hint=_('see `hg help --extension states` for details')) return orig(queue, repo, *args, **kwargs) @@ -753,7 +756,6 @@ def nodestate(self, node): """return the state object associated to the given node""" rev = self.changelog.rev(node) - for state in STATES: # avoid for untracked heads if state.next is not None: