File in use causes clone error (on Windows)
I'm assuming this is a Windows specific issue. I've cloned from github before on Windows with earlier versions of hg and hg-git, but ATM, this is failing (running hg-git 1.1.3 from source). I was able to work around this by cloning from WSL with hg 6.7.2 and the same hg-git source tree. mercurial.util.unlink()
might be able to handle this better instead of os.remove()
.
C:\Users\Matt\projects\github> hg clone https://github.com/mharbison72/client_golang.git --config extensions.hggit=C:\Users\Matt\thg_installer\thg-build\hg-git\hggit client_golang_test --traceback
Traceback (most recent call last):
File "mercurial.scmutil", line 152, in callcatch
return func()
File "mercurial.dispatch", line 446, in _runcatchfunc
return _dispatch(req)
File "mercurial.dispatch", line 1271, in _dispatch
return runcommand(
File "mercurial.dispatch", line 904, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "mercurial.dispatch", line 1283, in _runcommand
return cmdfunc()
File "mercurial.dispatch", line 1269, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "mercurial.util", line 1878, in check
return func(*args, **kwargs)
File "mercurial.commands", line 1985, in clone
r = hg.clone(
File "C:\Users/Matt/thg_installer/thg-build/hg-git/hggit\schemes.py", line 119, in clone
srcpeer, destpeer = orig(*args, **opts)
File "mercurial.hg", line 1016, in clone
exchange.pull(
File "C:\Users/Matt/thg_installer/thg-build/hg-git/hggit\util.py", line 100, in inner
return f(*args, **kwargs)
File "C:\Users/Matt/thg_installer/thg-build/hg-git/hggit\gitrepo.py", line 195, in exchangepull
pullop.cgresult = repo.githandler.fetch(remote, heads)
File "C:\Users/Matt/thg_installer/thg-build/hg-git/hggit\git_handler.py", line 375, in fetch
result = self.fetch_pack(remote.path, heads)
File "C:\Users/Matt/thg_installer/thg-build/hg-git/hggit\git_handler.py", line 1634, in fetch_pack
ret = self._call_client(
File "contextlib", line 126, in __exit__
next(self.gen)
File "C:\Users/Matt/thg_installer/thg-build/hg-git/hggit\util.py", line 286, in add_pack
os.remove(f.name)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\Matt\\projects\\github\\client_golang_test\\.hg\\git\\objects\\pack\\hg-git-fetch-gjly74r7.pack'
abort: The process cannot access the file because it is being used by another process: 'C:\Users\Matt\projects\github\client_golang_test\.hg\git\objects\pack\hg-git-fetch-gjly74r7.pack'
C:\Users\Matt\projects\github> hg version -v --config extensions.hggit=C:\Users\Matt\thg_installer\thg-build\hg-git\hggit
Mercurial Distributed SCM (version 6.6.1)
(see https://mercurial-scm.org for more information)
Copyright (C) 2005-2023 Olivia Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Enabled extensions:
absorb internal
blackbox internal
evolve external 11.1.5.dev0
extdiff internal
fastannotate internal
fix internal
hggit external unknown (dulwich 0.20.46)
mercurial_keyring external 1.4.3 (keyring 22.3.0, backend keyring.backends.Windows)
phabblocker external 20230202
phabricator internal
rebase internal
show internal
strip internal
topic external 1.1.5.dev0