[Pkg-bazaar-commits] ./bzr-gtk/unstable r125: Merge from trunk. "Thanks Aaron" revision.

Szilveszter Farkas (Phanatic) Szilveszter.Farkas at gmail.com
Fri Apr 10 07:45:38 UTC 2009


------------------------------------------------------------
revno: 125
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: bzr-gtk
timestamp: Wed 2006-12-20 10:13:44 +0100
message:
  Merge from trunk. "Thanks Aaron" revision.
modified:
  __init__.py
  annotate/gannotate.py
  olive/__init__.py
  olive/info_helper.py
    ------------------------------------------------------------
    revno: 66.2.14
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr-gtk
    timestamp: Fri 2006-12-15 13:32:34 -0500
    message:
      Annotate showing uncommitted changes
    modified:
      __init__.py
      annotate/gannotate.py
    ------------------------------------------------------------
    revno: 66.2.15
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr-gtk
    timestamp: Fri 2006-12-15 17:26:25 -0500
    message:
      fix future revno
    modified:
      annotate/gannotate.py
    ------------------------------------------------------------
    revno: 66.2.16
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: bzr-gtk-meld
    timestamp: Tue 2006-12-19 20:45:49 -0500
    message:
      Merge from mainline
    modified:
      olive.glade
      olive/__init__.py
      olive/bookmark.py
      olive/menu.py
      olive/remove.py
        ------------------------------------------------------------
        revno: 66.4.1
        committer: Jelmer Vernooij <jelmer at samba.org>
        branch nick: trunk
        timestamp: Sun 2006-12-17 15:57:24 +0100
        message:
          Merge some bugfixes from Szilveszter.
        modified:
          olive/__init__.py
          olive/menu.py
          olive/remove.py
        ------------------------------------------------------------
        revno: 66.4.2
        committer: Jelmer Vernooij <jelmer at samba.org>
        branch nick: trunk
        timestamp: Mon 2006-12-18 02:16:27 +0100
        message:
          Merge another fix.
        modified:
          olive/__init__.py
          olive/bookmark.py
          olive/menu.py
          olive/remove.py
        ------------------------------------------------------------
        revno: 66.4.3
        committer: Jelmer Vernooij <jelmer at samba.org>
        branch nick: trunk
        timestamp: Tue 2006-12-19 14:25:30 +0100
        message:
          Merge Fixes from Szilvester.
        modified:
          olive.glade
          olive/__init__.py
    ------------------------------------------------------------
    revno: 66.2.17
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: bzr-gtk-meld
    timestamp: Tue 2006-12-19 21:06:04 -0500
    message:
      Update olive to use current bzr.dev API.  Used _repo_relpath.  Bad phanatic!
    modified:
      olive/__init__.py
      olive/info_helper.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2006-12-13 13:15:03 +0000
+++ b/__init__.py	2006-12-15 18:32:34 +0000
@@ -178,8 +178,10 @@
             if len(revision) != 1:
                 raise BzrCommandError("Only 1 revion may be specified.")
             revision_id = revision[0].in_history(branch).rev_id
+            tree = branch.repository.revision_tree(revision_id)
         else:
             revision_id = None
+            tree = wt
 
         window = GAnnotateWindow(all, plain)
         window.connect("destroy", lambda w: gtk.main_quit())
@@ -188,7 +190,7 @@
         window.show()
         branch.lock_read()
         try:
-            window.annotate(branch, file_id, revision_id)
+            window.annotate(tree, branch, file_id)
         finally:
             branch.unlock()
         window.jump_to_line(line)

=== modified file 'annotate/gannotate.py'
--- a/annotate/gannotate.py	2006-12-13 13:06:49 +0000
+++ b/annotate/gannotate.py	2006-12-15 22:26:25 +0000
@@ -24,7 +24,7 @@
 
 from bzrlib import tsort
 from bzrlib.errors import NoSuchRevision
-from bzrlib.revision import NULL_REVISION
+from bzrlib.revision import NULL_REVISION, CURRENT_REVISION
 
 from colormap import AnnotateColorMap, AnnotateColorSaturation
 from logview import LogView
@@ -58,12 +58,14 @@
         if self.plain:
             self.span_selector.hide()
 
-    def annotate(self, branch, file_id, revision_id=None):
+    def annotate(self, tree, branch, file_id):
         self.revisions = {}
         self.annotations = []
         self.branch = branch
+        self.tree = tree
         self.file_id = file_id
