Exemplo n.º 1
0
        )

    os.mkdir(DIR)
    g = GittyupClient()
    g.initialize_repository(DIR)

    touch(DIR + "/test.txt")

    # Stage and commit the file
    g.stage([DIR + "/test.txt"])
    g.commit("Adding test.txt")

    g.remove([DIR + "/test.txt"])
    st = g.status()
    assert (not os.path.exists(DIR + "/test.txt"))
    assert (g.is_staged(DIR + "/test.txt"))
    assert (st[0] == RemovedStatus)

    g.unstage([DIR + "/test.txt"])
    st = g.status()
    assert (not os.path.exists(DIR + "/test.txt"))
    assert (not g.is_staged(DIR + "/test.txt"))
    assert (st[0] == MissingStatus)

    g.checkout([DIR + "/test.txt"])
    st = g.status()
    assert (os.path.exists(DIR + "/test.txt"))
    assert (not g.is_staged(DIR + "/test.txt"))
    assert (st[0] == NormalStatus)

    print("remove.py pass")
Exemplo n.º 2
0
    assert (st[1] == UntrackedStatus)
    assert (not st[0].is_staged)
    
    # Untracked files should not be staged
    g.stage_all()
    st = g.status()
    assert (st[0] == UntrackedStatus)
    assert (st[1] == UntrackedStatus)
    
    # test1.txt is changed, so it should get staged and set as Modified
    g.stage([DIR+"/test1.txt"])
    g.commit("Test commit")
    change(DIR+"/test1.txt")
    st = g.status()
    assert (st[0] == ModifiedStatus)
    g.stage_all()
    st = g.status()
    assert (st[0] == ModifiedStatus)
    assert (g.is_staged(DIR+"/" + st[0].path))
    assert (not g.is_staged(DIR+"/" + st[1].path))

    # Unstage all staged files
    g.unstage_all()
    st = g.status()
    assert (not g.is_staged(DIR+"/" + st[0].path))
    assert (not g.is_staged(DIR+"/" + st[1].path))
    assert (st[0] == ModifiedStatus)
    assert (st[1] == UntrackedStatus)
    
    print "stage.py pass"
Exemplo n.º 3
0
    touch(DIR + "/test.txt")

    # Stage and commit the file
    g.stage([DIR + "/test.txt"])
    g.commit("Adding test.txt")

    st = g.status()

    # Move file explicity test
    os.mkdir(DIR + "/fol")
    g.move(DIR + "/test.txt", DIR + "/fol/test.txt")
    st = g.status()
    assert (not os.path.exists(DIR + "/test.txt"))
    assert (os.path.exists(DIR + "/fol/test.txt"))
    assert (g.is_staged(DIR + "/fol/test.txt"))
    assert (st[0] == RemovedStatus)
    assert (st[1] == AddedStatus)

    # Move as children test
    touch(DIR + "/test2.txt")
    g.stage([DIR + "/test2.txt"])
    g.commit("Adding test2.txt")
    g.move(DIR + "/test2.txt", DIR + "/fol")
    st = g.status()
    assert (not os.path.exists(DIR + "/test2.txt"))
    assert (os.path.exists(DIR + "/fol/test2.txt"))
    assert (g.is_staged(DIR + "/fol/test2.txt"))
    assert (st[1] == RemovedStatus)
    assert (st[2] == AddedStatus)
    g.commit("Committing the test2 move")
Exemplo n.º 4
0
    assert (st[1] == UntrackedStatus)
    assert (not st[0].is_staged)

    # Untracked files should not be staged
    g.stage_all()
    st = g.status()
    assert (st[0] == UntrackedStatus)
    assert (st[1] == UntrackedStatus)

    # test1.txt is changed, so it should get staged and set as Modified
    g.stage([DIR + "/test1.txt"])
    g.commit("Test commit")
    change(DIR + "/test1.txt")
    st = g.status()
    assert (st[0] == ModifiedStatus)
    g.stage_all()
    st = g.status()
    assert (st[0] == ModifiedStatus)
    assert (g.is_staged(DIR + "/" + st[0].path))
    assert (not g.is_staged(DIR + "/" + st[1].path))

    # Unstage all staged files
    g.unstage_all()
    st = g.status()
    assert (not g.is_staged(DIR + "/" + st[0].path))
    assert (not g.is_staged(DIR + "/" + st[1].path))
    assert (st[0] == ModifiedStatus)
    assert (st[1] == UntrackedStatus)

    print "stage.py pass"
Exemplo n.º 5
0
        raise SystemExit("This test script has already been run.  Please call this script with --cleanup to start again")

    os.mkdir(DIR)
    g = GittyupClient()
    g.initialize_repository(DIR)

    touch(DIR + "/test.txt")

    # Stage and commit the file
    g.stage([DIR+"/test.txt"])
    g.commit("Adding test.txt")

    g.remove([DIR+"/test.txt"])
    st = g.status()
    assert (not os.path.exists(DIR+"/test.txt"))
    assert (g.is_staged(DIR+"/test.txt"))
    assert (st[0] == RemovedStatus)

    g.unstage([DIR+"/test.txt"])
    st = g.status()
    assert (not os.path.exists(DIR+"/test.txt"))
    assert (not g.is_staged(DIR+"/test.txt"))
    assert (st[0] == MissingStatus)

    g.checkout([DIR+"/test.txt"])
    st = g.status()
    assert (os.path.exists(DIR+"/test.txt"))
    assert (not g.is_staged(DIR+"/test.txt"))
    assert (st[0] == NormalStatus)

    print("remove.py pass")
Exemplo n.º 6
0
    
    touch(DIR + "/test.txt")
    
    # Stage and commit the file
    g.stage([DIR+"/test.txt"])
    g.commit("Adding test.txt")
    
    st = g.status()

    # Move file explicity test
    os.mkdir(DIR+"/fol")
    g.move(DIR+"/test.txt", DIR+"/fol/test.txt")
    st = g.status()
    assert (not os.path.exists(DIR+"/test.txt"))
    assert (os.path.exists(DIR+"/fol/test.txt"))
    assert (g.is_staged(DIR+"/fol/test.txt"))
    assert (st[0] == RemovedStatus)
    assert (st[1] == AddedStatus)

    # Move as children test
    touch(DIR + "/test2.txt")
    g.stage([DIR+"/test2.txt"])
    g.commit("Adding test2.txt")
    g.move(DIR+"/test2.txt", DIR+"/fol")
    st = g.status()
    assert (not os.path.exists(DIR+"/test2.txt"))
    assert (os.path.exists(DIR+"/fol/test2.txt"))
    assert (g.is_staged(DIR+"/fol/test2.txt"))
    assert (st[0] == RemovedStatus)
    assert (st[2] == AddedStatus)
    g.commit("Committing the test2 move")