Rev 1498: Simplify arguments to file id modification functions. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Wed Jul 23 20:29:56 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/trunk

------------------------------------------------------------
revno: 1498
revision-id: jelmer at samba.org-20080723192955-p8qqp896ijvql4sf
parent: jelmer at samba.org-20080723185739-qyj5t8x4db5cxxrp
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2008-07-23 21:29:55 +0200
message:
  Simplify arguments to file id modification functions.
modified:
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  fileids.py                     fileids.py-20060714013623-u5iiyqqnko11grcf-1
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
=== modified file 'fetch.py'
--- a/fetch.py	2008-07-21 20:17:38 +0000
+++ b/fetch.py	2008-07-23 19:29:55 +0000
@@ -113,10 +113,7 @@
         if self._id_map is not None:
             return self._id_map
 
-        renames = self.mapping.import_fileid_map(self.revmeta.revprops, self.revmeta.fileprops)
-        self._id_map = self.source.transform_fileid_map(self.source.uuid, 
-                              self.revnum, self.branch_path, self.revmeta.paths, renames, 
-                              self.mapping)
+        self._id_map = self.source.transform_fileid_map(self.source.uuid, self.revmeta, self.mapping)
 
         return self._id_map
 

=== modified file 'fileids.py'
--- a/fileids.py	2008-07-23 00:37:07 +0000
+++ b/fileids.py	2008-07-23 19:29:55 +0000
@@ -109,18 +109,16 @@
         self.apply_changes_fn = apply_changes_fn
         self.repos = repos
 
-    def apply_changes(self, uuid, revnum, branch, global_changes, 
-                      renames, mapping, find_children=None):
+    def apply_changes(self, uuid, revmeta, mapping, find_children=None):
         """Change file id map to incorporate specified changes.
 
         :param uuid: UUID of repository changes happen in
-        :param revnum: Revno for revision in which changes happened
-        :param branch: Branch path where changes happened
-        :param global_changes: Dict with global changes that happened
+        :param revmeta: RevisionMetadata object for revision with changes
         :param renames: List of renames (known file ids for particular paths)
         :param mapping: Mapping
         """
-        changes = get_local_changes(global_changes, branch, mapping,
+        renames = mapping.import_fileid_map(revmeta.revprops, revmeta.fileprops)
+        changes = get_local_changes(revmeta.paths, revmeta.branch_path, mapping,
                     self.repos.get_layout(),
                     self.repos.generate_revision_id, find_children)
         if find_children is not None:
@@ -132,7 +130,7 @@
             get_children = None
 
         def new_file_id(x):
-            return mapping.generate_file_id(uuid, revnum, branch, x)
+            return mapping.generate_file_id(uuid, revmeta.revnum, revmeta.branch_path, x)
          
         idmap = self.apply_changes_fn(new_file_id, changes, get_children)
         idmap.update(renames)
@@ -170,8 +168,7 @@
                     return self.repos._log.find_children(path, revnum)
 
                 (idmap, changes) = self.apply_changes(self.repos.uuid, 
-                        revmeta.revnum, revmeta.branch_path, revmeta.paths,
-                        mapping.import_fileid_map(revmeta.revprops, revmeta.fileprops), 
+                        revmeta, 
                         mapping, log_find_children)
                 pb.update('generating file id map', i, len(todo))
 
@@ -289,9 +286,7 @@
                     return self.repos._log.find_children(path, revnum)
 
                 (idmap, changes) = self.actual.apply_changes(self.repos.uuid, 
-                        revmeta.revnum, revmeta.branch_path, revmeta.paths, 
-                        mapping.import_fileid_map(revmeta.revprops, revmeta.fileprops), 
-                        mapping, log_find_children)
+                        revmeta, mapping, log_find_children)
                 pb.update('generating file id map', i, len(todo))
 
                 parent_revs = next_parent_revs

=== modified file 'repository.py'
--- a/repository.py	2008-07-21 20:54:07 +0000
+++ b/repository.py	2008-07-23 19:29:55 +0000
@@ -351,10 +351,8 @@
     def get_fileid_map(self, revnum, path, mapping):
         return self.fileid_map.get_map(self.uuid, revnum, path, mapping)
 
-    def transform_fileid_map(self, uuid, revnum, branch, changes, renames, 
-                             mapping):
-        return self.fileid_map.apply_changes(uuid, revnum, branch, changes, 
-                                             renames, mapping)[0]
+    def transform_fileid_map(self, uuid, revmeta, mapping):
+        return self.fileid_map.apply_changes(uuid, revmeta, mapping)[0]
 
     def iter_all_changes(self, layout=None, pb=None):
         if layout is None:




More information about the bazaar-commits mailing list