-        self.revision_id = revision_id
+        self.revision_id = getattr(tree, 'get_revision_id', 
+                                   lambda: CURRENT_REVISION)()
         
         # [revision id, line number, committer, revno, highlight color, line]
         self.annomodel = gtk.ListStore(gobject.TYPE_STRING,
@@ -78,7 +80,7 @@
             branch.lock_read()
             branch.repository.lock_read()
             for line_no, (revision, revno, line)\
-                    in enumerate(self._annotate(branch, file_id, revision_id)):
+                    in enumerate(self._annotate(tree, file_id)):
                 if revision.revision_id == last_seen and not self.all:
                     revno = committer = ""
                 else:
@@ -136,18 +138,20 @@
             dotted[revision_id] = '.'.join(str(num) for num in revno)
         return dotted
 
-    def _annotate(self, branch, file_id, revision_id):
-        repository = branch.repository
-        if revision_id is None:
-            revision_id = branch.last_revision()
+    def _annotate(self, tree, file_id):
+        current_revision = FakeRevision(CURRENT_REVISION)
+        current_revision.committer = self.branch.get_config().username()
+        current_revision.timestamp = time.time()
+        current_revision.message = '[Not yet committed]'
+        current_revno = '%d?' % (self.branch.revno() + 1)
+        repository = self.branch.repository
+        if self.revision_id == CURRENT_REVISION:
+            revision_id = self.branch.last_revision()
+        else:
+            revision_id = self.revision_id
         dotted = self._dotted_revnos(repository, revision_id)
-        rev_tree = repository.revision_tree(revision_id)
-        revision_id = rev_tree.inventory[file_id].revision
-        weave = repository.weave_store.get_weave(file_id,
-                                                 branch.get_transaction())
-        
         revision_cache = RevisionCache(repository)
-        for origin, text in weave.annotate_iter(revision_id):
+        for origin, text in tree.annotate_iter(file_id):
             rev_id = origin
             try:
                 revision = revision_cache.get_revision(rev_id)
@@ -155,8 +159,13 @@
                 if len(revno) > 15:
                     revno = 'merge'
             except NoSuchRevision:
-                revision = NoneRevision(rev_id)
-                revno = "?"
+                committer = "?"
+                if rev_id == CURRENT_REVISION:
+                    revision = current_revision
+                    revno = current_revno
+                else:
+                    revision = FakeRevision(rev_id)
+                    revno = "?"
 
             yield revision, revno, text
 
@@ -228,11 +237,15 @@
         row = path[0]
         revision = self.annotations[row]
         repository = self.branch.repository
-        tree1 = repository.revision_tree(revision.revision_id)
-        if len(revision.parent_ids) > 0:
-            tree2 = repository.revision_tree(revision.parent_ids[0])
+        if revision.revision_id == CURRENT_REVISION:
+            tree1 = self.tree
+            tree2 = self.tree.basis_tree()
         else:
-            tree2 = repository.revision_tree(NULL_REVISION)
+            tree1 = repository.revision_tree(revision.revision_id)
+            if len(revision.parent_ids) > 0:
+                tree2 = repository.revision_tree(revision.parent_ids[0])
+            else:
+                tree2 = repository.revision_tree(NULL_REVISION)
         from bzrlib.plugins.gtk.viz.diffwin import DiffWindow
         window = DiffWindow()
         window.set_diff("Diff for row %d" % (row+1), tree1, tree2)
@@ -325,16 +338,16 @@
         return box
 
 
-class NoneRevision:
+class FakeRevision:
     """ A fake revision.
 
     For when a revision is referenced but not present.
     """
 
-    def __init__(self, revision_id):
+    def __init__(self, revision_id, committer='?'):
         self.revision_id = revision_id
         self.parent_ids = []
-        self.committer = "?"
+        self.committer = committer
         self.message = "?"
         self.timestamp = 0.0
         self.timezone = 0

=== modified file 'olive/__init__.py'
--- a/olive/__init__.py	2006-12-18 10:34:36 +0000
+++ b/olive/__init__.py	2006-12-20 02:06:04 +0000
@@ -348,7 +348,6 @@
         
         branch = self.wt.branch
         file_id = self.wt.path2id(self.wt.relpath(os.path.join(self.path, self.get_selected_right())))
-        revision_id = None
         
         window = GAnnotateWindow(all=False, plain=False)
         window.set_title(os.path.join(self.path, self.get_selected_right()) + " - Annotate")
@@ -356,7 +355,7 @@
         window.show()
         branch.lock_read()
         try:
-            window.annotate(branch, file_id, revision_id)
+            window.annotate(self.wt, branch, file_id)
         finally:
             branch.unlock()
     

=== modified file 'olive/info_helper.py'
--- a/olive/info_helper.py	2006-09-25 01:58:44 +0000
+++ b/olive/info_helper.py	2006-12-20 02:06:04 +0000
@@ -22,7 +22,7 @@
 
 import bzrlib.osutils as osutils
 
-from bzrlib.info import _repo_relpath
+from bzrlib.info import _repo_rel_url
 from bzrlib.missing import find_unmerged
 
 def get_location_info(repository, branch=None, working=None):
@@ -41,14 +41,14 @@
             if repository.is_shared():
                 # lightweight checkout of branch in shared repository
                 ret['sharedrepo'] = repository_path
-                ret['repobranch'] = _repo_relpath(repository_path, branch_path)
+                ret['repobranch'] = _repo_rel_url(repository_path, branch_path)
             else:
                 # lightweight checkout of standalone branch
                 ret['cobranch'] = branch_path
         elif repository.is_shared():
             # branch with tree inside shared repository
             ret['sharedrepo'] = repository_path
-            ret['repoco'] = _repo_relpath(repository_path, branch_path)
+            ret['repoco'] = _repo_rel_url(repository_path, branch_path)
         elif branch.get_bound_location():
             # normal checkout
             ret['coroot'] = working_path
@@ -61,7 +61,7 @@
         if repository.is_shared():
             # branch is part of shared repository
             ret['sharedrepo'] = repository_path
-            ret['repobranch'] = _repo_relpath(repository_path, branch_path)
+            ret['repobranch'] = _repo_rel_url(repository_path, branch_path)
         else:
             # standalone branch
             ret['branchroot'] = branch_path



More information about the Pkg-bazaar-commits mailing list