Rev 2408: Add get_symlink_target in base WorkingTree in http://sourcefrog.net/bzr/dirstate

Martin Pool mbp at sourcefrog.net
Mon Feb 26 03:13:11 GMT 2007


At http://sourcefrog.net/bzr/dirstate

------------------------------------------------------------
revno: 2408
revision-id: mbp at sourcefrog.net-20070226031310-7alk7pvlb8fg0asn
parent: mbp at sourcefrog.net-20070226025624-4cfvc1r2it0oxxt2
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: dirstate
timestamp: Mon 2007-02-26 14:13:10 +1100
message:
  Add get_symlink_target in base WorkingTree
modified:
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2007-02-26 02:56:24 +0000
+++ b/bzrlib/workingtree.py	2007-02-26 03:13:10 +0000
@@ -470,6 +470,10 @@
     def get_file_byname(self, filename):
         return file(self.abspath(filename), 'rb')
 
+    def get_symlink_target(self, file_id):
+        file_id = osutils.safe_file_id(file_id)
+        return os.readlink(self.abspath(self.id2path(file_id)))
+
     @needs_read_lock
     def annotate_iter(self, file_id):
         """See Tree.annotate_iter

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-02-26 01:32:38 +0000
+++ b/bzrlib/workingtree_4.py	2007-02-26 03:13:10 +0000
@@ -389,6 +389,8 @@
     def id2path(self, file_id):
         file_id = osutils.safe_file_id(file_id)
         state = self.current_dirstate()
+        # XXX: possible_dir_name_ids is unused - is this just called for
+        # side-effects? mbp 20070226
         possible_dir_name_ids = state._get_id_index().get(file_id, None)
         entry = self._get_entry(file_id=file_id)
         if entry == (None, None):
@@ -1079,7 +1081,6 @@
             wt.unlock()
         return wt
 
-
     def _open(self, a_bzrdir, control_files):
         """Open the tree itself.
 




More information about the bazaar-commits mailing list