Mercurial > hg
comparison hgext/shelve.py @ 32899:3980b2e061f0
shelve: rewrite "x in y.children()" as "y in x.parents()"
children() is slow
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sat, 17 Jun 2017 23:09:39 -0700 |
parents | f65786a02922 |
children | af31d531dda0 |
comparison
equal
deleted
inserted
replaced
32898:c425b678df7c | 32899:3980b2e061f0 |
---|---|
679 except Exception: | 679 except Exception: |
680 repo.vfs.rename('rebasestate', 'unshelverebasestate') | 680 repo.vfs.rename('rebasestate', 'unshelverebasestate') |
681 raise | 681 raise |
682 | 682 |
683 shelvectx = repo['tip'] | 683 shelvectx = repo['tip'] |
684 if not shelvectx in state.pendingctx.children(): | 684 if state.pendingctx not in shelvectx.parents(): |
685 # rebase was a no-op, so it produced no child commit | 685 # rebase was a no-op, so it produced no child commit |
686 shelvectx = state.pendingctx | 686 shelvectx = state.pendingctx |
687 else: | 687 else: |
688 # only strip the shelvectx if the rebase produced it | 688 # only strip the shelvectx if the rebase produced it |
689 state.nodestoremove.append(shelvectx.node()) | 689 state.nodestoremove.append(shelvectx.node()) |
756 "'hg unshelve --continue')")) | 756 "'hg unshelve --continue')")) |
757 | 757 |
758 # refresh ctx after rebase completes | 758 # refresh ctx after rebase completes |
759 shelvectx = repo['tip'] | 759 shelvectx = repo['tip'] |
760 | 760 |
761 if not shelvectx in tmpwctx.children(): | 761 if tmpwctx not in shelvectx.parents(): |
762 # rebase was a no-op, so it produced no child commit | 762 # rebase was a no-op, so it produced no child commit |
763 shelvectx = tmpwctx | 763 shelvectx = tmpwctx |
764 return shelvectx | 764 return shelvectx |
765 | 765 |
766 def _forgetunknownfiles(repo, shelvectx, addedbefore): | 766 def _forgetunknownfiles(repo, shelvectx, addedbefore): |