comparison rhodecode/lib/vcs/backends/git/inmemory.py @ 4116:ffd45b185016 rhodecode-2.2.5-gpl

Imported some of the GPLv3'd changes from RhodeCode v2.2.5. This imports changes between changesets 21af6c4eab3d and 6177597791c2 in RhodeCode's original repository, including only changes to Python files and HTML. RhodeCode clearly licensed its changes to these files under GPLv3 in their /LICENSE file, which states the following: The Python code and integrated HTML are licensed under the GPLv3 license. (See: https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE or http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE for an online copy of that LICENSE file) Conservancy reviewed these changes and confirmed that they can be licensed as a whole to the Kallithea project under GPLv3-only. While some of the contents committed herein are clearly licensed GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the statement above from RhodeCode indicates that they intend GPLv3-only as their license, per GPLv3ยง14 and other relevant sections of GPLv3.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:03:13 -0400
parents 91f440a11b94
children 7e5f8c12a3fc
comparison
equal deleted inserted replaced
4115:8b7294a804a0 4116:ffd45b185016
1 import time 1 import time
2 import datetime 2 import datetime
3 import posixpath 3 import posixpath
4 import stat
4 from dulwich import objects 5 from dulwich import objects
5 from dulwich.repo import Repo 6 from dulwich.repo import Repo
6 from rhodecode.lib.vcs.backends.base import BaseInMemoryChangeset 7 from rhodecode.lib.vcs.backends.base import BaseInMemoryChangeset
7 from rhodecode.lib.vcs.exceptions import RepositoryError 8 from rhodecode.lib.vcs.exceptions import RepositoryError
8 from rhodecode.lib.vcs.utils import safe_str 9 from rhodecode.lib.vcs.utils import safe_str
36 37
37 repo = self.repository._repo 38 repo = self.repository._repo
38 object_store = repo.object_store 39 object_store = repo.object_store
39 40
40 ENCODING = "UTF-8" 41 ENCODING = "UTF-8"
41 DIRMOD = 040000
42 42
43 # Create tree and populates it with blobs 43 # Create tree and populates it with blobs
44 commit_tree = self.parents[0] and repo[self.parents[0]._commit.tree] or\ 44 commit_tree = self.parents[0] and repo[self.parents[0]._commit.tree] or\
45 objects.Tree() 45 objects.Tree()
46 for node in self.added + self.changed: 46 for node in self.added + self.changed:
81 curtree = objects.Tree() 81 curtree = objects.Tree()
82 curtree[node_path] = node.mode, blob.id 82 curtree[node_path] = node.mode, blob.id
83 new_trees.append(curtree) 83 new_trees.append(curtree)
84 for dirname in reversed_dirnames[:-1]: 84 for dirname in reversed_dirnames[:-1]:
85 newtree = objects.Tree() 85 newtree = objects.Tree()
86 #newtree.add(DIRMOD, dirname, curtree.id) 86 #newtree.add(stat.S_IFDIR, dirname, curtree.id)
87 newtree[dirname] = DIRMOD, curtree.id 87 newtree[dirname] = stat.S_IFDIR, curtree.id
88 new_trees.append(newtree) 88 new_trees.append(newtree)
89 curtree = newtree 89 curtree = newtree
90 parent[reversed_dirnames[-1]] = DIRMOD, curtree.id 90 parent[reversed_dirnames[-1]] = stat.S_IFDIR, curtree.id
91 else: 91 else:
92 parent.add(name=node_path, mode=node.mode, hexsha=blob.id) 92 parent.add(name=node_path, mode=node.mode, hexsha=blob.id)
93 93
94 new_trees.append(parent) 94 new_trees.append(parent)
95 # Update ancestors 95 # Update ancestors
96 for parent, tree, path in reversed([(a[1], b[1], b[0]) for a, b in 96 for parent, tree, path in reversed([(a[1], b[1], b[0]) for a, b in
97 zip(ancestors, ancestors[1:])]): 97 zip(ancestors, ancestors[1:])]):
98 parent[path] = DIRMOD, tree.id 98 parent[path] = stat.S_IFDIR, tree.id
99 object_store.add_object(tree) 99 object_store.add_object(tree)
100 100
101 object_store.add_object(blob) 101 object_store.add_object(blob)
102 for tree in new_trees: 102 for tree in new_trees:
103 object_store.add_object(tree) 103 object_store.add_object(tree)
190 parent = root_tree 190 parent = root_tree
191 for dirname in dirs: 191 for dirname in dirs:
192 tree = get_tree_for_dir(parent, dirname) 192 tree = get_tree_for_dir(parent, dirname)
193 if tree is None: 193 if tree is None:
194 tree = objects.Tree() 194 tree = objects.Tree()
195 dirmode = 040000 195 parent.add(stat.S_IFDIR, dirname, tree.id)
196 parent.add(dirmode, dirname, tree.id)
197 parent = tree 196 parent = tree
198 # Always append tree 197 # Always append tree
199 trees.append(tree) 198 trees.append(tree)
200 return trees 199 return trees