equal
deleted
inserted
replaced
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.guardspath = "guards" |
275 self.guardspath = "guards" |
276 self.active_guards = None |
276 self.activeguards = 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) |
281 if gitmode is None: |
281 if gitmode is None: |
322 if a in self.__dict__: |
322 if a in self.__dict__: |
323 delattr(self, a) |
323 delattr(self, a) |
324 self.applied_dirty = 0 |
324 self.applied_dirty = 0 |
325 self.series_dirty = 0 |
325 self.series_dirty = 0 |
326 self.guards_dirty = False |
326 self.guards_dirty = False |
327 self.active_guards = None |
327 self.activeguards = None |
328 |
328 |
329 def diffopts(self, opts={}, patchfn=None): |
329 def diffopts(self, opts={}, patchfn=None): |
330 diffopts = patchmod.diffopts(self.ui, opts) |
330 diffopts = patchmod.diffopts(self.ui, opts) |
331 if self.gitmode == 'auto': |
331 if self.gitmode == 'auto': |
332 diffopts.upgrade = True |
332 diffopts.upgrade = True |
409 bad = self.checkguard(guard) |
409 bad = self.checkguard(guard) |
410 if bad: |
410 if bad: |
411 raise util.Abort(bad) |
411 raise util.Abort(bad) |
412 guards = sorted(set(guards)) |
412 guards = sorted(set(guards)) |
413 self.ui.debug('active guards: %s\n' % ' '.join(guards)) |
413 self.ui.debug('active guards: %s\n' % ' '.join(guards)) |
414 self.active_guards = guards |
414 self.activeguards = guards |
415 self.guards_dirty = True |
415 self.guards_dirty = True |
416 |
416 |
417 def active(self): |
417 def active(self): |
418 if self.active_guards is None: |
418 if self.activeguards is None: |
419 self.active_guards = [] |
419 self.activeguards = [] |
420 try: |
420 try: |
421 guards = self.opener.read(self.guardspath).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 |
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.guardspath), i + 1, bad)) |
430 (self.join(self.guardspath), i + 1, bad)) |
431 else: |
431 else: |
432 self.active_guards.append(guard) |
432 self.activeguards.append(guard) |
433 return self.active_guards |
433 return self.activeguards |
434 |
434 |
435 def setguards(self, idx, guards): |
435 def setguards(self, idx, guards): |
436 for g in guards: |
436 for g in guards: |
437 if len(g) < 2: |
437 if len(g) < 2: |
438 raise util.Abort(_('guard %r too short') % g) |
438 raise util.Abort(_('guard %r too short') % g) |
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.guardspath) |
503 write_list(self.activeguards, 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 = [] |