comparison hgext/mq.py @ 2789:86c54b7cd331

mq: fix variables shadowing builtin
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 06 Aug 2006 17:18:53 +0200
parents 8ec1b1f0a5f7
children e5e23cae6e09
comparison
equal deleted inserted replaced
2788:1e8b8107a2c9 2789:86c54b7cd331
503 filerev = 0 503 filerev = 0
504 seen[f] = filerev 504 seen[f] = filerev
505 # we go in two steps here so the strip loop happens in a 505 # we go in two steps here so the strip loop happens in a
506 # sensible order. When stripping many files, this helps keep 506 # sensible order. When stripping many files, this helps keep
507 # our disk access patterns under control. 507 # our disk access patterns under control.
508 list = seen.keys() 508 seen_list = seen.keys()
509 list.sort() 509 seen_list.sort()
510 for f in list: 510 for f in seen_list:
511 ff = repo.file(f) 511 ff = repo.file(f)
512 filerev = seen[f] 512 filerev = seen[f]
513 if filerev != 0: 513 if filerev != 0:
514 if filerev in ff.nodemap: 514 if filerev in ff.nodemap:
515 filerev = ff.rev(filerev) 515 filerev = ff.rev(filerev)
942 msg = msg and ': ' + msg[0] or ': ' 942 msg = msg and ': ' + msg[0] or ': '
943 else: 943 else:
944 msg = '' 944 msg = ''
945 self.ui.write('%s%s\n' % (patch, msg)) 945 self.ui.write('%s%s\n' % (patch, msg))
946 else: 946 else:
947 list = [] 947 msng_list = []
948 for root, dirs, files in os.walk(self.path): 948 for root, dirs, files in os.walk(self.path):
949 d = root[len(self.path) + 1:] 949 d = root[len(self.path) + 1:]
950 for f in files: 950 for f in files:
951 fl = os.path.join(d, f) 951 fl = os.path.join(d, f)
952 if (fl not in self.series and 952 if (fl not in self.series and
953 fl not in (self.status_path, self.series_path) 953 fl not in (self.status_path, self.series_path)
954 and not fl.startswith('.')): 954 and not fl.startswith('.')):
955 list.append(fl) 955 msng_list.append(fl)
956 list.sort() 956 msng_list.sort()
957 if list: 957 if msng_list:
958 for x in list: 958 for x in msng_list:
959 if self.ui.verbose: 959 if self.ui.verbose:
960 self.ui.write("D ") 960 self.ui.write("D ")
961 self.ui.write("%s\n" % x) 961 self.ui.write("%s\n" % x)
962 962
963 def issaveline(self, l): 963 def issaveline(self, l):
986 l = l[10:].split(' ') 986 l = l[10:].split(' ')
987 qpp = [ hg.bin(x) for x in l ] 987 qpp = [ hg.bin(x) for x in l ]
988 elif datastart != None: 988 elif datastart != None:
989 l = lines[i].rstrip() 989 l = lines[i].rstrip()
990 se = StatusEntry(l) 990 se = StatusEntry(l)
991 id = se.rev 991 file_ = se.name
992 file = se.name 992 if se.rev:
993 if id:
994 applied.append(se) 993 applied.append(se)
995 series.append(file) 994 series.append(file_)
996 if datastart == None: 995 if datastart == None:
997 self.ui.warn("No saved patch data found\n") 996 self.ui.warn("No saved patch data found\n")
998 return 1 997 return 1
999 self.ui.warn("restoring status: %s\n" % lines[0]) 998 self.ui.warn("restoring status: %s\n" % lines[0])
1000 self.full_series = series 999 self.full_series = series
1387 message = repo.mq.readheaders(patch)[0] 1386 message = repo.mq.readheaders(patch)[0]
1388 1387
1389 ui.write('\n'.join(message) + '\n') 1388 ui.write('\n'.join(message) + '\n')
1390 1389
1391 def lastsavename(path): 1390 def lastsavename(path):
1392 (dir, base) = os.path.split(path) 1391 (directory, base) = os.path.split(path)
1393 names = os.listdir(dir) 1392 names = os.listdir(directory)
1394 namere = re.compile("%s.([0-9]+)" % base) 1393 namere = re.compile("%s.([0-9]+)" % base)
1395 max = None 1394 maxindex = None
1396 maxname = None 1395 maxname = None
1397 for f in names: 1396 for f in names:
1398 m = namere.match(f) 1397 m = namere.match(f)
1399 if m: 1398 if m:
1400 index = int(m.group(1)) 1399 index = int(m.group(1))
1401 if max == None or index > max: 1400 if maxindex == None or index > maxindex:
1402 max = index 1401 maxindex = index
1403 maxname = f 1402 maxname = f
1404 if maxname: 1403 if maxname:
1405 return (os.path.join(dir, maxname), max) 1404 return (os.path.join(directory, maxname), maxindex)
1406 return (None, None) 1405 return (None, None)
1407 1406
1408 def savename(path): 1407 def savename(path):
1409 (last, index) = lastsavename(path) 1408 (last, index) = lastsavename(path)
1410 if last is None: 1409 if last is None: