/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to patches/pending-merge.patch

  • Committer: Martin Pool
  • Date: 2005-06-28 03:02:31 UTC
  • Revision ID: mbp@sourcefrog.net-20050628030231-d311e4ebcd467ef4
Merge John's import-speedup branch:

                                                                                         
  777 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 22:20:32 -0500
      revision-id: john@arbash-meinel.com-20050627032031-e82a50db3863b18e
      bzr selftest was not using the correct bzr

  776 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 22:20:22 -0500
      revision-id: john@arbash-meinel.com-20050627032021-c9f21fde989ddaee
      Add was using an old mutter

  775 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 22:02:33 -0500
      revision-id: john@arbash-meinel.com-20050627030233-9165cfe98fc63298
      Cleaned up to be less different

  774 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:54:53 -0500
      revision-id: john@arbash-meinel.com-20050627025452-4260d0e744edef43
      Allow BZR_PLUGIN_PATH='' to negate plugin loading.

  773 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:49:34 -0500
      revision-id: john@arbash-meinel.com-20050627024933-b7158f67b7b9eae5
      Finished the previous cleanup (allowing load_plugins to be called twice)

  772 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:45:08 -0500
      revision-id: john@arbash-meinel.com-20050627024508-723b1df510d196fc
      Work on making the tests pass. versioning.py is calling run_cmd directly, but plugins have been loaded.

  771 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:32:29 -0500
      revision-id: john@arbash-meinel.com-20050627023228-79972744d7c53e15
      Got it down a little bit more by removing import of tree and inventory.

  770 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 21:26:05 -0500
      revision-id: john@arbash-meinel.com-20050627022604-350b9773ef622f95
      Reducing the number of import from bzrlib/__init__.py and bzrlib/branch.py

  769 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 20:32:25 -0500
      revision-id: john@arbash-meinel.com-20050627013225-32dd044f10d23948
      Updated revision.py and xml.py to include SubElement.

  768 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 20:03:56 -0500
      revision-id: john@arbash-meinel.com-20050627010356-ee66919e1c377faf
      Minor typo

  767 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 20:03:13 -0500
      revision-id: john@arbash-meinel.com-20050627010312-40d024007eb85051
      Caching the import

  766 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 19:51:47 -0500
      revision-id: john@arbash-meinel.com-20050627005147-5281c99e48ed1834
      Created wrapper functions for lazy import of ElementTree

  765 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 19:46:37 -0500
      revision-id: john@arbash-meinel.com-20050627004636-bf432902004a94c5
      Removed all of the test imports of cElementTree

  764 John Arbash Meinel <john@arbash-meinel.com>       Sun 2005-06-26 19:43:59 -0500
      revision-id: john@arbash-meinel.com-20050627004358-d137fbe9570dd71b
      Trying to make bzr startup faster.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
*** modified file 'bzrlib/merge.py'
2
 
--- bzrlib/merge.py 
3
 
+++ bzrlib/merge.py 
4
 
@@ -105,14 +105,21 @@
5
 
     location, revno = treespec
6
 
     branch = find_branch(location)
7
 
     if revno is None:
8
 
+        rev_id = None
9
 
+    elif revno == -1:
10
 
+        rev_id = branch.last_patch()
11
 
+    else:
12
 
+        rev_id = branch.lookup_revision(revno)
13
 
+    return branch, get_revid_tree(branch, rev_id, temp_root, label)
14
 
+
15
 
+def get_revid_tree(branch, rev_id, temp_root, label):
16
 
+    if rev_id is None:
17
 
         base_tree = branch.working_tree()
18
 
-    elif revno == -1:
19
 
-        base_tree = branch.basis_tree()
20
 
     else:
21
 
-        base_tree = branch.revision_tree(branch.lookup_revision(revno))
22
 
+        base_tree = branch.revision_tree(rev_id)
23
 
     temp_path = os.path.join(temp_root, label)
24
 
     os.mkdir(temp_path)
25
 
