mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
infinitepush: cleanup temp files
Summary: Infinitepush didn't clean up temp files during pulls. Test Plan: Choose any hg server that's not in vip (for example, hg014.lla2). Run `hg pull ssh://hg014.lla2.facebook.com//data/scm/fbsource -r INFINITEPUSH_COMMIT_HASH` Check that new /tmp/tmp* file has appeared. Install fixed infinitepush extension on the server. Run the same command again, make sure it works fine. Note: no new unittests, because temp filenames are random and that's difficult to test. Reviewers: #mercurial, dschatzberg, tja Reviewed By: tja Subscribers: mjpieters Differential Revision: https://phabricator.intern.facebook.com/D5077767 Tasks: 17599765 Signature: t1:5077767:1495025042:d209d1e5342442ac8b05a4c80748780bbf36846c
This commit is contained in:
parent
24d8640017
commit
5bb6893d41
@ -473,7 +473,7 @@ def getbundlechunks(orig, repo, source, heads=None, bundlecaps=None, **kwargs):
|
|||||||
newheads = []
|
newheads = []
|
||||||
scratchheads = []
|
scratchheads = []
|
||||||
nodestobundle = {}
|
nodestobundle = {}
|
||||||
allbundlerepos = []
|
allbundlestocleanup = []
|
||||||
try:
|
try:
|
||||||
for head in heads:
|
for head in heads:
|
||||||
if head not in repo.changelog.nodemap:
|
if head not in repo.changelog.nodemap:
|
||||||
@ -482,7 +482,7 @@ def getbundlechunks(orig, repo, source, heads=None, bundlecaps=None, **kwargs):
|
|||||||
bundlepath = "bundle:%s+%s" % (repo.root, newbundlefile)
|
bundlepath = "bundle:%s+%s" % (repo.root, newbundlefile)
|
||||||
bundlerepo = repository(repo.ui, bundlepath)
|
bundlerepo = repository(repo.ui, bundlepath)
|
||||||
|
|
||||||
allbundlerepos.append(bundlerepo)
|
allbundlestocleanup.append((bundlerepo, newbundlefile))
|
||||||
bundlerevs = set(_readbundlerevs(bundlerepo))
|
bundlerevs = set(_readbundlerevs(bundlerepo))
|
||||||
bundlecaps = _includefilelogstobundle(
|
bundlecaps = _includefilelogstobundle(
|
||||||
bundlecaps, bundlerepo, bundlerevs, repo.ui)
|
bundlecaps, bundlerepo, bundlerevs, repo.ui)
|
||||||
@ -499,8 +499,14 @@ def getbundlechunks(orig, repo, source, heads=None, bundlecaps=None, **kwargs):
|
|||||||
newheads.extend(bundleroots)
|
newheads.extend(bundleroots)
|
||||||
scratchheads.append(head)
|
scratchheads.append(head)
|
||||||
finally:
|
finally:
|
||||||
for bundlerepo in allbundlerepos:
|
for bundlerepo, bundlefile in allbundlestocleanup:
|
||||||
bundlerepo.close()
|
bundlerepo.close()
|
||||||
|
try:
|
||||||
|
os.unlink(bundlefile)
|
||||||
|
except (IOError, OSError):
|
||||||
|
# if we can't cleanup the file then just ignore the error,
|
||||||
|
# no need to fail
|
||||||
|
pass
|
||||||
|
|
||||||
pullfrombundlestore = bool(scratchbundles)
|
pullfrombundlestore = bool(scratchbundles)
|
||||||
wrappedchangegrouppart = False
|
wrappedchangegrouppart = False
|
||||||
|
Loading…
Reference in New Issue
Block a user