~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to shelf.py

  • Committer: Michael Ellerman
  • Date: 2006-03-12 01:04:54 UTC
  • mto: (325.1.2 bzrtools) (0.3.1 shelf-dev)
  • mto: This revision was merged to the branch mainline in revision 334.
  • Revision ID: michael@ellerman.id.au-20060312010454-f03a25fc6d4fef16
Cope if there's bogus files in the shelf directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
        sys.stdout.write(open(path).read())
63
63
 
64
64
    def list(self):
 
65
        indexes = self.__list()
65
66
        self.log("Patches on shelf '%s':" % self.name)
66
 
        indexes = self.__list()
67
67
        if len(indexes) == 0:
68
68
            self.log(' None\n')
69
69
            return
102
102
 
103
103
    def __list(self):
104
104
        patches = os.listdir(self.dir)
105
 
        indexes = [int(f) for f in patches]
 
105
        indexes = []
 
106
        for f in patches:
 
107
            if f.endswith('~'):
 
108
                continue # ignore backup files
 
109
            try:
 
110
                indexes.append(int(f))
 
111
            except ValueError:
 
112
                self.log("Warning: Ignoring junk file '%s' on shelf.\n" % f)
 
113
 
106
114
        indexes.sort()
107
115
        return indexes
108
116