My favorites
▼
|
Sign in
ormar
Object-Relational Mapping's not Anti-Relational
Project Home
Downloads
Wiki
Issues
Source
Repository:
default
wiki
Checkout
Browse
Changes
Clones
Source path:
hg
/
paging
/
apply-version.nant
‹c6029f78e684
b6d5997d7096
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?xml version="1.0" ?><!-- -*- mode:nxml; indent-tabs-mode: nil -*- -->
<project name="apply-version" default="apply-version">
<property name="skip-version-application-p" value="false" overwrite="false" />
<target name="lastResort">
<echo message="giving up on assembly versioning" />
<copy file="AssemblyInfo.cs.tmpl" tofile="AssemblyInfo.cs" overwrite="true">
<filterchain>
<replacetokens begintoken="$" endtoken="$">
<token key="WCREV" value="0" />
<token key="WCMIXED?1:0" value="1" />
<token key="WCMODS?1:0" value="1" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="trySubWCRev">
<exec program="SubWCRev" failonerror="false" resultproperty="subwcrevExitStatus">
<arg line=". AssemblyInfo.cs.tmpl AssemblyInfo.cs" />
</exec>
<if test="${subwcrevExitStatus == '-1000'}">
<call target="lastResort" />
</if>
</target>
<target name="try-svnversion">
<exec program="svnversion" failonerror="false" resultproperty="svnversionExitStatus" output="AssemblyInfo.cs.svnversion">
</exec>
<if test="${svnversionExitStatus == '0'}">
<loadfile file="AssemblyInfo.cs.svnversion" property="svnversionResult" />
<property name="svnversionResult" value="${string::trim(string::to-lower(svnversionResult))}" />
<property name="svnversion-m" value="${string::contains(svnversionResult, 'm')}" />
<property name="svnversionResult" value="${string::replace(svnversionResult, 'm', '')}" />
<property name="svnversion-s" value="${string::contains(svnversionResult, 's')}" />
<property name="svnversionResult" value="${string::replace(svnversionResult, 's', '')}" />
<property name="svnversion-p" value="${string::contains(svnversionResult, 'p')}" />
<property name="svnversionResult" value="${string::replace(svnversionResult, 'p', '')}" />
<property name="svnversion-delim" value="${string::index-of(svnversionResult, ':')}" />
<if test="${svnversion-delim == '-1'}">
<property name="wcrev" value="${svnversionResult}" />
</if>
<if test="${svnversion-delim != '-1'}">
<property
name="wcrev"
value="${
string::substring(
svnversionResult,
0,
svnversion-delim)}" />
</if>
<property name="wcmixed" value="${svnversion-delim != '-1'}" />
<property name="wcmods" value="${svnversion-m}" />
<call target="do-apply-version" />
</if>
<if test="${svnversionExitStatus != '0'}">
<call target="trySubWCRev" />
</if>
</target>
<target name="do-apply-version">
<copy file="AssemblyInfo.cs.tmpl" tofile="AssemblyInfo.cs" overwrite="true">
<filterchain>
<replacetokens begintoken="$" endtoken="$">
<token key="WCREV" value="${wcrev}" />
<token key="WCMIXED?1:0" value="0" if="${not wcmixed}" />
<token key="WCMIXED?1:0" value="1" if="${wcmixed}" />
<token key="WCMODS?1:0" value="0" if="${not wcmods}" />
<token key="WCMODS?1:0" value="1" if="${wcmods}" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="try-hg">
<exec program="hg" failonerror="false" resultproperty="hgwc">
<arg line="root" />
</exec>
<if test="${hgwc != '0'}">
<call target="lastresort" />
</if>
<if test="${hgwc == '0'}">
<exec program="hg" failonerror="true" output="AssemblyInfo.cs.hgid">
<arg line="--debug id --num --id" />
</exec>
<loadfile file="AssemblyInfo.cs.hgid" property="hgid" />
<regex input="${hgid}" pattern="(?'revid'[0-9a-f]+)(?'hgdirty'\+?)\s+(?'revnum'[0-9a-f]+)" />
<echo message="revid: ${revid}" />
<echo message="revnum: ${revnum}" />
<echo message="hgdirty: ${hgdirty}" />
<exec program="hg" failonerror="true" output="AssemblyInfo.cs.hgpaths">
<arg line="paths" />
</exec>
<property name="upstream" value="" />
<if test="${file::exists('AssemblyInfo.cs.hgpaths')}">
<loadfile file="AssemblyInfo.cs.hgpaths" property="hgpaths" />
<regex input="${hgpaths}" pattern="^default\s+=\s+(?'upstream'.+)" failonerror="false" />
</if>
<exec program="hg" failonerror="false" output="AssemblyInfo.cs.hgurevnum" resultproperty="hginconsistent">
<arg line="id --rev ${revid} ${upstream}" />
</exec>
<loadfile file="AssemblyInfo.cs.hgurevnum" property="hgurevnum" />
<echo message="hgurevnum: ${hgurevnum}" />
<property name="wcrev" value="${revnum}" />
<!-- there's no exact analog to svn mixed rev wcs in
hg, but I guess maybe having a wc state that isn't
accessible at the upstream repo is comparable. -->
<property name="wcmixed" value="${hginconsistent != '0'}" />
<property name="wcmods" value="${hgdirty == '+'}" />
<call target="do-apply-version" />
</if>
</target>
<target name="apply-version">
<if test="${not skip-version-application-p}">
<if test="${directory::exists('.svn')}">
<call target="try-svnversion" />
</if>
<if test="${not directory::exists('.svn')}">
<call target="try-hg" />
</if>
</if>
</target>
</project>
Show details
Hide details
Change log
fc21e8c427b0
by sean.foy on Oct 11, 2009
Diff
support hg
Go to:
/paging/apply-version.nant
Sign in
to write a code review
Older revisions
c6029f78e684
by sean.foy on Aug 23, 2009
Diff
initial commit
All revisions of this file
File info
Size: 5352 bytes, 124 lines
View raw file
Powered by
Google Project Hosting