Kiln » Dependencies » Dulwich Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in master

Add support for committing trees and indexes.

Changeset 43ee2c4e9b91

Parent 1a1d665668e8

by Jelmer Vernooij

Changes to one file · Browse files at 43ee2c4e9b91 Showing diff from parent 1a1d665668e8 Diff from another changeset...

Change 1 of 3 Show Entire File dulwich/​index.py Stacked
 
125
126
127
 
 
 
 
 
 
 
 
 
128
129
130
 
169
170
171
 
 
 
 
 
172
173
174
 
222
223
224
 
 
 
 
 
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
 
178
179
180
181
182
183
184
185
186
187
188
 
236
237
238
239
240
241
242
@@ -125,6 +125,15 @@
  write_index(f, entries_list)     +def cleanup_mode(mode): + if stat.S_ISLNK(fsmode) + mode = stat.S_IFLNK + else: + mode = stat.S_IFREG + mode |= (fsmode & 0111) + return mode + +  class Index(object):   """A Git Index file."""   @@ -169,6 +178,11 @@
  def get_sha1(self, path):   """Return the (git object) SHA1 for the object at a path."""   return self[path][-2] + + def iterblobs(self): + """Iterate over path, sha, mode tuples for use with commit_tree.""" + for path, entry in self: + yield path, entry[-2], cleanup_mode(entry[-6])     def clear(self):   """Remove all contents from this index.""" @@ -222,3 +236,7 @@
  trees[parent_path][basename] = (stat.S_IFDIR, tree.id)   else:   return tree.id + + +def commit_index(object_store, index): + return commit_tree(object_store, index.blobs())