~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Robert Collins
  • Date: 2005-11-04 14:33:19 UTC
  • Revision ID: robertc@robertcollins.net-20051104143319-5293770efa92f56d
Remove some unneeded shebangs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
from copy import copy
17
18
import os
18
19
from cStringIO import StringIO
19
20
 
111
112
            self.pb.clear()
112
113
 
113
114
    def _fetch_revisions(self, last_revision):
114
 
        try:
115
 
            self.last_revision = self._find_last_revision(last_revision)
116
 
        except NoSuchRevision, e:
117
 
            mutter('failed getting last revision: %s', e)
118
 
            raise InstallFailed([last_revision])
 
115
        self.last_revision = self._find_last_revision(last_revision)
119
116
        mutter('fetch up to rev {%s}', self.last_revision)
120
117
        if (self.last_revision is not None and 
121
118
            self.to_branch.has_revision(self.last_revision)):
134
131
 
135
132
        Returns the revision_id, or returns None if there's no history
136
133
        in the source branch."""
 
134
        if last_revision:
 
135
            return last_revision
137
136
        self.pb.update('get source history')
138
137
        from_history = self.from_branch.revision_history()
139
138
        self.pb.update('get destination history')
140
 
        if last_revision:
141
 
            self.from_branch.get_revision(last_revision)
142
 
            return last_revision
143
 
        elif from_history:
 
139
        if from_history:
144
140
            return from_history[-1]
145
141
        else:
146
142
            return None                 # no history in the source branch
197
193
               len(rev.parent_ids))
198
194
        self._copy_new_texts(rev_id, inv)
199
195
        parents = rev.parent_ids
 
196
        new_parents = copy(parents)
200
197
        for parent in parents:
201
198
            if not self.to_branch.has_revision(parent):
202
 
                parents.pop(parents.index(parent))
203
 
        self._copy_inventory(rev_id, inv_xml, parents)
 
199
                new_parents.pop(new_parents.index(parent))
 
200
        self._copy_inventory(rev_id, inv_xml, new_parents)
204
201
        self.to_branch.revision_store.add(StringIO(rev_xml), rev_id)
205
202
        mutter('copied revision %s', rev_id)
206
203
 
207
 
 
208
204
    def _copy_inventory(self, rev_id, inv_xml, parent_ids):
209
205
        self.to_control.add_text('inventory', rev_id,
210
206
                                split_lines(inv_xml), parent_ids,
222
218
                   path, ie.file_id)
223
219
            self._copy_one_weave(rev_id, ie.file_id)
224
220
 
225
 
 
226
221
    def _copy_one_weave(self, rev_id, file_id):
227
222
        """Copy one file weave."""
228
223
        mutter('copy file {%s} modified in {%s}', file_id, rev_id)