backend/gitsound.py
def commit_changes_to_playlist(self, uid, pid):
        """Function to commit changes to playlist

        :param uid: user ID
        :type uid: string
        :param pid: playlist ID
        :type pid: string

        """

        playlist_path = uid + "/" + pid

        util.check_if_git_playlist(self.git_dir, playlist_path)

        # get the repo
        repo = pygit2.Repository(self.git_dir + playlist_path)

        # create the file blob
        file_blob = repo.create_blob_fromdisk(
            self.git_dir + playlist_path + "/index.txt")

        new_tree = repo.TreeBuilder()

        # insert it into the tree
        new_tree.insert("index.txt", file_blob,
                        os.stat(self.git_dir + playlist_path + "/index.txt").st_mode)

        tree = new_tree.write()

        # add to commit
        repo.index.read()
        repo.index.add("index.txt")
        repo.index.write()

        # commit changes to playlist
        repo.create_commit("HEAD", self.author, self.comitter,
                           "Changes committed to " + playlist_path, tree, [repo.head.target])
Function to commit changes to playlist

        :param uid: user ID
        :type uid: string
        :param pid: playlist ID
        :type pid: string

        
Function to commit changes to playlist
Function to commit changes to playlist
def commit_changes_to_playlist(self, uid, pid):
        playlist_path = uid + "/" + pid
        util.check_if_git_playlist(self.git_dir, playlist_path)
        repo = pygit2.Repository(self.git_dir + playlist_path)
        file_blob = repo.create_blob_fromdisk(
            self.git_dir + playlist_path + "/index.txt")
        new_tree = repo.TreeBuilder()
        new_tree.insert("index.txt", file_blob,
                        os.stat(self.git_dir + playlist_path + "/index.txt").st_mode)
        tree = new_tree.write()
        repo.index.read()
        repo.index.add("index.txt")
        repo.index.write()
        repo.create_commit("HEAD", self.author, self.comitter,
                           "Changes committed to " + playlist_path, tree, [repo.head.target])
def commit_changes_to_playlist ( self , uid , pid ) : playlist_path = uid + "/" + pid util . check_if_git_playlist ( self . git_dir , playlist_path ) repo = pygit2 . Repository ( self . git_dir + playlist_path ) file_blob = repo . create_blob_fromdisk ( self . git_dir + playlist_path + "/index.txt" ) new_tree = repo . TreeBuilder ( ) new_tree . insert ( "index.txt" , file_blob , os . stat ( self . git_dir + playlist_path + "/index.txt" ) . st_mode ) tree = new_tree . write ( ) repo . index . read ( ) repo . index . add ( "index.txt" ) repo . index . write ( ) repo . create_commit ( "HEAD" , self . author , self . comitter , "Changes committed to " + playlist_path , tree , [ repo . head . target ] )
Function to commit changes to playlist
Function to commit changes to playlist
"""Function to commit changes to playlist

        :param uid: user ID
        :type uid: string
        :param pid: playlist ID
        :type pid: string

        """ # get the repo # create the file blob # insert it into the tree # add to commit # commit changes to playlist
self
uid
None
pid
None