[Pkg-bazaar-commits] ./bzr-git/unstable r46: merge 0.3.1.
Jelmer Vernooij
jelmer at samba.org
Wed May 13 13:00:40 UTC 2009
------------------------------------------------------------
revno: 46
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: unstable
timestamp: Wed 2009-05-13 15:00:40 +0200
message:
merge 0.3.1.
modified:
NEWS
__init__.py
commands.py
debian/changelog
debian/control
fetch.py
mapping.py
object_store.py
server.py
setup.py
shamap.py
------------------------------------------------------------
revno: 17.1.467
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2009-05-12 04:47:54 +0200
message:
Cope with kind changes.
modified:
fetch.py
------------------------------------------------------------
revno: 17.1.468
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2009-05-12 15:41:49 +0200
message:
Use ObjectStore to find revision SHA1s rather than 'simple' looups.
modified:
server.py
------------------------------------------------------------
revno: 17.1.469
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2009-05-12 15:44:44 +0200
message:
Fix NameError.
modified:
server.py
------------------------------------------------------------
revno: 17.1.470
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2009-05-12 16:33:01 +0200
message:
Prevent deep recursion if the shamap is out of date.
modified:
object_store.py
shamap.py
------------------------------------------------------------
revno: 17.1.471
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2009-05-12 16:39:53 +0200
message:
Fix git-import.
modified:
commands.py
------------------------------------------------------------
revno: 17.1.472
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2009-05-12 16:43:10 +0200
message:
remove unused imports.
modified:
server.py
------------------------------------------------------------
revno: 17.1.473
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Wed 2009-05-13 01:14:09 +0200
message:
Warn about unusual modes and escaped XML-invalid characters.
modified:
fetch.py
mapping.py
------------------------------------------------------------
revno: 17.1.474
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Wed 2009-05-13 14:41:07 +0200
message:
Cope with map for Tree objects becoming invalid.
modified:
object_store.py
------------------------------------------------------------
revno: 17.1.475
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Wed 2009-05-13 14:44:34 +0200
message:
Update NEWS.
modified:
NEWS
------------------------------------------------------------
revno: 17.1.476
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Wed 2009-05-13 14:46:08 +0200
message:
Update NEWS.
modified:
NEWS
------------------------------------------------------------
revno: 17.1.477
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Wed 2009-05-13 14:46:24 +0200
message:
release 0.3.1
modified:
__init__.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2009-05-12 00:16:19 +0000
+++ b/NEWS 2009-05-13 12:46:08 +0000
@@ -1,4 +1,4 @@
-0.3.1 UNRELEASED
+0.3.1 2009-05-13
FEATURES
@@ -7,6 +7,18 @@
TDB and its Python bindings installed. In all other situations the previous
(slower) Sqlite database format will be used.
+ * Now warns when escaping XML-invalid characters to work around a bug in the
+ Bazaar revision serializer.
+
+ * Now allows "unusual" file modes (100664, etc) but will warn the user about
+ them.
+
+ BUG FIXES
+
+ * Fixed git-import.
+
+ * Fixed handling kind changes (tree -> blob) during fetch.
+
0.3.0 2009-05-10
FEATURES
=== modified file '__init__.py'
--- a/__init__.py 2009-05-11 19:32:52 +0000
+++ b/__init__.py 2009-05-13 12:46:24 +0000
@@ -55,7 +55,7 @@
# versions ending in 'exp' mean experimental mappings
# versions ending in 'dev' mean development version
# versions ending in 'final' mean release (well tested, etc)
-version_info = (0, 3, 1, 'dev', 0)
+version_info = (0, 3, 1, 'final', 0)
if version_info[3] == 'final':
version_string = '%d.%d.%d' % version_info[:3]
=== modified file 'commands.py'
--- a/commands.py 2009-05-08 16:11:15 +0000
+++ b/commands.py 2009-05-12 14:39:53 +0000
@@ -130,7 +130,8 @@
head_branch = head_bzrdir.create_branch()
revid = mapping.revision_id_foreign_to_bzr(ref)
source_branch = GitBranch(source_repo.bzrdir, source_repo,
- name, ref, None)
+ name, None)
+ source_branch.head = ref
head_branch.generate_revision_history(revid)
source_branch.tags.merge_to(head_branch.tags)
finally:
=== modified file 'debian/changelog'
--- a/debian/changelog 2009-05-12 00:21:21 +0000
+++ b/debian/changelog 2009-05-13 13:00:40 +0000
@@ -1,4 +1,4 @@
-bzr-git (0.3.1~bzr483-1) UNRELEASED; urgency=low
+bzr-git (0.3.1-1) unstable; urgency=low
* New upstream snapshot.
=== modified file 'debian/control'
--- a/debian/control 2009-05-12 00:20:59 +0000
+++ b/debian/control 2009-05-13 13:00:40 +0000
@@ -3,7 +3,7 @@
Priority: optional
Maintainer: Debian Bazaar Maintainers <pkg-bazaar-maint at lists.alioth.debian.org>
Uploaders: Jelmer Vernooij <jelmer at debian.org>
-Build-Depends: debhelper (>= 5.0.37.2), cdbs (>= 0.4.43), python, python-central (>= 0.5), python-dulwich (>= 0.2.0~), python-tdb
+Build-Depends: debhelper (>= 5.0.37.2), cdbs (>= 0.4.43), python, python-central (>= 0.5), python-dulwich (>= 0.3.1~), python-tdb
Build-Depends-Indep: bzr (>= 1.14~)
Standards-Version: 3.8.1
Homepage: http://bazaar-vcs.org/BzrForeignBranches/Git
@@ -12,7 +12,7 @@
Package: bzr-git
Architecture: all
-Depends: bzr (>= 1.14~), ${python:Depends}, ${misc:Depends}, python-dulwich (>= 0.3.0~), python-tdb
+Depends: bzr (>= 1.14~), ${python:Depends}, ${misc:Depends}, python-dulwich (>= 0.3.1~), python-tdb
XB-Python-Version: ${python:Versions}
Description: Bazaar plugin providing readonly Git integration
This is a plugin for Bazaar that adds the ability to read and write Git
=== modified file 'fetch.py'
--- a/fetch.py 2009-05-12 00:16:19 +0000
+++ b/fetch.py 2009-05-12 23:14:09 +0000
@@ -65,6 +65,7 @@
DEFAULT_FILE_MODE,
inventory_to_tree_and_blobs,
text_to_blob,
+ warn_unusual_mode,
)
from bzrlib.plugins.git.object_store import (
BazaarObjectStore,
@@ -115,7 +116,7 @@
and base_ie.kind == ie.kind):
# If nothing has changed since the base revision, we're done
return [], []
- if base_sha == hexsha:
+ if base_sha == hexsha and base_ie.kind == ie.kind:
ie.text_size = base_ie.text_size
ie.text_sha1 = base_ie.text_sha1
ie.symlink_target = base_ie.symlink_target
@@ -216,18 +217,17 @@
shamap.extend(subshamap)
else:
fs_mode = stat.S_IMODE(mode)
- symlink = stat.S_ISLNK(mode)
subinvdelta, subshamap = import_git_blob(texts, mapping,
child_path, child_hexsha, base_inv, file_id, revision_id,
parent_invs, shagitmap, lookup_object,
- bool(fs_mode & 0111), symlink)
+ bool(fs_mode & 0111), stat.S_ISLNK(mode))
invdelta.extend(subinvdelta)
shamap.extend(subshamap)
if mode not in (stat.S_IFDIR, DEFAULT_FILE_MODE,
stat.S_IFLNK, DEFAULT_FILE_MODE|0111):
child_modes[child_path] = mode
# Remove any children that have disappeared
- if base_ie is not None:
+ if base_ie is not None and base_ie.kind == 'directory':
deletable = [v for k,v in base_ie.children.iteritems() if k not in existing_children]
while deletable:
ie = deletable.pop()
@@ -309,10 +309,8 @@
parent_invs, target_git_object_retriever._idmap, lookup_object)
target_git_object_retriever._idmap.add_entries(shamap)
if unusual_modes != {}:
- ret = "unusual modes: \n"
- for item in unusual_modes.iteritems():
- ret += "\t%s: %o\n" % item
- raise AssertionError(ret)
+ for path, mode in unusual_modes.iteritems():
+ warn_unusual_mode(rev.foreign_revid, path, mode)
try:
basis_id = rev.parent_ids[0]
except IndexError:
@@ -383,25 +381,21 @@
def progress(text):
pb.update("git: %s" % text.rstrip("\r\n"), 0, 0)
store = BazaarObjectStore(self.target, mapping)
- self.target.lock_read()
+ self.target.lock_write()
try:
heads = self.target.get_graph().heads(self.target.all_revision_ids())
- finally:
- self.target.unlock()
- graph_walker = store.get_graph_walker(
- [store._lookup_revision_sha1(head) for head in heads])
- create_pb = None
- if pb is None:
- create_pb = pb = ui.ui_factory.nested_progress_bar()
- recorded_wants = []
+ graph_walker = store.get_graph_walker(
+ [store._lookup_revision_sha1(head) for head in heads])
+ recorded_wants = []
- def record_determine_wants(heads):
- wants = determine_wants(heads)
- recorded_wants.extend(wants)
- return wants
+ def record_determine_wants(heads):
+ wants = determine_wants(heads)
+ recorded_wants.extend(wants)
+ return wants
- try:
- self.target.lock_write()
+ create_pb = None
+ if pb is None:
+ create_pb = pb = ui.ui_factory.nested_progress_bar()
try:
self.target.start_write_group()
try:
@@ -413,10 +407,10 @@
finally:
self.target.commit_write_group()
finally:
- self.target.unlock()
+ if create_pb:
+ create_pb.finished()
finally:
- if create_pb:
- create_pb.finished()
+ self.target.unlock()
@staticmethod
def is_compatible(source, target):
=== modified file 'mapping.py'
--- a/mapping.py 2009-05-08 14:15:57 +0000
+++ b/mapping.py 2009-05-12 23:14:09 +0000
@@ -24,6 +24,7 @@
errors,
foreign,
osutils,
+ trace,
urlutils,
)
from bzrlib.inventory import (
@@ -69,6 +70,16 @@
return "%s <%s>" % (text, text)
+def warn_escaped(commit, num_escaped):
+ trace.warning("Escaped %d XML-invalid characters in %s. Will be unable "
+ "to regenerate the SHA map.", num_escaped, commit)
+
+
+def warn_unusual_mode(commit, path, mode):
+ trace.warning("Unusual file mode %o for %s in %s. Will be unable to "
+ "regenerate the SHA map.", mode, path, commit)
+
+
class BzrGitMapping(foreign.VcsMapping):
"""Class that maps between Git and Bazaar semantics."""
experimental = False
@@ -112,10 +123,16 @@
raise AssertionError("Commit object can't be None")
rev = ForeignRevision(commit.id, self, self.revision_id_foreign_to_bzr(commit.id))
rev.parent_ids = tuple([self.revision_id_foreign_to_bzr(p) for p in commit.parents])
- rev.message = escape_invalid_chars(commit.message.decode("utf-8", "replace"))[0]
- rev.committer = escape_invalid_chars(str(commit.committer).decode("utf-8", "replace"))[0]
+ rev.message, num_escaped = escape_invalid_chars(commit.message.decode("utf-8", "replace"))
+ if num_escaped:
+ warn_escaped(commit.id, num_escaped)
+ rev.committer, num_escaped = escape_invalid_chars(str(commit.committer).decode("utf-8", "replace"))
+ if num_escaped:
+ warn_escaped(commit.id, num_escaped)
if commit.committer != commit.author:
- rev.properties['author'] = escape_invalid_chars(str(commit.author).decode("utf-8", "replace"))[0]
+ rev.properties['author'], num_escaped = escape_invalid_chars(str(commit.author).decode("utf-8", "replace"))
+ if num_escaped:
+ warn_escaped(commit.id, num_escaped)
if commit.commit_time != commit.author_time:
rev.properties['author-timestamp'] = str(commit.author_time)
=== modified file 'object_store.py'
--- a/object_store.py 2009-05-11 12:17:14 +0000
+++ b/object_store.py 2009-05-13 12:41:07 +0000
@@ -98,7 +98,7 @@
tree_sha = self._get_ie_sha1(inv.root, inv)
rev = self.repository.get_revision(revid)
commit_obj = revision_to_commit(rev, tree_sha,
- self._idmap._parent_lookup)
+ self._idmap.lookup_commit)
try:
foreign_revid, mapping = mapping_registry.parse_revision_id(revid)
except errors.InvalidRevisionId:
@@ -185,13 +185,10 @@
def _lookup_revision_sha1(self, revid):
"""Return the SHA1 matching a Bazaar revision."""
try:
- return self._idmap._parent_lookup(revid)
+ return self._idmap.lookup_commit(revid)
except KeyError:
- inv = self.repository.get_inventory(revid)
- tree_sha = self._get_ie_sha1(inv.root, inv)
- ret = self._get_commit(revid, tree_sha).id
- self._idmap.add_entry(ret, "commit", (revid, tree_sha))
- return ret
+ self._update_sha_map(revid)
+ return self._idmap.lookup_commit(revid)
def get_raw(self, sha):
"""Get the raw representation of a Git object by SHA1.
@@ -232,6 +229,10 @@
elif type == "blob":
return self._get_blob(type_data[0], type_data[1], expected_sha=sha)
elif type == "tree":
- return self._get_tree(type_data[0], type_data[1], expected_sha=sha)
+ try:
+ return self._get_tree(type_data[0], type_data[1],
+ expected_sha=sha)
+ except errors.NoSuchRevision:
+ raise KeyError(sha)
else:
raise AssertionError("Unknown object type '%s'" % type)
=== modified file 'server.py'
--- a/server.py 2009-05-08 19:29:21 +0000
+++ b/server.py 2009-05-12 14:43:10 +0000
@@ -15,19 +15,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os
-import stat
import tempfile
-from bzrlib.bzrdir import (
- BzrDir,
- )
-from bzrlib.inventory import (
- InventoryDirectory,
- InventoryFile,
- )
-from bzrlib.osutils import (
- splitpath,
- )
from bzrlib.repository import (
Repository,
)
@@ -37,11 +26,9 @@
)
from bzrlib.plugins.git.mapping import (
default_mapping,
- inventory_to_tree_and_blobs,
- revision_to_commit,
)
from bzrlib.plugins.git.object_store import (
- BazaarObjectStore,
+ get_object_store
)
from dulwich.server import (
@@ -52,12 +39,6 @@
PackData,
write_pack_index_v2,
)
-from dulwich.objects import (
- Blob,
- Commit,
- ShaFile,
- Tree,
- )
class BzrBackend(Backend):
@@ -71,15 +52,14 @@
ret = {}
repo_dir = BzrDir.open(self.directory)
repo = repo_dir.open_repository()
+ store = get_object_store(repo)
branch = None
for branch in repo.find_branches(using=True):
#FIXME: Look for 'master' or 'trunk' in here, and set HEAD accordingly...
#FIXME: Need to get branch path relative to its repository and use this instead of nick
- rev, mapping = self.mapping.revision_id_bzr_to_foreign(branch.last_revision())
- ret["refs/heads/"+branch.nick] = rev
+ ret["refs/heads/"+branch.nick] = store._lookup_revision_sha1(branch.last_revision())
if 'HEAD' not in ret and branch:
- rev, mapping = self.mapping.revision_id_bzr_to_foreign(branch.last_revision())
- ret['HEAD'] = rev
+ ret['HEAD'] = store._lookup_revision_sha1(branch.last_revision())
return ret
def apply_pack(self, refs, read):
@@ -141,7 +121,8 @@
repo.lock_read()
try:
store = BazaarObjectStore(repo)
- missing_sha1s = store.find_missing_objects(wants, graphwalker, progress)
- return (len(missing_sha1s), iter(store.iter_shas(missing_sha1s)))
+ have = store.find_missing_revisions(graph_walker)
+ missing_sha1s = store.find_missing_objects(have, wants, progress)
+ return self.object_store.iter_shas(missing_sha1s)
finally:
repo.unlock()
=== modified file 'setup.py'
--- a/setup.py 2009-05-10 14:15:58 +0000
+++ b/setup.py 2009-05-13 13:00:40 +0000
@@ -10,6 +10,7 @@
keywords='plugin bzr git bazaar',
version=version_string,
url='http://bazaar-vcs.org/BzrForeignBranches/Git',
+ download_url='http://samba.org/~jelmer/bzr/bzr-git-%s.tar.gz' % version_string,
license='GPL',
maintainer='Jelmer Vernooij',
maintainer_email='jelmer at samba.org',
=== modified file 'shamap.py'
--- a/shamap.py 2009-05-12 00:20:59 +0000
+++ b/shamap.py 2009-05-13 13:00:40 +0000
@@ -159,7 +159,7 @@
def from_repository(cls, repository):
return cls(os.path.join(repository._transport.local_abspath("."), "git.db"))
- def _parent_lookup(self, revid):
+ def lookup_commit(self, revid):
row = self.db.execute("select sha1 from commits where revid = ?", (revid,)).fetchone()
if row is not None:
return row[0].encode("utf-8")
@@ -281,7 +281,7 @@
from bzrlib.config import config_dir
return cls(os.path.join(config_dir(), "remote-git.tdb"))
- def _parent_lookup(self, revid):
+ def lookup_commit(self, revid):
return self.db["commit %s" % revid].split(" ")[0]
def commit(self):
More information about the Pkg-bazaar-commits
mailing list