Copy a file to the repository

        Args:
            source: Absolute path to the source file, or a file-like object
            rel_path: path relative to the root of the repository

def put(self, source, rel_path, metadata=None):
        '''Copy a file to the repository

        Args:
            source: Absolute path to the source file, or a file-like object
            rel_path: path relative to the root of the repository

        '''

        # This case should probably be deprecated.
        if not isinstance(rel_path, basestring):
            rel_path = rel_path.cache_key

        sink = self.put_stream(rel_path, metadata=metadata)

        try:
            copy_file_or_flo(source, sink)
        except (KeyboardInterrupt, SystemExit):
            path_ = self.path(rel_path)
            if os.path.exists(path_):
                os.remove(path_)
            raise

        sink.close()

        return os.path.join(self.cache_dir, rel_path)