comparison mercurial/commands.py @ 2842:7706fa503677

import: get lock and wlock one time this makes import of many patches 6x faster in kernel repo.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Fri, 11 Aug 2006 14:50:41 -0700
parents 2ff57e3113a4
children c9b08cacf983 b3d1145ed06c 81f351c5264d 8e59010158ce
comparison
equal deleted inserted replaced
2841:619f1c65384c 2842:7706fa503677
1820 # (this heuristic is borrowed from quilt) 1820 # (this heuristic is borrowed from quilt)
1821 diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |' + 1821 diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |' +
1822 'retrieving revision [0-9]+(\.[0-9]+)*$|' + 1822 'retrieving revision [0-9]+(\.[0-9]+)*$|' +
1823 '(---|\*\*\*)[ \t])', re.MULTILINE) 1823 '(---|\*\*\*)[ \t])', re.MULTILINE)
1824 1824
1825 wlock = repo.wlock()
1826 lock = repo.lock()
1827
1825 for patch in patches: 1828 for patch in patches:
1826 pf = os.path.join(d, patch) 1829 pf = os.path.join(d, patch)
1827 1830
1828 message = None 1831 message = None
1829 user = None 1832 user = None
1908 if len(files) > 0: 1911 if len(files) > 0:
1909 cfiles = files 1912 cfiles = files
1910 cwd = repo.getcwd() 1913 cwd = repo.getcwd()
1911 if cwd: 1914 if cwd:
1912 cfiles = [util.pathto(cwd, f) for f in files] 1915 cfiles = [util.pathto(cwd, f) for f in files]
1913 addremove_lock(ui, repo, cfiles, {}) 1916 addremove_lock(ui, repo, cfiles, {}, wlock=wlock)
1914 repo.commit(files, message, user, date) 1917 repo.commit(files, message, user, date, wlock=wlock, lock=lock)
1915 finally: 1918 finally:
1916 os.unlink(tmpname) 1919 os.unlink(tmpname)
1917 1920
1918 def incoming(ui, repo, source="default", **opts): 1921 def incoming(ui, repo, source="default", **opts):
1919 """show new changesets found in source 1922 """show new changesets found in source