Mercurial > public > mercurial-scm > hg
comparison mercurial/subrepo.py @ 52605:35cc15fbc523
subrepo: don't leak a file descriptor when running a git command
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 17 Dec 2024 16:02:58 -0500 |
parents | 9d79ffeed7c0 |
children | 5cc8deb96b48 |
comparison
equal
deleted
inserted
replaced
52604:89215c5b714c | 52605:35cc15fbc523 |
---|---|
1964 return 1 | 1964 return 1 |
1965 | 1965 |
1966 # TODO: add support for non-plain formatter (see cmdutil.cat()) | 1966 # TODO: add support for non-plain formatter (see cmdutil.cat()) |
1967 for f in match.files(): | 1967 for f in match.files(): |
1968 output = self._gitcommand([b"show", b"%s:%s" % (rev, f)]) | 1968 output = self._gitcommand([b"show", b"%s:%s" % (rev, f)]) |
1969 fp = cmdutil.makefileobj( | 1969 with cmdutil.makefileobj( |
1970 self._ctx, fntemplate, pathname=self.wvfs.reljoin(prefix, f) | 1970 self._ctx, fntemplate, pathname=self.wvfs.reljoin(prefix, f) |
1971 ) | 1971 ) as fp: |
1972 fp.write(output) | 1972 fp.write(output) |
1973 fp.close() | 1973 |
1974 return 0 | 1974 return 0 |
1975 | 1975 |
1976 @annotatesubrepoerror | 1976 @annotatesubrepoerror |
1977 def status(self, rev2, **opts) -> istatus.Status: | 1977 def status(self, rev2, **opts) -> istatus.Status: |
1978 rev1 = self._state[1] | 1978 rev1 = self._state[1] |