##// END OF EJS Templates
Merge with crew
Matt Mackall -
r6658:7ca74741 merge default
parent child Browse files
Show More
@@ -92,11 +92,10 b' def show_doc(ui):'
92 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases']))
92 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases']))
93
93
94 # print topics
94 # print topics
95 for t in helptable:
95 for t, doc in helptable:
96 l = t.split("|")
96 l = t.split("|")
97 section = l[-1]
97 section = l[-1]
98 underlined(_(section).upper())
98 underlined(_(section).upper())
99 doc = helptable[t]
100 if callable(doc):
99 if callable(doc):
101 doc = doc()
100 doc = doc()
102 ui.write(_(doc))
101 ui.write(_(doc))
@@ -37,58 +37,6 b' repository path::'
37
37
38 include::hg.1.gendoc.txt[]
38 include::hg.1.gendoc.txt[]
39
39
40 SPECIFYING SINGLE REVISIONS
41 ---------------------------
42
43 Mercurial accepts several notations for identifying individual
44 revisions.
45
46 A plain integer is treated as a revision number. Negative
47 integers are treated as offsets from the tip, with -1 denoting the
48 tip.
49
50 A 40-digit hexadecimal string is treated as a unique revision
51 identifier.
52
53 A hexadecimal string less than 40 characters long is treated as a
54 unique revision identifier, and referred to as a short-form
55 identifier. A short-form identifier is only valid if it is the
56 prefix of one full-length identifier.
57
58 Any other string is treated as a tag name, which is a symbolic
59 name associated with a revision identifier. Tag names may not
60 contain the ":" character.
61
62 The reserved name "tip" is a special tag that always identifies
63 the most recent revision.
64
65 The reserved name "null" indicates the null revision. This is the
66 revision of an empty repository, and the parent of revision 0.
67
68 The reserved name "." indicates the working directory parent. If
69 no working directory is checked out, it is equivalent to null.
70 If an uncommitted merge is in progress, "." is the revision of
71 the first parent.
72
73 SPECIFYING MULTIPLE REVISIONS
74 -----------------------------
75
76 When Mercurial accepts more than one revision, they may be
77 specified individually, or provided as a continuous range,
78 separated by the ":" character.
79
80 The syntax of range notation is [BEGIN]:[END], where BEGIN and END
81 are revision identifiers. Both BEGIN and END are optional. If
82 BEGIN is not specified, it defaults to revision number 0. If END
83 is not specified, it defaults to the tip. The range ":" thus
84 means "all revisions".
85
86 If BEGIN is greater than END, revisions are treated in reverse
87 order.
88
89 A range acts as a closed interval. This means that a range of 3:5
90 gives 3, 4 and 5. Similarly, a range of 4:2 gives 4, 3, and 2.
91
92 FILES
40 FILES
93 -----
41 -----
94 .hgignore::
42 .hgignore::
@@ -2038,10 +2038,14 b' def rename(ui, repo, patch, name=None, *'
2038 if r:
2038 if r:
2039 wlock = r.wlock()
2039 wlock = r.wlock()
2040 try:
2040 try:
2041 if r.dirstate[name] == 'r':
2041 if r.dirstate[patch] == 'a':
2042 r.undelete([name])
2042 r.dirstate.forget(patch)
2043 r.copy(patch, name)
2043 r.dirstate.add(name)
2044 r.remove([patch], False)
2044 else:
2045 if r.dirstate[name] == 'r':
2046 r.undelete([name])
2047 r.copy(patch, name)
2048 r.remove([patch], False)
2045 finally:
2049 finally:
2046 del wlock
2050 del wlock
2047
2051
@@ -127,7 +127,7 b' class bundlerevlog(revlog.revlog):'
127
127
128 def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
128 def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
129 raise NotImplementedError
129 raise NotImplementedError
130 def addgroup(self, revs, linkmapper, transaction, unique=0):
130 def addgroup(self, revs, linkmapper, transaction):
131 raise NotImplementedError
131 raise NotImplementedError
132 def strip(self, rev, minlink):
132 def strip(self, rev, minlink):
133 raise NotImplementedError
133 raise NotImplementedError
@@ -276,17 +276,23 b' def addremove(repo, pats=[], opts={}, dr'
276 similarity = float(opts.get('similarity') or 0)
276 similarity = float(opts.get('similarity') or 0)
277 add, remove = [], []
277 add, remove = [], []
278 mapping = {}
278 mapping = {}
279 audit_path = util.path_auditor(repo.root)
279 m = match(repo, pats, opts)
280 m = match(repo, pats, opts)
280 for abs in repo.walk(m):
281 for abs in repo.walk(m):
281 target = repo.wjoin(abs)
282 target = repo.wjoin(abs)
283 good = True
284 try:
285 audit_path(abs)
286 except:
287 good = False
282 rel = m.rel(abs)
288 rel = m.rel(abs)
283 exact = m.exact(abs)
289 exact = m.exact(abs)
284 if abs not in repo.dirstate:
290 if good and abs not in repo.dirstate:
285 add.append(abs)
291 add.append(abs)
286 mapping[abs] = rel, m.exact(abs)
292 mapping[abs] = rel, m.exact(abs)
287 if repo.ui.verbose or not exact:
293 if repo.ui.verbose or not exact:
288 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
294 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
289 if repo.dirstate[abs] != 'r' and (not util.lexists(target)
295 if repo.dirstate[abs] != 'r' and (not good or not util.lexists(target)
290 or (os.path.isdir(target) and not os.path.islink(target))):
296 or (os.path.isdir(target) and not os.path.islink(target))):
291 remove.append(abs)
297 remove.append(abs)
292 mapping[abs] = rel, exact
298 mapping[abs] = rel, exact
@@ -1253,7 +1253,14 b' def help_(ui, name=None, with_version=Fa'
1253 if with_version:
1253 if with_version:
1254 version_(ui)
1254 version_(ui)
1255 ui.write('\n')
1255 ui.write('\n')
1256 aliases, i = cmdutil.findcmd(ui, name, table)
1256
1257 try:
1258 aliases, i = cmdutil.findcmd(ui, name, table)
1259 except cmdutil.AmbiguousCommand, inst:
1260 select = lambda c: c.lstrip('^').startswith(inst.args[0])
1261 helplist(_('list of commands:\n\n'), select)
1262 return
1263
1257 # synopsis
1264 # synopsis
1258 ui.write("%s\n" % i[2])
1265 ui.write("%s\n" % i[2])
1259
1266
@@ -1314,16 +1321,16 b' def help_(ui, name=None, with_version=Fa'
1314
1321
1315 def helptopic(name):
1322 def helptopic(name):
1316 v = None
1323 v = None
1317 for i in help.helptable:
1324 for i, d in help.helptable:
1318 l = i.split('|')
1325 l = i.split('|')
1319 if name in l:
1326 if name in l:
1320 v = i
1327 v = i
1321 header = l[-1]
1328 header = l[-1]
1329 doc = d
1322 if not v:
1330 if not v:
1323 raise cmdutil.UnknownCommand(name)
1331 raise cmdutil.UnknownCommand(name)
1324
1332
1325 # description
1333 # description
1326 doc = help.helptable[v]
1327 if not doc:
1334 if not doc:
1328 doc = _("(No help text available)")
1335 doc = _("(No help text available)")
1329 if callable(doc):
1336 if callable(doc):
@@ -1394,6 +1401,16 b' def help_(ui, name=None, with_version=Fa'
1394 and _(" (default: %s)") % default
1401 and _(" (default: %s)") % default
1395 or "")))
1402 or "")))
1396
1403
1404 if ui.verbose:
1405 ui.write(_("\nspecial help topics:\n"))
1406 topics = []
1407 for i, d in help.helptable:
1408 l = i.split('|')
1409 topics.append((", ".join(l[:-1]), l[-1]))
1410 topics_len = max([len(s[0]) for s in topics])
1411 for t, desc in topics:
1412 ui.write(" %-*s %s\n" % (topics_len, t, desc))
1413
1397 if opt_output:
1414 if opt_output:
1398 opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0])
1415 opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0])
1399 for first, second in opt_output:
1416 for first, second in opt_output:
@@ -5,8 +5,8 b''
5 # This software may be used and distributed according to the terms
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
6 # of the GNU General Public License, incorporated herein by reference.
7
7
8 helptable = {
8 helptable = (
9 "dates|Date Formats":
9 ("dates|Date Formats",
10 r'''
10 r'''
11 Some commands allow the user to specify a date:
11 Some commands allow the user to specify a date:
12 backout, commit, import, tag: Specify the commit date.
12 backout, commit, import, tag: Specify the commit date.
@@ -43,9 +43,55 b' helptable = {'
43 ">{date}" - on or after a given date
43 ">{date}" - on or after a given date
44 "{date} to {date}" - a date range, inclusive
44 "{date} to {date}" - a date range, inclusive
45 "-{days}" - within a given number of days of today
45 "-{days}" - within a given number of days of today
46 ''',
46 '''),
47
48 ("patterns|File Name Patterns",
49 r'''
50 Mercurial accepts several notations for identifying one or more
51 files at a time.
52
53 By default, Mercurial treats filenames as shell-style extended
54 glob patterns.
55
56 Alternate pattern notations must be specified explicitly.
57
58 To use a plain path name without any pattern matching, start a
59 name with "path:". These path names must match completely, from
60 the root of the current repository.
61
62 To use an extended glob, start a name with "glob:". Globs are
63 rooted at the current directory; a glob such as "*.c" will match
64 files ending in ".c" in the current directory only.
65
66 The supported glob syntax extensions are "**" to match any string
67 across path separators, and "{a,b}" to mean "a or b".
47
68
48 'environment|env|Environment Variables':
69 To use a Perl/Python regular expression, start a name with "re:".
70 Regexp pattern matching is anchored at the root of the repository.
71
72 Plain examples:
73
74 path:foo/bar a name bar in a directory named foo in the root of
75 the repository
76 path:path:name a file or directory named "path:name"
77
78 Glob examples:
79
80 glob:*.c any name ending in ".c" in the current directory
81 *.c any name ending in ".c" in the current directory
82 **.c any name ending in ".c" in the current directory, or
83 any subdirectory
84 foo/*.c any name ending in ".c" in the directory foo
85 foo/**.c any name ending in ".c" in the directory foo, or any
86 subdirectory
87
88 Regexp examples:
89
90 re:.*\.c$ any name ending in ".c", anywhere in the repository
91
92 '''),
93
94 ('environment|env|Environment Variables',
49 r'''
95 r'''
50 HG::
96 HG::
51 Path to the 'hg' executable, automatically passed when running hooks,
97 Path to the 'hg' executable, automatically passed when running hooks,
@@ -114,51 +160,57 b' EDITOR::'
114 PYTHONPATH::
160 PYTHONPATH::
115 This is used by Python to find imported modules and may need to be set
161 This is used by Python to find imported modules and may need to be set
116 appropriately if Mercurial is not installed system-wide.
162 appropriately if Mercurial is not installed system-wide.
117 ''',
163 '''),
118
164
119 "patterns|File Name Patterns": r'''
165 ('revs|revisions|Specifying Single Revisions',
120 Mercurial accepts several notations for identifying one or more
166 r'''
121 files at a time.
167 Mercurial accepts several notations for identifying individual
168 revisions.
122
169
123 By default, Mercurial treats filenames as shell-style extended
170 A plain integer is treated as a revision number. Negative
124 glob patterns.
171 integers are treated as offsets from the tip, with -1 denoting the
125
172 tip.
126 Alternate pattern notations must be specified explicitly.
127
173
128 To use a plain path name without any pattern matching, start a
174 A 40-digit hexadecimal string is treated as a unique revision
129 name with "path:". These path names must match completely, from
175 identifier.
130 the root of the current repository.
131
176
132 To use an extended glob, start a name with "glob:". Globs are
177 A hexadecimal string less than 40 characters long is treated as a
133 rooted at the current directory; a glob such as "*.c" will match
178 unique revision identifier, and referred to as a short-form
134 files ending in ".c" in the current directory only.
179 identifier. A short-form identifier is only valid if it is the
180 prefix of one full-length identifier.
135
181
136 The supported glob syntax extensions are "**" to match any string
182 Any other string is treated as a tag name, which is a symbolic
137 across path separators, and "{a,b}" to mean "a or b".
183 name associated with a revision identifier. Tag names may not
184 contain the ":" character.
185
186 The reserved name "tip" is a special tag that always identifies
187 the most recent revision.
138
188
139 To use a Perl/Python regular expression, start a name with "re:".
189 The reserved name "null" indicates the null revision. This is the
140 Regexp pattern matching is anchored at the root of the repository.
190 revision of an empty repository, and the parent of revision 0.
141
142 Plain examples:
143
191
144 path:foo/bar a name bar in a directory named foo in the root of
192 The reserved name "." indicates the working directory parent. If
145 the repository
193 no working directory is checked out, it is equivalent to null.
146 path:path:name a file or directory named "path:name"
194 If an uncommitted merge is in progress, "." is the revision of
147
195 the first parent.
148 Glob examples:
196 '''),
149
197
150 glob:*.c any name ending in ".c" in the current directory
198 ('mrevs|multirevs|Specifying Multiple Revisions',
151 *.c any name ending in ".c" in the current directory
199 r'''
152 **.c any name ending in ".c" in the current directory, or
200 When Mercurial accepts more than one revision, they may be
153 any subdirectory
201 specified individually, or provided as a continuous range,
154 foo/*.c any name ending in ".c" in the directory foo
202 separated by the ":" character.
155 foo/**.c any name ending in ".c" in the directory foo, or any
156 subdirectory
157
203
158 Regexp examples:
204 The syntax of range notation is [BEGIN]:[END], where BEGIN and END
159
205 are revision identifiers. Both BEGIN and END are optional. If
160 re:.*\.c$ any name ending in ".c", anywhere in the repository
206 BEGIN is not specified, it defaults to revision number 0. If END
207 is not specified, it defaults to the tip. The range ":" thus
208 means "all revisions".
161
209
162 ''',
210 If BEGIN is greater than END, revisions are treated in reverse
163 }
211 order.
164
212
213 A range acts as a closed interval. This means that a range of 3:5
214 gives 3, 4 and 5. Similarly, a range of 4:2 gives 4, 3, and 2.
215 '''),
216 )
@@ -472,6 +472,7 b' def annotate(web, req, tmpl):'
472 "node": hex(f.node()),
472 "node": hex(f.node()),
473 "rev": f.rev(),
473 "rev": f.rev(),
474 "author": f.user(),
474 "author": f.user(),
475 "desc": f.description(),
475 "file": f.path(),
476 "file": f.path(),
476 "targetline": targetline,
477 "targetline": targetline,
477 "line": l,
478 "line": l,
@@ -1985,7 +1985,7 b' class localrepository(repo.repository):'
1985 self.ui.status(_("adding changesets\n"))
1985 self.ui.status(_("adding changesets\n"))
1986 cor = cl.count() - 1
1986 cor = cl.count() - 1
1987 chunkiter = changegroup.chunkiter(source)
1987 chunkiter = changegroup.chunkiter(source)
1988 if cl.addgroup(chunkiter, csmap, trp, 1) is None and not emptyok:
1988 if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok:
1989 raise util.Abort(_("received changelog group is empty"))
1989 raise util.Abort(_("received changelog group is empty"))
1990 cnr = cl.count() - 1
1990 cnr = cl.count() - 1
1991 changesets = cnr - cor
1991 changesets = cnr - cor
@@ -1133,7 +1133,7 b' class revlog(object):'
1133
1133
1134 yield changegroup.closechunk()
1134 yield changegroup.closechunk()
1135
1135
1136 def addgroup(self, revs, linkmapper, transaction, unique=0):
1136 def addgroup(self, revs, linkmapper, transaction):
1137 """
1137 """
1138 add a delta group
1138 add a delta group
1139
1139
@@ -1170,8 +1170,6 b' class revlog(object):'
1170 link = linkmapper(cs)
1170 link = linkmapper(cs)
1171 if node in self.nodemap:
1171 if node in self.nodemap:
1172 # this can happen if two branches make the same change
1172 # this can happen if two branches make the same change
1173 # if unique:
1174 # raise RevlogError(_("already have %s") % hex(node[:4]))
1175 chain = node
1173 chain = node
1176 continue
1174 continue
1177 delta = buffer(chunk, 80)
1175 delta = buffer(chunk, 80)
@@ -30,7 +30,7 b' filelog = filelog.tmpl'
30 fileline = '<tr class="parity{parity}"><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
30 fileline = '<tr class="parity{parity}"><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
31 filelogentry = filelogentry.tmpl
31 filelogentry = filelogentry.tmpl
32
32
33 annotateline = '<tr class="parity{parity}"><td class="annotate"><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}">{author|user}@{rev}</a></td><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
33 annotateline = '<tr class="parity{parity}"><td class="annotate"><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}" title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a></td><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
34
34
35 diffblock = '<table class="bigtable parity{parity}">{lines}</table>'
35 diffblock = '<table class="bigtable parity{parity}">{lines}</table>'
36 difflineplus = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source plusline">{line|escape}</td></tr>'
36 difflineplus = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source plusline">{line|escape}</td></tr>'
@@ -24,7 +24,7 b' fileannotate = fileannotate.tmpl'
24 filediff = filediff.tmpl
24 filediff = filediff.tmpl
25 filelog = filelog.tmpl
25 filelog = filelog.tmpl
26 fileline = '<div style="font-family:monospace" class="parity#parity#"><pre><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</pre></div>'
26 fileline = '<div style="font-family:monospace" class="parity#parity#"><pre><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</pre></div>'
27 annotateline = '<tr style="font-family:monospace" class="parity#parity#"><td class="linenr" style="text-align: right;"><a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}#l{targetline}">#author|user#@#rev#</a></td><td><pre><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a></pre></td><td><pre>#line|escape#</pre></td></tr>'
27 annotateline = '<tr style="font-family:monospace" class="parity#parity#"><td class="linenr" style="text-align: right;"><a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}#l{targetline}" title="{node|short}: {desc|escape|firstline}">#author|user#@#rev#</a></td><td><pre><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a></pre></td><td><pre>#line|escape#</pre></td></tr>'
28 difflineplus = '<span style="color:#008800;"><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</span>'
28 difflineplus = '<span style="color:#008800;"><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</span>'
29 difflineminus = '<span style="color:#cc0000;"><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</span>'
29 difflineminus = '<span style="color:#cc0000;"><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</span>'
30 difflineat = '<span style="color:#990099;"><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</span>'
30 difflineat = '<span style="color:#990099;"><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</span>'
@@ -24,7 +24,7 b' filediff = filediff.tmpl'
24 filelog = filelog.tmpl
24 filelog = filelog.tmpl
25 fileline = '<div class="parity#parity#"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</div>'
25 fileline = '<div class="parity#parity#"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</div>'
26 filelogentry = filelogentry.tmpl
26 filelogentry = filelogentry.tmpl
27 annotateline = '<tr class="parity#parity#"><td class="annotate"><a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}#l{targetline}">#author|user#@#rev#</a></td><td><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a></td><td><pre>#line|escape#</pre></td></tr>'
27 annotateline = '<tr class="parity#parity#"><td class="annotate"><a href="#url#annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}#l{targetline}" title="{node|short}: {desc|escape|firstline}">#author|user#@#rev#</a></td><td><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a></td><td><pre>#line|escape#</pre></td></tr>'
28 difflineplus = '<span class="plusline"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</span>'
28 difflineplus = '<span class="plusline"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</span>'
29 difflineminus = '<span class="minusline"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</span>'
29 difflineminus = '<span class="minusline"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</span>'
30 difflineat = '<span class="atline"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</span>'
30 difflineat = '<span class="atline"><a class="lineno" href="##lineid#" id="#lineid#">#linenumber#</a>#line|escape#</span>'
@@ -33,6 +33,13 b' list of commands:'
33 debugfoobar:
33 debugfoobar:
34 yet another debug command
34 yet another debug command
35
35
36 special help topics:
37 dates Date Formats
38 patterns File Name Patterns
39 environment, env Environment Variables
40 revs, revisions Specifying Single Revisions
41 mrevs, multirevs Specifying Multiple Revisions
42
36 global options:
43 global options:
37 -R --repository repository root directory or symbolic path name
44 -R --repository repository root directory or symbolic path name
38 --cwd change working directory
45 --cwd change working directory
@@ -114,7 +114,7 b' 200 Script output follows'
114 <br/>
114 <br/>
115
115
116 <table cellspacing="0" cellpadding="0">
116 <table cellspacing="0" cellpadding="0">
117 <tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l1">test@0</a></td><td><a class="lineno" href="#l1" id="l1"> 1</a></td><td><pre><span class="c">#!/usr/bin/env python</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l2">test@0</a></td><td><a class="lineno" href="#l2" id="l2"> 2</a></td><td><pre></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l3">test@0</a></td><td><a class="lineno" href="#l3" id="l3"> 3</a></td><td><pre><span class="n">__doc__</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;This does HTTP get requests given a host:port and path and returns</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l4">test@0</a></td><td><a class="lineno" href="#l4" id="l4"> 4</a></td><td><pre><span class="s">a subset of the headers plus the body of the result.&quot;&quot;&quot;</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l5">test@0</a></td><td><a class="lineno" href="#l5" id="l5"> 5</a></td><td><pre></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l6">test@0</a></td><td><a class="lineno" href="#l6" id="l6"> 6</a></td><td><pre><span class="k">import</span> <span class="nn">httplib</span><span class="o">,</span> <span class="nn">sys</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l7">test@0</a></td><td><a class="lineno" href="#l7" id="l7"> 7</a></td><td><pre><span class="n">headers</span> <span class="o">=</span> <span class="p">[</span><span class="n">h</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">3</span><span class="p">:]]</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l8">test@0</a></td><td><a class="lineno" href="#l8" id="l8"> 8</a></td><td><pre><span class="n">conn</span> <span class="o">=</span> <span class="n">httplib</span><span class="o">.</span><span class="n">HTTPConnection</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l9">test@0</a></td><td><a class="lineno" href="#l9" id="l9"> 9</a></td><td><pre><span class="n">conn</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">2</span><span class="p">])</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l10">test@0</a></td><td><a class="lineno" href="#l10" id="l10"> 10</a></td><td><pre><span class="n">response</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">getresponse</span><span class="p">()</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l11">test@0</a></td><td><a class="lineno" href="#l11" id="l11"> 11</a></td><td><pre><span class="k">print</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">reason</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l12">test@0</a></td><td><a class="lineno" href="#l12" id="l12"> 12</a></td><td><pre><span class="k">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">headers</span><span class="p">:</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l13">test@0</a></td><td><a class="lineno" href="#l13" id="l13"> 13</a></td><td><pre> <span class="k">if</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l14">test@0</a></td><td><a class="lineno" href="#l14" id="l14"> 14</a></td><td><pre> <span class="k">print</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">))</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l15">test@0</a></td><td><a class="lineno" href="#l15" id="l15"> 15</a></td><td><pre><span class="k">print</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l16">test@0</a></td><td><a class="lineno" href="#l16" id="l16"> 16</a></td><td><pre><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">read</span><span class="p">())</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l17">test@0</a></td><td><a class="lineno" href="#l17" id="l17"> 17</a></td><td><pre></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l18">test@0</a></td><td><a class="lineno" href="#l18" id="l18"> 18</a></td><td><pre><span class="k">if</span> <span class="mf">200</span> <span class="o">&lt;=</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span> <span class="o">&lt;=</span> <span class="mf">299</span><span class="p">:</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l19">test@0</a></td><td><a class="lineno" href="#l19" id="l19"> 19</a></td><td><pre> <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">0</span><span class="p">)</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l20">test@0</a></td><td><a class="lineno" href="#l20" id="l20"> 20</a></td><td><pre><span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span></pre></td></tr>
117 <tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l1" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l1" id="l1"> 1</a></td><td><pre><span class="c">#!/usr/bin/env python</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l2" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l2" id="l2"> 2</a></td><td><pre></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l3" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l3" id="l3"> 3</a></td><td><pre><span class="n">__doc__</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;This does HTTP get requests given a host:port and path and returns</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l4" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l4" id="l4"> 4</a></td><td><pre><span class="s">a subset of the headers plus the body of the result.&quot;&quot;&quot;</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l5" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l5" id="l5"> 5</a></td><td><pre></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l6" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l6" id="l6"> 6</a></td><td><pre><span class="k">import</span> <span class="nn">httplib</span><span class="o">,</span> <span class="nn">sys</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l7" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l7" id="l7"> 7</a></td><td><pre><span class="n">headers</span> <span class="o">=</span> <span class="p">[</span><span class="n">h</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">3</span><span class="p">:]]</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l8" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l8" id="l8"> 8</a></td><td><pre><span class="n">conn</span> <span class="o">=</span> <span class="n">httplib</span><span class="o">.</span><span class="n">HTTPConnection</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l9" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l9" id="l9"> 9</a></td><td><pre><span class="n">conn</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">2</span><span class="p">])</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l10" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l10" id="l10"> 10</a></td><td><pre><span class="n">response</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">getresponse</span><span class="p">()</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l11" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l11" id="l11"> 11</a></td><td><pre><span class="k">print</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">reason</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l12" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l12" id="l12"> 12</a></td><td><pre><span class="k">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">headers</span><span class="p">:</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l13" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l13" id="l13"> 13</a></td><td><pre> <span class="k">if</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l14" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l14" id="l14"> 14</a></td><td><pre> <span class="k">print</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">))</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l15" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l15" id="l15"> 15</a></td><td><pre><span class="k">print</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l16" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l16" id="l16"> 16</a></td><td><pre><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">read</span><span class="p">())</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l17" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l17" id="l17"> 17</a></td><td><pre></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l18" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l18" id="l18"> 18</a></td><td><pre><span class="k">if</span> <span class="mf">200</span> <span class="o">&lt;=</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span> <span class="o">&lt;=</span> <span class="mf">299</span><span class="p">:</span></pre></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l19" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l19" id="l19"> 19</a></td><td><pre> <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">0</span><span class="p">)</span></pre></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/79ee608ca36d/get-with-headers.py#l20" title="79ee608ca36d: a">test@0</a></td><td><a class="lineno" href="#l20" id="l20"> 20</a></td><td><pre><span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span></pre></td></tr>
118 </table>
118 </table>
119
119
120
120
@@ -22,4 +22,15 b' ls .hg/patches/bar'
22 hg qrename bar/renamed baz
22 hg qrename bar/renamed baz
23 hg qseries
23 hg qseries
24 ls .hg/patches/baz
24 ls .hg/patches/baz
25 cd ..
25
26
27 echo % test patch being renamed before committed
28 hg init b
29 cd b
30 hg qinit -c
31 hg qnew x
32 hg qrename y
33 hg qcommit -m rename
34 cd ..
35
36
@@ -5,3 +5,4 b' bar/renamed'
5 renamed
5 renamed
6 baz
6 baz
7 .hg/patches/baz
7 .hg/patches/baz
8 % test patch being renamed before committed
General Comments 0
You need to be logged in to leave comments. Login now