comparison mercurial/localrepo.py @ 16683:525fdb738975

cleanup: eradicate long lines
author Brodie Rao <brodie@sf.io>
date Sat, 12 May 2012 15:54:54 +0200
parents b6081c2c4647
children d947e1da1259
comparison
equal deleted inserted replaced
16676:654b9e1966f7 16683:525fdb738975
278 fp.seek(0, 2) 278 fp.seek(0, 2)
279 if prevtags and prevtags[-1] != '\n': 279 if prevtags and prevtags[-1] != '\n':
280 fp.write('\n') 280 fp.write('\n')
281 for name in names: 281 for name in names:
282 m = munge and munge(name) or name 282 m = munge and munge(name) or name
283 if self._tagscache.tagtypes and name in self._tagscache.tagtypes: 283 if (self._tagscache.tagtypes and
284 name in self._tagscache.tagtypes):
284 old = self.tags().get(name, nullid) 285 old = self.tags().get(name, nullid)
285 fp.write('%s %s\n' % (hex(old), m)) 286 fp.write('%s %s\n' % (hex(old), m))
286 fp.write('%s %s\n' % (hex(node), m)) 287 fp.write('%s %s\n' % (hex(node), m))
287 fp.close() 288 fp.close()
288 289
358 self.tags() # instantiate the cache 359 self.tags() # instantiate the cache
359 self._tag(names, node, message, local, user, date) 360 self._tag(names, node, message, local, user, date)
360 361
361 @propertycache 362 @propertycache
362 def _tagscache(self): 363 def _tagscache(self):
363 '''Returns a tagscache object that contains various tags related caches.''' 364 '''Returns a tagscache object that contains various tags related
365 caches.'''
364 366
365 # This simplifies its cache management by having one decorated 367 # This simplifies its cache management by having one decorated
366 # function (this one) and the rest simply fetch things from it. 368 # function (this one) and the rest simply fetch things from it.
367 class tagscache(object): 369 class tagscache(object):
368 def __init__(self): 370 def __init__(self):
1171 msgfn = self.savecommitmessage(cctx._text) 1173 msgfn = self.savecommitmessage(cctx._text)
1172 1174
1173 p1, p2 = self.dirstate.parents() 1175 p1, p2 = self.dirstate.parents()
1174 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '') 1176 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
1175 try: 1177 try:
1176 self.hook("precommit", throw=True, parent1=hookp1, parent2=hookp2) 1178 self.hook("precommit", throw=True, parent1=hookp1,
1179 parent2=hookp2)
1177 ret = self.commitctx(cctx, True) 1180 ret = self.commitctx(cctx, True)
1178 except: 1181 except:
1179 if edited: 1182 if edited:
1180 self.ui.write( 1183 self.ui.write(
1181 _('note: commit message saved in %s\n') % msgfn) 1184 _('note: commit message saved in %s\n') % msgfn)
1307 return self[node].walk(match) 1310 return self[node].walk(match)
1308 1311
1309 def status(self, node1='.', node2=None, match=None, 1312 def status(self, node1='.', node2=None, match=None,
1310 ignored=False, clean=False, unknown=False, 1313 ignored=False, clean=False, unknown=False,
1311 listsubrepos=False): 1314 listsubrepos=False):
1312 """return status of files between two nodes or node and working directory 1315 """return status of files between two nodes or node and working
1316 directory.
1313 1317
1314 If node1 is None, use the first dirstate parent instead. 1318 If node1 is None, use the first dirstate parent instead.
1315 If node2 is None, compare node1 with working directory. 1319 If node2 is None, compare node1 with working directory.
1316 """ 1320 """
1317 1321
1652 remoteheads = ['force'] 1656 remoteheads = ['force']
1653 # ssh: return remote's addchangegroup() 1657 # ssh: return remote's addchangegroup()
1654 # http: return remote's addchangegroup() or 0 for error 1658 # http: return remote's addchangegroup() or 0 for error
1655 ret = remote.unbundle(cg, remoteheads, 'push') 1659 ret = remote.unbundle(cg, remoteheads, 'push')
1656 else: 1660 else:
1657 # we return an integer indicating remote head count change 1661 # we return an integer indicating remote head count
1662 # change
1658 ret = remote.addchangegroup(cg, 'push', self.url()) 1663 ret = remote.addchangegroup(cg, 'push', self.url())
1659 1664
1660 if ret: 1665 if ret:
1661 # push succeed, synchonize target of the push 1666 # push succeed, synchonize target of the push
1662 cheads = outgoing.missingheads 1667 cheads = outgoing.missingheads
1884 # Go through all our files in order sorted by name. 1889 # Go through all our files in order sorted by name.
1885 count[:] = [0, len(changedfiles)] 1890 count[:] = [0, len(changedfiles)]
1886 for fname in sorted(changedfiles): 1891 for fname in sorted(changedfiles):
1887 filerevlog = self.file(fname) 1892 filerevlog = self.file(fname)
1888 if not len(filerevlog): 1893 if not len(filerevlog):
1889 raise util.Abort(_("empty or missing revlog for %s") % fname) 1894 raise util.Abort(_("empty or missing revlog for %s")
1895 % fname)
1890 fstate[0] = fname 1896 fstate[0] = fname
1891 fstate[1] = fnodes.pop(fname, {}) 1897 fstate[1] = fnodes.pop(fname, {})
1892 1898
1893 nodelist = prune(filerevlog, fstate[1]) 1899 nodelist = prune(filerevlog, fstate[1])
1894 if nodelist: 1900 if nodelist:
1984 1990
1985 count[:] = [0, len(changedfiles)] 1991 count[:] = [0, len(changedfiles)]
1986 for fname in sorted(changedfiles): 1992 for fname in sorted(changedfiles):
1987 filerevlog = self.file(fname) 1993 filerevlog = self.file(fname)
1988 if not len(filerevlog): 1994 if not len(filerevlog):
1989 raise util.Abort(_("empty or missing revlog for %s") % fname) 1995 raise util.Abort(_("empty or missing revlog for %s")
1996 % fname)
1990 fstate[0] = fname 1997 fstate[0] = fname
1991 nodelist = gennodelst(filerevlog) 1998 nodelist = gennodelst(filerevlog)
1992 if nodelist: 1999 if nodelist:
1993 count[0] += 1 2000 count[0] += 1
1994 yield bundler.fileheader(fname) 2001 yield bundler.fileheader(fname)
2241 elapsed = 0.001 2248 elapsed = 0.001
2242 self.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % 2249 self.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') %
2243 (util.bytecount(total_bytes), elapsed, 2250 (util.bytecount(total_bytes), elapsed,
2244 util.bytecount(total_bytes / elapsed))) 2251 util.bytecount(total_bytes / elapsed)))
2245 2252
2246 # new requirements = old non-format requirements + new format-related 2253 # new requirements = old non-format requirements +
2254 # new format-related
2247 # requirements from the streamed-in repository 2255 # requirements from the streamed-in repository
2248 requirements.update(set(self.requirements) - self.supportedformats) 2256 requirements.update(set(self.requirements) - self.supportedformats)
2249 self._applyrequirements(requirements) 2257 self._applyrequirements(requirements)
2250 self._writerequirements() 2258 self._writerequirements()
2251 2259