Rev 1868: Only create hidden commit when pushing an already existing branch. in file:///data/jelmer/bzr-svn/trunk/

Jelmer Vernooij jelmer at samba.org
Mon Sep 8 20:29:56 BST 2008


At file:///data/jelmer/bzr-svn/trunk/

------------------------------------------------------------
revno: 1868
revision-id: jelmer at samba.org-20080908192954-zi11666gqe03t4b9
parent: jelmer at samba.org-20080908192700-somwjj4s32aanxli
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Mon 2008-09-08 21:29:54 +0200
message:
  Only create hidden commit when pushing an already existing branch.
modified:
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
=== modified file 'commit.py'
--- a/commit.py	2008-09-08 19:27:00 +0000
+++ b/commit.py	2008-09-08 19:29:54 +0000
@@ -672,6 +672,12 @@
     fileprops = dict(revmeta.get_fileprops().items())
     mapping.export_hidden(revprops, fileprops)
     parent = urlutils.dirname(branch_path)
+
+    bp_parts = branch_path.split("/")
+    existing_bp_parts =_check_dirs_exist(repository.transport, bp_parts, -1)
+    if (len(bp_parts) not in (len(existing_bp_parts), len(existing_bp_parts)+1)):
+        raise MissingPrefix("/".join(bp_parts), "/".join(existing_bp_parts))
+
     conn = repository.transport.get_connection(parent)
     try:
         ci = conn.get_commit_editor(revprops)
@@ -716,8 +722,12 @@
         start_revid_parent = rev.parent_ids[0]
     # If this is just intended to create a new branch
     mapping = target_repository.get_mapping()
-    if (stop_revision != NULL_REVISION and stop_revision == start_revid and mapping.supports_hidden):
-        create_branch_with_hidden_commit(target_repository, target_branch_path, start_revid, mapping)
+    if (start_revid != NULL_REVISION and start_revid_parent != NULL_REVISION and stop_revision == start_revid and mapping.supports_hidden):
+        if target_repository.has_revision(start_revid) or start_revid == NULL_REVISION:
+            revid = start_revid
+        else:
+            revid = start_revid_parent
+        create_branch_with_hidden_commit(target_repository, target_branch_path, revid, mapping)
     else:
         return push_revision_tree(graph, target_repository, target_branch_path, 
                               target_repository.get_config(), 




More information about the bazaar-commits mailing list