Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 11099:a68bd3b7c040
workingctx: use member variables to store ignored and clean
If some code tries to query ignored or clean files without first
calling the explicit status() method to query them, it will raise
an exception (indicating a software bug).
author | Steve Borho <steve@borho.org> |
---|---|
date | Tue, 04 May 2010 15:02:55 -0500 |
parents | 380ab78dbd69 |
children | 83968ae4aaf2 |
comparison
equal
deleted
inserted
replaced
11098:380ab78dbd69 | 11099:a68bd3b7c040 |
---|---|
562 if date: | 562 if date: |
563 self._date = util.parsedate(date) | 563 self._date = util.parsedate(date) |
564 if user: | 564 if user: |
565 self._user = user | 565 self._user = user |
566 if changes: | 566 if changes: |
567 self._status = list(changes) | 567 self._status = list(changes[:5]) |
568 self._ignored = changes[5] | |
569 self._clean = changes[6] | |
570 else: | |
571 self._ignored = None | |
572 self._clean = None | |
568 | 573 |
569 self._extra = {} | 574 self._extra = {} |
570 if extra: | 575 if extra: |
571 self._extra = extra.copy() | 576 self._extra = extra.copy() |
572 if 'branch' not in self._extra: | 577 if 'branch' not in self._extra: |
622 | 627 |
623 return man | 628 return man |
624 | 629 |
625 @propertycache | 630 @propertycache |
626 def _status(self): | 631 def _status(self): |
627 return self._repo.status(unknown=True) | 632 return self._repo.status(unknown=True)[:5] |
628 | 633 |
629 @propertycache | 634 @propertycache |
630 def _user(self): | 635 def _user(self): |
631 return self._repo.ui.username() | 636 return self._repo.ui.username() |
632 | 637 |
645 def status(self, ignored=False, clean=False, unknown=False): | 650 def status(self, ignored=False, clean=False, unknown=False): |
646 """Explicit status query | 651 """Explicit status query |
647 Unless this method is used to query the working copy status, the | 652 Unless this method is used to query the working copy status, the |
648 _status property will implicitly read the status using its default | 653 _status property will implicitly read the status using its default |
649 arguments.""" | 654 arguments.""" |
650 self._status = self._repo.status(ignored=ignored, clean=clean, | 655 stat = self._repo.status(ignored=ignored, clean=clean, unknown=unknown) |
651 unknown=unknown) | 656 self._ignored = ignored and stat[5] or None |
657 self._clean = clean and stat[6] or None | |
658 self._status = stat[:5] | |
652 return self._status | 659 return self._status |
653 | 660 |
654 def manifest(self): | 661 def manifest(self): |
655 return self._manifest | 662 return self._manifest |
656 def user(self): | 663 def user(self): |
671 def deleted(self): | 678 def deleted(self): |
672 return self._status[3] | 679 return self._status[3] |
673 def unknown(self): | 680 def unknown(self): |
674 return self._status[4] | 681 return self._status[4] |
675 def ignored(self): | 682 def ignored(self): |
676 return self._status[5] | 683 if self._ignored is None: |
684 raise util.Abort(_("Ignored files requested without prior query\n")) | |
685 return self._ignored | |
677 def clean(self): | 686 def clean(self): |
678 return self._status[6] | 687 if self._clean is None: |
688 raise util.Abort(_("Clean files requested without prior query\n")) | |
689 return self._clean | |
679 def branch(self): | 690 def branch(self): |
680 return self._extra['branch'] | 691 return self._extra['branch'] |
681 def extra(self): | 692 def extra(self): |
682 return self._extra | 693 return self._extra |
683 | 694 |