File: GitPushTaskTest.xml

package info (click to toggle)
phing 3.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,368 kB
  • sloc: php: 59,821; xml: 9,767; sql: 78; makefile: 39; sh: 14
file content (110 lines) | stat: -rw-r--r-- 4,018 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?xml version="1.0"?>
<project name="gitPushTest" default="invalid">

    <property name="tmp.dir" value="./../../../../tmp/git" />
    <property name="bundle.dir" value="phing-tests.git"/>
    <property name="repo.dir" value="./../../../../tmp/repo" />

    <resolvepath propertyName="tmp.dir.resolved" file="${tmp.dir}" />
    <resolvepath propertyName="bundle.dir.resolved" file="${bundle.dir}" />
    <resolvepath propertyName="repo.dir.resolved" file="${repo.dir}" />

    <delete dir="${repo.dir.resolved}" />

    <if>
        <os family="windows"/>
        <then>
            <property name="git-path" value="SET LC_ALL=C &amp;&amp; git"/>
        </then>
        <else>
            <property name="git-path" value="LC_ALL=C &amp;&amp; git"/>
        </else>
    </if>

    <gitclone gitPath="${git-path}"
        singleBranch="true"
    	repository="${bundle.dir.resolved}"
    	targetPath="${repo.dir.resolved}" />

    <target name="invalid">
        <fail>This file should only be run via a testcase</fail>
    </target>

    <target name="allParamsSet" description="all parameters present">
        <gitclone gitPath="${git-path}"
            singleBranch="true"
            repository="${repo.dir.resolved}"
            targetPath="${tmp.dir.resolved}" />
        <gitpush gitPath="${git-path}"
            repository="${tmp.dir.resolved}" 
            destination="origin" refspec="master:foobranch" 
            force="true" quiet="true" />
    </target>

    <target name="wrongRepo" description="all parameters present">
        <gitclone gitPath="${git-path}"
            singleBranch="true"
            repository="${repo.dir.resolved}"
            targetPath="${tmp.dir.resolved}" />
        <gitpush gitPath="${git-path}"
            repository="plain-wrong" 
            destination="origin" refspec="master:foobranch" 
            force="true" quiet="true" />
    </target>

    <target name="noRepository" description="Required param checking">
        <gitpush gitPath="${git-path}" />
    </target>

    <target name="noDestination" description="Required param checking">
        <gitclone gitPath="${git-path}"
            singleBranch="true"
            repository="${repo.dir.resolved}"
            targetPath="${tmp.dir.resolved}" />
        <gitpush gitPath="${git-path}"
            repository="${tmp.dir.resolved}" destination="" />
    </target>

    <target name="allReposSet" description="git-push --all">
        <gitclone gitPath="${git-path}"
            singleBranch="true"
            repository="${repo.dir.resolved}"
            targetPath="${tmp.dir.resolved}" />
        <gitpush gitPath="${git-path}"
            repository="${tmp.dir.resolved}" all="true" />
    </target>

    <target name="tagsSet" description="git-push --tags">
        <gitclone gitPath="${git-path}"
            singleBranch="true"
            repository="${repo.dir.resolved}"
            targetPath="${tmp.dir.resolved}" />
        <gitpush gitPath="${git-path}"
            repository="${tmp.dir.resolved}" 
            refspec="master:foobranch" tags="true" />
    </target>

    <target name="mirrorSet" description="git-push --tags">
        <gitclone gitPath="${git-path}"
            singleBranch="true"
            repository="${repo.dir.resolved}"
            targetPath="${tmp.dir.resolved}" />
        <gitpush gitPath="${git-path}"
            repository="${tmp.dir.resolved}" 
            mirror="true" quiet="true" />
    </target>
    <target name="deleteSet" description="git-push --tags">
        <gitclone gitPath="${git-path}"
            singleBranch="true"
            repository="${repo.dir.resolved}"
            targetPath="${tmp.dir.resolved}" />
        <gitpush gitPath="${git-path}"
            repository="${tmp.dir.resolved}" 
            refspec="master:newbranch" quiet="true" />
        <gitpush gitPath="${git-path}"
            repository="${tmp.dir.resolved}" 
            delete="true"
            refspec="newbranch" quiet="true" />
    </target>

</project>