Ejemplo n.º 1
0
parser.add_option("-c", "--cleanup", action="store_true", default=False)
(options, args) = parser.parse_args(argv)

DIR = "commit"

if options.cleanup:
    rmtree(DIR, ignore_errors=True)

    print("commit.py clean")
else:
    if os.path.isdir(DIR):
        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 + "/test1.txt")
    touch(DIR + "/test2.txt")

    g.stage([DIR + "/test1.txt", DIR + "/test2.txt"])
    g.commit("First commit", commit_all=True)

    change(DIR + "/test1.txt")
    g.stage([DIR + "/test1.txt"])
    g.commit("Second commit", author="Alex Plumb <*****@*****.**>")

    print("commit.py pass")
Ejemplo n.º 2
0
    print("branch.py clean")
else:
    if os.path.isdir(DIR):
        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 + "/test1.txt")
    touch(DIR + "/test2.txt")

    g.stage([DIR + "/test1.txt", DIR + "/test2.txt"])
    g.commit("This is a commit")

    # Create a new branch, don't track it
    g.branch("branch1")
    assert "branch1" in [x['name'] for x in g.branch_list()]

    # Make sure we are still tracking master
    assert (g.is_tracking("refs/heads/master"))

    # Track branch1
    g.track("refs/heads/branch1")
    assert (g.is_tracking("refs/heads/branch1"))

    # Rename branch1 to branch1b
    g.branch_rename("branch1", "branch1b")
    assert "branch1b" in [x['name'] for x in g.branch_list()]
Ejemplo n.º 3
0
parser = OptionParser()
parser.add_option("-c", "--cleanup", action="store_true", default=False)
(options, args) = parser.parse_args(argv)

DIR = "commit"

if options.cleanup:
    rmtree(DIR, ignore_errors=True)

    print("commit.py clean")
else:
    if os.path.isdir(DIR):
        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 + "/test1.txt")
    touch(DIR + "/test2.txt")
    
    g.stage([DIR+"/test1.txt", DIR+"/test2.txt"])
    g.commit("First commit", commit_all=True)
    
    change(DIR + "/test1.txt")
    g.stage([DIR+"/test1.txt"])
    g.commit("Second commit", author="Alex Plumb <*****@*****.**>")
    
    print("commit.py pass")
Ejemplo n.º 4
0
from util import touch, change

parser = OptionParser()
parser.add_option("-c", "--cleanup", action="store_true", default=False)
(options, args) = parser.parse_args(argv)

DIR = "tag"

if options.cleanup:
    rmtree(DIR, ignore_errors=True)

    print "tag.py clean"
else:
    if os.path.isdir(DIR):
        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 + "/test1.txt")
    touch(DIR + "/test2.txt")
    
    g.stage([DIR+"/test1.txt", DIR+"/test2.txt"])
    commit_id = g.commit("First commit", commit_all=True)
    
    tag_id = g.tag("tag1", "Tagging as tag1", track=True)
    assert (g.is_tracking("refs/tags/tag1"))
    
    print "tag.py pass"
Ejemplo n.º 5
0
    rmtree(DIR, ignore_errors=True)

    print("branch.py clean")
else:
    if os.path.isdir(DIR):
        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 + "/test1.txt")
    touch(DIR + "/test2.txt")
    
    g.stage([DIR+"/test1.txt", DIR+"/test2.txt"])
    g.commit("This is a commit")

    # Create a new branch, don't track it
    g.branch("branch1")
    assert "branch1" in [x['name'] for x in g.branch_list()]

    # Make sure we are still tracking master
    assert (g.is_tracking("refs/heads/master"))

    # Track branch1
    g.track("refs/heads/branch1")
    assert (g.is_tracking("refs/heads/branch1"))
    
    # Rename branch1 to branch1b
    g.branch_rename("branch1", "branch1b")
    assert "branch1b" in [x['name'] for x in g.branch_list()]
Ejemplo n.º 6
0
    # Unstage both files
    g.unstage([DIR+"/test1.txt", DIR+"/test2.txt"])
    st = g.status()
    assert (st[0] == UntrackedStatus)
    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)
Ejemplo n.º 7
0
    print("remove.py clean")
else:
    if os.path.isdir(DIR):
        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()
Ejemplo n.º 8
0
    rmtree(DIR, ignore_errors=True)

    print("move.py clean")
else:
    if os.path.isdir(DIR):
        raise SystemExit(
            "This test script has already been run.  Please call this script with --cleanup to start again"
        )

    g = GittyupClient(DIR, create=True)

    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")
Ejemplo n.º 9
0
    # Unstage both files
    g.unstage([DIR + "/test1.txt", DIR + "/test2.txt"])
    st = g.status()
    assert (st[0] == UntrackedStatus)
    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)
Ejemplo n.º 10
0
    rmtree(DIR, ignore_errors=True)

    print("remove.py clean")
else:
    if os.path.isdir(DIR):
        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()
Ejemplo n.º 11
0
(options, args) = parser.parse_args(argv)

DIR = "tag"

if options.cleanup:
    rmtree(DIR, ignore_errors=True)

    print("tag.py clean")
else:
    if os.path.isdir(DIR):
        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 + "/test1.txt")
    touch(DIR + "/test2.txt")

    g.stage([DIR + "/test1.txt", DIR + "/test2.txt"])
    commit_id = g.commit("First commit", commit_all=True)

    tag_id = g.tag("tag1", "Tagging as tag1", track=True)
    assert (g.is_tracking("refs/tags/tag1"))

    assert (len(g.tag_list()) == 1)

    print("tag.py pass")
Ejemplo n.º 12
0
if options.cleanup:
    rmtree(DIR, ignore_errors=True)

    print "move.py clean"
else:
    if os.path.isdir(DIR):
        raise SystemExit("This test script has already been run.  Please call this script with --cleanup to start again")

    g = GittyupClient(DIR, create=True)
    
    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")