~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-09 17:25:41 UTC
  • mto: This revision was merged to the branch mainline in revision 1927.
  • Revision ID: john@arbash-meinel.com-20060809172541-e88fda324fa9bac7
Updated smart_add so that the AddAction can return a custom id.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
        :param path: The FastPath being added
75
75
        :param kind: The kind of the object being added.
76
76
        """
77
 
        if not self.should_print:
78
 
            return
79
 
        self._to_file.write('added %s\n' % _quote(path.raw_path))
 
77
        if self.should_print:
 
78
            self._to_file.write('added %s\n' % _quote(path.raw_path))
 
79
        return None
80
80
 
81
81
 
82
82
# TODO: jam 20050105 These could be used for compatibility
321
321
    :param inv: Inventory which will receive the new entry.
322
322
    :param parent_ie: Parent inventory entry.
323
323
    :param kind: Kind of new entry (file, directory, etc)
324
 
    :param action: callback(inv, parent_ie, path, kind); return ignored.
 
324
    :param action: callback(inv, parent_ie, path, kind); return a file_id 
 
325
        or None to generate a new file id
325
326
    :returns: None
326
327
    """
327
 
    action(inv, parent_ie, path, kind)
328
 
    entry = bzrlib.inventory.make_entry(kind, path.base_path, parent_ie.file_id)
 
328
    file_id = action(inv, parent_ie, path, kind)
 
329
    entry = bzrlib.inventory.make_entry(kind, path.base_path, parent_ie.file_id,
 
330
                                        file_id=file_id)
329
331
    inv.add(entry)