Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/mq.py @ 2792:a3c6e7888abf
mq: unused variables, improper usage of 'is [not]', undefined variable
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 06 Aug 2006 17:27:05 +0200 |
parents | 4c39568007f9 |
children | 987c31e2a08c |
comparison
equal
deleted
inserted
replaced
2791:4c39568007f9 | 2792:a3c6e7888abf |
---|---|
537 # that we actually want to keep. changegroup will be used | 537 # that we actually want to keep. changegroup will be used |
538 # to preserve them and add them back after the truncate | 538 # to preserve them and add them back after the truncate |
539 saveheads = [] | 539 saveheads = [] |
540 savebases = {} | 540 savebases = {} |
541 | 541 |
542 tip = chlog.tip() | |
543 heads = limitheads(chlog, rev) | 542 heads = limitheads(chlog, rev) |
544 seen = {} | 543 seen = {} |
545 | 544 |
546 # search through all the heads, finding those where the revision | 545 # search through all the heads, finding those where the revision |
547 # we want to strip away is an ancestor. Also look for merges | 546 # we want to strip away is an ancestor. Also look for merges |
568 for x in r: | 567 for x in r: |
569 if chlog.rev(x) > revnum: | 568 if chlog.rev(x) > revnum: |
570 savebases[x] = 1 | 569 savebases[x] = 1 |
571 | 570 |
572 # create a changegroup for all the branches we need to keep | 571 # create a changegroup for all the branches we need to keep |
573 if backup is "all": | 572 if backup == "all": |
574 backupch = repo.changegroupsubset([rev], chlog.heads(), 'strip') | 573 backupch = repo.changegroupsubset([rev], chlog.heads(), 'strip') |
575 bundle(backupch) | 574 bundle(backupch) |
576 if saveheads: | 575 if saveheads: |
577 backupch = repo.changegroupsubset(savebases.keys(), saveheads, 'strip') | 576 backupch = repo.changegroupsubset(savebases.keys(), saveheads, 'strip') |
578 chgrpfile = bundle(backupch) | 577 chgrpfile = bundle(backupch) |
583 repo.manifest.strip(repo.manifest.rev(change[0]), revnum) | 582 repo.manifest.strip(repo.manifest.rev(change[0]), revnum) |
584 chlog.strip(revnum, revnum) | 583 chlog.strip(revnum, revnum) |
585 if saveheads: | 584 if saveheads: |
586 self.ui.status("adding branch\n") | 585 self.ui.status("adding branch\n") |
587 commands.unbundle(self.ui, repo, chgrpfile, update=False) | 586 commands.unbundle(self.ui, repo, chgrpfile, update=False) |
588 if backup is not "strip": | 587 if backup != "strip": |
589 os.unlink(chgrpfile) | 588 os.unlink(chgrpfile) |
590 | 589 |
591 def isapplied(self, patch): | 590 def isapplied(self, patch): |
592 """returns (index, rev, patch)""" | 591 """returns (index, rev, patch)""" |
593 for i in xrange(len(self.applied)): | 592 for i in xrange(len(self.applied)): |
803 if len(self.applied) == 0: | 802 if len(self.applied) == 0: |
804 self.ui.write("No patches applied\n") | 803 self.ui.write("No patches applied\n") |
805 return | 804 return |
806 wlock = repo.wlock() | 805 wlock = repo.wlock() |
807 self.check_toppatch(repo) | 806 self.check_toppatch(repo) |
808 qp = self.qparents(repo) | |
809 (top, patch) = (self.applied[-1].rev, self.applied[-1].name) | 807 (top, patch) = (self.applied[-1].rev, self.applied[-1].name) |
810 top = revlog.bin(top) | 808 top = revlog.bin(top) |
811 cparents = repo.changelog.parents(top) | 809 cparents = repo.changelog.parents(top) |
812 patchparent = self.qparents(repo, top) | 810 patchparent = self.qparents(repo, top) |
813 message, comments, user, date, patchfound = self.readheaders(patch) | 811 message, comments, user, date, patchfound = self.readheaders(patch) |
1339 patches = [] | 1337 patches = [] |
1340 messages = [] | 1338 messages = [] |
1341 for f in files: | 1339 for f in files: |
1342 patch = q.lookup(f) | 1340 patch = q.lookup(f) |
1343 if patch in patches or patch == parent: | 1341 if patch in patches or patch == parent: |
1344 self.ui.warn(_('Skipping already folded patch %s') % patch) | 1342 ui.warn(_('Skipping already folded patch %s') % patch) |
1345 if q.isapplied(patch): | 1343 if q.isapplied(patch): |
1346 raise util.Abort(_('qfold cannot fold already applied patch %s') % patch) | 1344 raise util.Abort(_('qfold cannot fold already applied patch %s') % patch) |
1347 patches.append(patch) | 1345 patches.append(patch) |
1348 | 1346 |
1349 for patch in patches: | 1347 for patch in patches: |