hgext/mq.py
changeset 14589 7d59ee9e711b
parent 14588 bd3d75a03f80
child 14590 dbb80f03d4ae
equal deleted inserted replaced
14588:bd3d75a03f80 14589:7d59ee9e711b
   270         self.applied_dirty = 0
   270         self.applied_dirty = 0
   271         self.series_dirty = 0
   271         self.series_dirty = 0
   272         self.added = []
   272         self.added = []
   273         self.seriespath = "series"
   273         self.seriespath = "series"
   274         self.statuspath = "status"
   274         self.statuspath = "status"
   275         self.guards_path = "guards"
   275         self.guardspath = "guards"
   276         self.active_guards = None
   276         self.active_guards = None
   277         self.guards_dirty = False
   277         self.guards_dirty = False
   278         # Handle mq.git as a bool with extended values
   278         # Handle mq.git as a bool with extended values
   279         try:
   279         try:
   280             gitmode = ui.configbool('mq', 'git', None)
   280             gitmode = ui.configbool('mq', 'git', None)
   416 
   416 
   417     def active(self):
   417     def active(self):
   418         if self.active_guards is None:
   418         if self.active_guards is None:
   419             self.active_guards = []
   419             self.active_guards = []
   420             try:
   420             try:
   421                 guards = self.opener.read(self.guards_path).split()
   421                 guards = self.opener.read(self.guardspath).split()
   422             except IOError, err:
   422             except IOError, err:
   423                 if err.errno != errno.ENOENT:
   423                 if err.errno != errno.ENOENT:
   424                     raise
   424                     raise
   425                 guards = []
   425                 guards = []
   426             for i, guard in enumerate(guards):
   426             for i, guard in enumerate(guards):
   427                 bad = self.checkguard(guard)
   427                 bad = self.checkguard(guard)
   428                 if bad:
   428                 if bad:
   429                     self.ui.warn('%s:%d: %s\n' %
   429                     self.ui.warn('%s:%d: %s\n' %
   430                                  (self.join(self.guards_path), i + 1, bad))
   430                                  (self.join(self.guardspath), i + 1, bad))
   431                 else:
   431                 else:
   432                     self.active_guards.append(guard)
   432                     self.active_guards.append(guard)
   433         return self.active_guards
   433         return self.active_guards
   434 
   434 
   435     def setguards(self, idx, guards):
   435     def setguards(self, idx, guards):
   498         if self.applied_dirty:
   498         if self.applied_dirty:
   499             write_list(map(str, self.applied), self.statuspath)
   499             write_list(map(str, self.applied), self.statuspath)
   500         if self.series_dirty:
   500         if self.series_dirty:
   501             write_list(self.fullseries, self.seriespath)
   501             write_list(self.fullseries, self.seriespath)
   502         if self.guards_dirty:
   502         if self.guards_dirty:
   503             write_list(self.active_guards, self.guards_path)
   503             write_list(self.active_guards, self.guardspath)
   504         if self.added:
   504         if self.added:
   505             qrepo = self.qrepo()
   505             qrepo = self.qrepo()
   506             if qrepo:
   506             if qrepo:
   507                 qrepo[None].add(f for f in self.added if f not in qrepo[None])
   507                 qrepo[None].add(f for f in self.added if f not in qrepo[None])
   508             self.added = []
   508             self.added = []
  1592                 d = root[len(self.path) + 1:]
  1592                 d = root[len(self.path) + 1:]
  1593                 for f in files:
  1593                 for f in files:
  1594                     fl = os.path.join(d, f)
  1594                     fl = os.path.join(d, f)
  1595                     if (fl not in self.series and
  1595                     if (fl not in self.series and
  1596                         fl not in (self.statuspath, self.seriespath,
  1596                         fl not in (self.statuspath, self.seriespath,
  1597                                    self.guards_path)
  1597                                    self.guardspath)
  1598                         and not fl.startswith('.')):
  1598                         and not fl.startswith('.')):
  1599                         msng_list.append(fl)
  1599                         msng_list.append(fl)
  1600             for x in sorted(msng_list):
  1600             for x in sorted(msng_list):
  1601                 pfx = self.ui.verbose and ('D ') or ''
  1601                 pfx = self.ui.verbose and ('D ') or ''
  1602                 displayname(pfx, x, 'missing')
  1602                 displayname(pfx, x, 'missing')