quilt/add.py
def add_file(self, filename, patch_name=None, ignore=False):
        """ Add file to the patch with patch_name.
        If patch_name is None or empty the topmost patch will be used.
        Adding an already added patch will raise an QuiltError if ignore is
        False.
        """
        file = File(filename)

        if patch_name:
            patch = Patch(patch_name)
        else:
            patch = self.db.top_patch()
            if not patch:
                raise NoAppliedPatch(self.db)

        exists = self._file_in_patch(filename, patch, ignore)
        if exists:
            return

        self._file_in_next_patches(filename, patch)

        if file.is_link():
            raise QuiltError("Cannot add symbolic link %s" % filename)

        self._backup_file(file, patch)

        if file.exists():
            # be sure user can write original file
            os.chmod(filename, file.get_mode() | stat.S_IWUSR | stat.S_IRUSR)

        self.file_added(file, patch)
def add_file(self, filename, patch_name=None, ignore=False):
        file = File(filename)

        if patch_name:
            patch = Patch(patch_name)
        else:
            patch = self.db.top_patch()
            if not patch:
                raise NoAppliedPatch(self.db)

        exists = self._file_in_patch(filename, patch, ignore)
        if exists:
            return

        self._file_in_next_patches(filename, patch)

        if file.is_link():
            raise QuiltError("Cannot add symbolic link %s" % filename)

        self._backup_file(file, patch)

        if file.exists():
            # be sure user can write original file
            os.chmod(filename, file.get_mode() | stat.S_IWUSR | stat.S_IRUSR)

        self.file_added(file, patch)
def add_file ( self , filename , patch_name = None , ignore = False ) : file = File ( filename ) if patch_name : patch = Patch ( patch_name ) else : patch = self . db . top_patch ( ) if not patch : raise NoAppliedPatch ( self . db ) exists = self . _file_in_patch ( filename , patch , ignore ) if exists : return self . _file_in_next_patches ( filename , patch ) if file . is_link ( ) : raise QuiltError ( "Cannot add symbolic link %s" % filename ) self . _backup_file ( file , patch ) if file . exists ( ) : # be sure user can write original file os . chmod ( filename , file . get_mode ( ) | stat . S_IWUSR | stat . S_IRUSR ) self . file_added ( file , patch )
Add file to the patch with patch_name.
        If patch_name is None or empty the topmost patch will be used.
        Adding an already added patch will raise an QuiltError if ignore is
        False.
Add file to the patch with patch_name . If patch_name is None or empty the topmost patch will be used . Adding an already added patch will raise an QuiltError if ignore is False .