Mercurial > hg
diff mercurial/localrepo.py @ 2830:49988d9f0758
Merge with crew, fix most tests
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 09 Aug 2006 13:55:18 -0500 |
parents | 2a0c599f7bb0 |
children | e78cad1f6b1f |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue Aug 08 10:56:48 2006 -0500 +++ b/mercurial/localrepo.py Wed Aug 09 13:55:18 2006 -0500 @@ -1177,22 +1177,29 @@ else: return subset - def pull(self, remote, heads=None, force=False): - l = self.lock() + def pull(self, remote, heads=None, force=False, lock=None): + mylock = False + if not lock: + lock = self.lock() + mylock = True - fetch = self.findincoming(remote, force=force) - if fetch == [nullid]: - self.ui.status(_("requesting all changes\n")) + try: + fetch = self.findincoming(remote, force=force) + if fetch == [nullid]: + self.ui.status(_("requesting all changes\n")) - if not fetch: - self.ui.status(_("no changes found\n")) - return 0 + if not fetch: + self.ui.status(_("no changes found\n")) + return 0 - if heads is None: - cg = remote.changegroup(fetch, 'pull') - else: - cg = remote.changegroupsubset(fetch, heads, 'pull') - return self.addchangegroup(cg, 'pull', remote.url()) + if heads is None: + cg = remote.changegroup(fetch, 'pull') + else: + cg = remote.changegroupsubset(fetch, heads, 'pull') + return self.addchangegroup(cg, 'pull', remote.url()) + finally: + if mylock: + lock.release() def push(self, remote, force=False, revs=None): # there are two ways to push to remote repo: