Kiln » Unstable
Clone URL:  

bfproto: turn magic string constant and its length into a constant variable

Changeset 4a415b6458b2

Parent 72bc313a59ac

by Profile picture of User 521Andrew Pritchard <andrewp@fogcreek.com>

Changes to one file · Browse files at 4a415b6458b2 Showing diff from parent 72bc313a59ac Diff from another changeset...

 
9
10
11
 
 
12
13
14
 
101
102
103
104
105
 
 
106
107
108
 
129
130
131
132
 
133
 
9
10
11
12
13
14
15
16
 
103
104
105
 
 
106
107
108
109
110
 
131
132
133
 
134
135
@@ -9,6 +9,8 @@
 import bfutil  import bfsetup   +_heads_prefix = 'kbfiles\n' +  def putbfile(repo, proto, sha):   """putbfile puts a bfile into a repository's local cache and into the system cache."""   f = None @@ -101,8 +103,8 @@
  f = wireproto.future()   yield {}, f   d = f.value - if d[:8] == 'kbfiles\n': - d = d[8:] + if d[:len(_heads_prefix)] == _heads_prefix: + d = d[len(_heads_prefix):]   try:   yield wireproto.decodelist(d[:-1])   except ValueError: @@ -129,5 +131,5 @@
   def heads(repo, proto):   if bfutil.iskbfilesrepo(repo): - return 'kbfiles\n' + wireproto.heads(repo, proto) + return _heads_prefix + wireproto.heads(repo, proto)   return wireproto.heads(repo, proto)