-    return branch, MergeTree(base_tree, temp_path)
26
 
+    return MergeTree(base_tree, temp_path)
27
 
 
28
 
 
29
 
 def abspath(tree, file_id):
30
 
@@ -178,30 +185,68 @@
31
 
         If true, this_dir must have no uncommitted changes before the
32
 
         merge begins.
33
 
     """
34
 
+    from bzrlib.revision import common_ancestor, MultipleRevisionSources
35
 
+    from bzrlib.branch import NoSuchRevision
36
 
     tempdir = tempfile.mkdtemp(prefix="bzr-")
37
 
     try:
38
 
         if this_dir is None:
39
 
             this_dir = '.'
40
 
         this_branch = find_branch(this_dir)
41
 
+        this_rev_id = this_branch.last_patch()
42
 
+        if this_rev_id is None:
43
 
+            raise BzrCommandError("This branch has no commits")
44
 
         if check_clean:
45
 
             changes = compare_trees(this_branch.working_tree(), 
46
 
                                     this_branch.basis_tree(), False)
47
 
             if changes.has_changed():
48
 
                 raise BzrCommandError("Working tree has uncommitted changes.")
49
 
         other_branch, other_tree = get_tree(other_revision, tempdir, "other")
50
 
+        if other_revision[1] == -1:
51
 
+            other_rev_id = other_branch.last_patch()
52
 
+            other_basis = other_rev_id
53
 
+        elif other_revision[1] is not None:
54
 
+            other_rev_id = other_branch.lookup_revision(other_revision[1])
55
 
+            other_basis = other_rev_id
56
 
+        else:
57
 
+            other_rev_id = None
58
 
+            other_basis = other_branch.last_patch()
59
 
         if base_revision == [None, None]:
60
 
             if other_revision[1] == -1:
61
 
                 o_revno = None
62
 
             else:
63
 
                 o_revno = other_revision[1]
64
 
-            base_revno = this_branch.common_ancestor(other_branch, 
65
 
-                                                     other_revno=o_revno)[0]
66
 
-            if base_revno is None:
67
 
+            base_rev_id = common_ancestor(this_rev_id, other_basis,
68
 
+                                          MultipleRevisionSources(this_branch, 
69
 
+                                          other_branch))
70
 
+            if base_rev_id is None:
71
 
                 raise UnrelatedBranches()
72
 
-            base_revision = ['.', base_revno]
73
 
-        base_branch, base_tree = get_tree(base_revision, tempdir, "base")
74
 
+            try:
75
 
+                base_revision = this_branch.get_revision(base_rev_id)
76
 
+                base_branch = this_branch
77
 
+            except NoSuchRevision:
78
 
+                base_branch = other_branch
79
 
+            base_tree = get_revid_tree(base_branch, base_rev_id, tempdir, 
80
 
+                                       "base")
81
 
+            base_is_ancestor = True
82
 
+        else:
83
 
+            base_branch, base_tree = get_tree(base_revision, tempdir, "base")
84
 
+            if base_revision[1] == -1:
85
 
+                base_rev_id = base_branch.last_patch()
86
 
+            elif base_revision[1] is None:
87
 
+                base_rev_id = None
88
 
+            else:
89
 
+                base_rev_id = base_branch.lookup_revision(base_revision[1])
90
 
+            if base_rev_id is not None:
91
 
+                base_is_ancestor = is_ancestor(this_rev_id, base_rev_id, 
92
 
+                                               MultipleRevisionSources(
93
 
+                                               this_branch, 
94
 
+                                               base_branch))
95
 
+            else:
96
 
+                base_is_ancestor = False
97
 
         merge_inner(this_branch, other_tree, base_tree, tempdir, 
98
 
                     ignore_zero=ignore_zero)
99
 
+        if base_is_ancestor and other_rev_id is not None:
100
 
+            this_branch.add_pending_merge(other_rev_id)
101
 
     finally:
102
 
         shutil.rmtree(tempdir)
103
 
 
104