]> arthur.barton.de Git - bup.git/commitdiff
code clarity: one-letter var carried for too long bup-0.14a
authorGabriel Filion <lelutin@gmail.com>
Fri, 30 Apr 2010 05:53:13 +0000 (01:53 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Fri, 30 Apr 2010 06:07:49 +0000 (02:07 -0400)
In split-cmd.py, the "w" variable is first seen on line 55 and is kept
around until line 96. Variables that are sparsely used in a medium
distance in the code should have a name that carries more sense when
read on its own.

Change "w" into "pack_writer" to better identify the purpose of the
variable.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
cmd/split-cmd.py

index e8df4d30c66551b2b0984967ddf5c619641a4167..ff73c3f25fec0ddac8b6f66a1839cedf7fc6c3d5 100755 (executable)
@@ -52,20 +52,20 @@ start_time = time.time()
 
 refname = opt.name and 'refs/heads/%s' % opt.name or None
 if opt.noop or opt.copy:
-    cli = w = oldref = None
+    cli = pack_writer = oldref = None
 elif opt.remote or is_reverse:
     cli = client.Client(opt.remote)
     oldref = refname and cli.read_ref(refname) or None
-    w = cli.new_packwriter()
+    pack_writer = cli.new_packwriter()
 else:
     cli = None
     oldref = refname and git.read_ref(refname) or None
-    w = git.PackWriter()
+    pack_writer = git.PackWriter()
 
 files = extra and (open(fn) for fn in extra) or [sys.stdin]
-if w:
-    shalist = hashsplit.split_to_shalist(w, files)
-    tree = w.new_tree(shalist)
+if pack_writer:
+    shalist = hashsplit.split_to_shalist(pack_writer, files)
+    tree = pack_writer.new_tree(shalist)
 else:
     last = 0
     for (blob, bits) in hashsplit.hashsplit_iter(files):
@@ -88,13 +88,13 @@ if opt.tree:
 if opt.commit or opt.name:
     msg = 'bup split\n\nGenerated by command:\n%r' % sys.argv
     ref = opt.name and ('refs/heads/%s' % opt.name) or None
-    commit = w.new_commit(oldref, tree, msg)
+    commit = pack_writer.new_commit(oldref, tree, msg)
     if opt.commit:
         print commit.encode('hex')
 
-if w:
-    w.close()  # must close before we can update the ref
-        
+if pack_writer:
+    pack_writer.close()  # must close before we can update the ref
+
 if opt.name:
     if cli:
         cli.update_ref(refname, commit, oldref)