Browse Source

Fix tests on older versions of Python 3.

Jelmer Vernooij 6 years ago
parent
commit
11ed24666b
3 changed files with 4 additions and 3 deletions
  1. 2 1
      dulwich/client.py
  2. 1 1
      dulwich/refs.py
  3. 1 1
      dulwich/server.py

+ 2 - 1
dulwich/client.py

@@ -599,7 +599,8 @@ class GitClient(object):
                     "depth")
             for sha in graph_walker.shallow:
                 proto.write_pkt_line(COMMAND_SHALLOW + b' ' + sha + b'\n')
-            proto.write_pkt_line(b'%s %d\n' % (COMMAND_DEEPEN, depth))
+            proto.write_pkt_line(COMMAND_DEEPEN + b' ' +
+                                 str(depth).encode('ascii') + b'\n')
             proto.write_pkt_line(None)
             if can_read is not None:
                 (new_shallow, new_unshallow) = _read_shallow_updates(proto)

+ 1 - 1
dulwich/refs.py

@@ -800,7 +800,7 @@ class DiskRefsContainer(RefsContainer):
             parent_filename = self.refpath(parent)
             try:
                 os.rmdir(parent_filename)
-            except OSError as e:
+            except OSError:
                 # this can be caused by the parent directory being
                 # removed by another process, being not empty, etc.
                 # in any case, this is non fatal because we already

+ 1 - 1
dulwich/server.py

@@ -927,7 +927,7 @@ class ReceivePackHandler(PackHandler):
                         self.repo.refs.set_if_equals(ref, oldsha, sha)
                     except all_exceptions:
                         ref_status = b'failed to write'
-            except KeyError as e:
+            except KeyError:
                 ref_status = b'bad ref'
             status.append((ref, ref_status))