Show More
@@ -1096,12 +1096,6 b' class queue(object):' | |||||
1096 | m, a, r, d = repo.status(qp, top)[:4] |
|
1096 | m, a, r, d = repo.status(qp, top)[:4] | |
1097 | if d: |
|
1097 | if d: | |
1098 | raise util.Abort(_("deletions found between repo revs")) |
|
1098 | raise util.Abort(_("deletions found between repo revs")) | |
1099 | for f in m: |
|
|||
1100 | getfile(f, mmap[f], mmap.flags(f)) |
|
|||
1101 | for f in r: |
|
|||
1102 | getfile(f, mmap[f], mmap.flags(f)) |
|
|||
1103 | for f in m + r: |
|
|||
1104 | repo.dirstate.normal(f) |
|
|||
1105 | for f in a: |
|
1099 | for f in a: | |
1106 | try: |
|
1100 | try: | |
1107 | os.unlink(repo.wjoin(f)) |
|
1101 | os.unlink(repo.wjoin(f)) | |
@@ -1111,6 +1105,12 b' class queue(object):' | |||||
1111 | try: os.removedirs(os.path.dirname(repo.wjoin(f))) |
|
1105 | try: os.removedirs(os.path.dirname(repo.wjoin(f))) | |
1112 | except: pass |
|
1106 | except: pass | |
1113 | repo.dirstate.forget(f) |
|
1107 | repo.dirstate.forget(f) | |
|
1108 | for f in m: | |||
|
1109 | getfile(f, mmap[f], mmap.flags(f)) | |||
|
1110 | for f in r: | |||
|
1111 | getfile(f, mmap[f], mmap.flags(f)) | |||
|
1112 | for f in m + r: | |||
|
1113 | repo.dirstate.normal(f) | |||
1114 | repo.dirstate.setparents(qp, nullid) |
|
1114 | repo.dirstate.setparents(qp, nullid) | |
1115 | for patch in reversed(self.applied[start:end]): |
|
1115 | for patch in reversed(self.applied[start:end]): | |
1116 | self.ui.status(_("popping %s\n") % patch.name) |
|
1116 | self.ui.status(_("popping %s\n") % patch.name) |
@@ -579,7 +579,13 b' class revlog(object):' | |||||
579 | return reachable |
|
579 | return reachable | |
580 |
|
580 | |||
581 | def ancestors(self, *revs): |
|
581 | def ancestors(self, *revs): | |
582 |
|
|
582 | """Generate the ancestors of 'revs' in reverse topological order. | |
|
583 | ||||
|
584 | Yield a sequence of revision numbers starting with the parents | |||
|
585 | of each revision in revs, i.e., each revision is *not* considered | |||
|
586 | an ancestor of itself. Results are in breadth-first order: | |||
|
587 | parents of each rev in revs, then parents of those, etc. Result | |||
|
588 | does not include the null revision.""" | |||
583 | visit = list(revs) |
|
589 | visit = list(revs) | |
584 | seen = set([nullrev]) |
|
590 | seen = set([nullrev]) | |
585 | while visit: |
|
591 | while visit: | |
@@ -590,7 +596,12 b' class revlog(object):' | |||||
590 | yield parent |
|
596 | yield parent | |
591 |
|
597 | |||
592 | def descendants(self, *revs): |
|
598 | def descendants(self, *revs): | |
593 |
|
|
599 | """Generate the descendants of 'revs' in revision order. | |
|
600 | ||||
|
601 | Yield a sequence of revision numbers starting with a child of | |||
|
602 | some rev in revs, i.e., each revision is *not* considered a | |||
|
603 | descendant of itself. Results are ordered by revision number (a | |||
|
604 | topological sort).""" | |||
594 | seen = set(revs) |
|
605 | seen = set(revs) | |
595 | for i in xrange(min(revs) + 1, len(self)): |
|
606 | for i in xrange(min(revs) + 1, len(self)): | |
596 | for x in self.parentrevs(i): |
|
607 | for x in self.parentrevs(i): | |
@@ -600,15 +611,20 b' class revlog(object):' | |||||
600 | break |
|
611 | break | |
601 |
|
612 | |||
602 | def findmissing(self, common=None, heads=None): |
|
613 | def findmissing(self, common=None, heads=None): | |
603 | ''' |
|
614 | """Return the ancestors of heads that are not ancestors of common. | |
604 | returns the topologically sorted list of nodes from the set: |
|
615 | ||
605 | missing = (ancestors(heads) \ ancestors(common)) |
|
616 | More specifically, return a list of nodes N such that every N | |
|
617 | satisfies the following constraints: | |||
606 |
|
618 | |||
607 | where ancestors() is the set of ancestors from heads, heads included |
|
619 | 1. N is an ancestor of some node in 'heads' | |
|
620 | 2. N is not an ancestor of any node in 'common' | |||
608 |
|
621 | |||
609 | if heads is None, the heads of the revlog are used |
|
622 | The list is sorted by revision number, meaning it is | |
610 | if common is None, nullid is assumed to be a common node |
|
623 | topologically sorted. | |
611 | ''' |
|
624 | ||
|
625 | 'heads' and 'common' are both lists of node IDs. If heads is | |||
|
626 | not supplied, uses all of the revlog's heads. If common is not | |||
|
627 | supplied, uses nullid.""" | |||
612 | if common is None: |
|
628 | if common is None: | |
613 | common = [nullid] |
|
629 | common = [nullid] | |
614 | if heads is None: |
|
630 | if heads is None: | |
@@ -639,20 +655,26 b' class revlog(object):' | |||||
639 | return [self.node(r) for r in missing] |
|
655 | return [self.node(r) for r in missing] | |
640 |
|
656 | |||
641 | def nodesbetween(self, roots=None, heads=None): |
|
657 | def nodesbetween(self, roots=None, heads=None): | |
642 | """Return a tuple containing three elements. Elements 1 and 2 contain |
|
658 | """Return a topological path from 'roots' to 'heads'. | |
643 | a final list bases and heads after all the unreachable ones have been |
|
659 | ||
644 | pruned. Element 0 contains a topologically sorted list of all |
|
660 | Return a tuple (nodes, outroots, outheads) where 'nodes' is a | |
|
661 | topologically sorted list of all nodes N that satisfy both of | |||
|
662 | these constraints: | |||
|
663 | ||||
|
664 | 1. N is a descendant of some node in 'roots' | |||
|
665 | 2. N is an ancestor of some node in 'heads' | |||
645 |
|
666 | |||
646 | nodes that satisfy these constraints: |
|
667 | Every node is considered to be both a descendant and an ancestor | |
647 | 1. All nodes must be descended from a node in roots (the nodes on |
|
668 | of itself, so every reachable node in 'roots' and 'heads' will be | |
648 | roots are considered descended from themselves). |
|
669 | included in 'nodes'. | |
649 | 2. All nodes must also be ancestors of a node in heads (the nodes in |
|
|||
650 | heads are considered to be their own ancestors). |
|
|||
651 |
|
670 | |||
652 | If roots is unspecified, nullid is assumed as the only root. |
|
671 | 'outroots' is the list of reachable nodes in 'roots', i.e., the | |
653 | If heads is unspecified, it is taken to be the output of the |
|
672 | subset of 'roots' that is returned in 'nodes'. Likewise, | |
654 | heads method (i.e. a list of all nodes in the repository that |
|
673 | 'outheads' is the subset of 'heads' that is also in 'nodes'. | |
655 | have no children).""" |
|
674 | ||
|
675 | 'roots' and 'heads' are both lists of node IDs. If 'roots' is | |||
|
676 | unspecified, uses nullid as the only root. If 'heads' is | |||
|
677 | unspecified, uses list of all of the revlog's heads.""" | |||
656 | nonodes = ([], [], []) |
|
678 | nonodes = ([], [], []) | |
657 | if roots is not None: |
|
679 | if roots is not None: | |
658 | roots = list(roots) |
|
680 | roots = list(roots) |
@@ -561,3 +561,23 b' echo % test popping revisions not in wor' | |||||
561 | hg qseries -v |
|
561 | hg qseries -v | |
562 | hg up qparent |
|
562 | hg up qparent | |
563 | hg qpop |
|
563 | hg qpop | |
|
564 | ||||
|
565 | cd .. | |||
|
566 | hg init deletion-order | |||
|
567 | cd deletion-order | |||
|
568 | ||||
|
569 | touch a | |||
|
570 | hg ci -Aqm0 | |||
|
571 | ||||
|
572 | hg qnew rename-dir | |||
|
573 | hg rm a | |||
|
574 | hg qrefresh | |||
|
575 | ||||
|
576 | mkdir a b | |||
|
577 | touch a/a b/b | |||
|
578 | hg add -q a b | |||
|
579 | hg qrefresh | |||
|
580 | ||||
|
581 | echo % test popping must remove files added in subdirectories first | |||
|
582 | hg qpop | |||
|
583 | cd .. |
@@ -612,3 +612,6 b' 0 A empty' | |||||
612 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
612 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
613 | popping empty |
|
613 | popping empty | |
614 | patch queue now empty |
|
614 | patch queue now empty | |
|
615 | % test popping must remove files added in subdirectories first | |||
|
616 | popping rename-dir | |||
|
617 | patch queue now empty |
General Comments 0
You need to be logged in to leave comments.
Login now