File tree 1 file changed +17
-17
lines changed
1 file changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -88,25 +88,25 @@ def _iter_packed_refs(cls, repo):
88
88
"""Returns an iterator yielding pairs of sha1/path pairs (as bytes) for the corresponding refs.
89
89
:note: The packed refs file will be kept open as long as we iterate"""
90
90
try :
91
- fp = open (cls ._get_packed_refs_path (repo ), 'rt' )
92
- for line in fp :
93
- line = line .strip ()
94
- if not line :
95
- continue
96
- if line .startswith ('#' ):
97
- if line .startswith ('# pack-refs with:' ) and not line .endswith ('peeled' ):
98
- raise TypeError ("PackingType of packed-Refs not understood: %r" % line )
99
- # END abort if we do not understand the packing scheme
100
- continue
101
- # END parse comment
91
+ with open (cls ._get_packed_refs_path (repo ), 'rt' ) as fp :
92
+ for line in fp :
93
+ line = line .strip ()
94
+ if not line :
95
+ continue
96
+ if line .startswith ('#' ):
97
+ if line .startswith ('# pack-refs with:' ) and not line .endswith ('peeled' ):
98
+ raise TypeError ("PackingType of packed-Refs not understood: %r" % line )
99
+ # END abort if we do not understand the packing scheme
100
+ continue
101
+ # END parse comment
102
102
103
- # skip dereferenced tag object entries - previous line was actual
104
- # tag reference for it
105
- if line [0 ] == '^' :
106
- continue
103
+ # skip dereferenced tag object entries - previous line was actual
104
+ # tag reference for it
105
+ if line [0 ] == '^' :
106
+ continue
107
107
108
- yield tuple (line .split (' ' , 1 ))
109
- # END for each line
108
+ yield tuple (line .split (' ' , 1 ))
109
+ # END for each line
110
110
except (OSError , IOError ):
111
111
raise StopIteration
112
112
# END no packed-refs file handling
You can’t perform that action at this time.
0 commit comments