Patchwork D6984: cvsps: switch a file open to a with statement

login
register
mail settings
Submitter phabricator
Date Oct. 5, 2019, 6:14 p.m.
Message ID <4018eea27a1170f5b15f1c3884d76f5e@localhost.localdomain>
Download mbox | patch
Permalink /patch/41987/
State Not Applicable
Headers show

Comments

phabricator - Oct. 5, 2019, 6:14 p.m.
Closed by commit rHG3b8a4587a456: cvsps: switch a file open to a with statement (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6984?vs=16840&id=16846

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6984/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6984

AFFECTED FILES
  hgext/convert/cvsps.py

CHANGE DETAILS




To: durin42, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py
--- a/hgext/convert/cvsps.py
+++ b/hgext/convert/cvsps.py
@@ -138,7 +138,8 @@ 
 
         # Get the real directory in the repository
         try:
-            prefix = open(os.path.join('CVS','Repository'), 'rb').read().strip()
+            with open(os.path.join(b'CVS', b'Repository'), 'rb') as f:
+                prefix = f.read().strip()
             directory = prefix
             if prefix == ".":
                 prefix = ""