##// END OF EJS Templates
Merge with main
Martin Geisler -
r9773:d942e06d merge default
parent child Browse files
Show More
@@ -0,0 +1,34 b''
1 #!/bin/sh
2
3 hg init repo
4 cd repo
5 i=0; while [ "$i" -lt 213 ]; do echo a >> a; i=$(($i + 1)); done
6 hg add a
7
8 echo '% wide diffstat'
9 hg diff --stat
10
11 echo '% diffstat width'
12 COLUMNS=24 hg diff --config ui.interactive=true --stat
13
14 hg ci -m adda
15
16 cat >> a <<EOF
17 a
18 a
19 a
20 EOF
21
22 echo '% narrow diffstat'
23 hg diff --stat
24
25 hg ci -m appenda
26
27 printf '\0' > b
28 hg add b
29
30 echo '% binary diffstat'
31 hg diff --stat
32
33 echo '% binary git diffstat'
34 hg diff --stat --git
@@ -0,0 +1,15 b''
1 % wide diffstat
2 a | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 1 files changed, 213 insertions(+), 0 deletions(-)
4 % diffstat width
5 a | 213 ++++++++++++++
6 1 files changed, 213 insertions(+), 0 deletions(-)
7 % narrow diffstat
8 a | 3 +++
9 1 files changed, 3 insertions(+), 0 deletions(-)
10 % binary diffstat
11 b | 0
12 1 files changed, 0 insertions(+), 0 deletions(-)
13 % binary git diffstat
14 b | Bin
15 1 files changed, 0 insertions(+), 0 deletions(-)
@@ -17,7 +17,7 b' BuildRoot: %{_tmppath}/%{name}-%{version'
17 # python-devel provides an adequate python-dev. The merge tool is a
17 # python-devel provides an adequate python-dev. The merge tool is a
18 # run-time dependency.
18 # run-time dependency.
19 #
19 #
20 BuildRequires: python >= 2.4, python-devel, make, gcc, asciidoc, xmlto
20 BuildRequires: python >= 2.4, python-devel, make, gcc, docutils >= 0.5
21 Provides: hg = %{version}-%{release}
21 Provides: hg = %{version}-%{release}
22
22
23 %define pythonver %(python -c 'import sys;print ".".join(map(str, sys.version_info[:2]))')
23 %define pythonver %(python -c 'import sys;print ".".join(map(str, sys.version_info[:2]))')
@@ -2,7 +2,7 b''
2 # tcsh completion for Mercurial
2 # tcsh completion for Mercurial
3 #
3 #
4 # This file has been auto-generated by tcsh_completion_build.sh for
4 # This file has been auto-generated by tcsh_completion_build.sh for
5 # Mercurial Distributed SCM (version 1.1.2)
5 # Mercurial Distributed SCM (version 1.3.1+269-5d8125bbbbf4)
6 #
6 #
7 # Copyright (C) 2005 TK Soh.
7 # Copyright (C) 2005 TK Soh.
8 #
8 #
@@ -24,7 +24,6 b' complete hg \\'
24 --debugger \
24 --debugger \
25 --encoding \
25 --encoding \
26 --encodingmode \
26 --encodingmode \
27 --lsprof \
28 --traceback \
27 --traceback \
29 --time \
28 --time \
30 --profile \
29 --profile \
@@ -33,17 +32,18 b' complete hg \\'
33 'p/1/(add addremove annotate blame archive \
32 'p/1/(add addremove annotate blame archive \
34 backout bisect branch branches bundle \
33 backout bisect branch branches bundle \
35 cat clone commit ci copy \
34 cat clone commit ci copy \
36 cp debugancestor debugcheckstate debugcomplete debugdata \
35 cp debugancestor debugcheckstate debugcommands debugcomplete \
37 debugdate debugfsinfo debugindex debugindexdot debuginstall \
36 debugdata debugdate debugfsinfo debugindex debugindexdot \
38 debugrawcommit rawcommit debugrebuildstate debugrename debugsetparents \
37 debuginstall debugrebuildstate debugrename debugsetparents debugstate \
39 debugstate debugwalk diff export grep \
38 debugsub debugwalk diff export forget \
40 heads help identify id import \
39 grep heads help identify id \
41 patch incoming in init locate \
40 import patch incoming in init \
42 log history manifest merge outgoing \
41 locate log history manifest merge \
43 out parents paths pull push \
42 outgoing out parents paths pull \
44 recover remove rm rename mv \
43 push recover remove rm rename \
45 resolve revert rollback root serve \
44 mv resolve revert rollback root \
46 showconfig debugconfig status st tag \
45 serve showconfig debugconfig status st \
47 tags tip unbundle update up \
46 summary sum tag tags tip \
48 checkout co verify version)/'
47 unbundle update up checkout co \
48 verify version)/'
49
49
@@ -61,6 +61,7 b' Source: dist\\Microsoft.VC*.MFC.manifest;'
61 Source: dist\w9xpopen.exe; DestDir: {app}
61 Source: dist\w9xpopen.exe; DestDir: {app}
62 Source: dist\add_path.exe; DestDir: {app}
62 Source: dist\add_path.exe; DestDir: {app}
63 Source: doc\*.html; DestDir: {app}\Docs
63 Source: doc\*.html; DestDir: {app}\Docs
64 Source: doc\style.css; DestDir: {app}\Docs
64 Source: locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs
65 Source: locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs
65 Source: templates\*.*; DestDir: {app}\Templates; Flags: recursesubdirs createallsubdirs
66 Source: templates\*.*; DestDir: {app}\Templates; Flags: recursesubdirs createallsubdirs
66 Source: CONTRIBUTORS; DestDir: {app}; DestName: Contributors.txt
67 Source: CONTRIBUTORS; DestDir: {app}; DestName: Contributors.txt
@@ -47,7 +47,7 b' These URLs can all be stored in your hgr'
47 ...
47 ...
48
48
49 You can then use the alias for any command that uses a URL (for
49 You can then use the alias for any command that uses a URL (for
50 example 'hg pull alias1' would pull from the 'alias1' path).
50 example 'hg pull alias1' will be treated as 'hg pull URL1').
51
51
52 Two path aliases are special because they are used as defaults when
52 Two path aliases are special because they are used as defaults when
53 you do not provide the URL to a command:
53 you do not provide the URL to a command:
@@ -231,7 +231,7 b' def strip(oldstrip, ui, repo, node, back'
231 write(repo, marks)
231 write(repo, marks)
232
232
233 def reposetup(ui, repo):
233 def reposetup(ui, repo):
234 if not isinstance(repo, localrepo.localrepository):
234 if not repo.local():
235 return
235 return
236
236
237 # init a bookmark cache as otherwise we would get a infinite reading
237 # init a bookmark cache as otherwise we would get a infinite reading
@@ -53,14 +53,12 b' def countrate(ui, repo, amap, *pats, **o'
53 if opts.get('date'):
53 if opts.get('date'):
54 df = util.matchdate(opts['date'])
54 df = util.matchdate(opts['date'])
55
55
56 get = util.cachefunc(lambda r: repo[r])
56 m = cmdutil.match(repo, pats, opts)
57 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
57 for st, ctx, fns in cmdutil.walkchangerevs(ui, repo, m, opts):
58 for st, rev, fns in changeiter:
59
60 if not st == 'add':
58 if not st == 'add':
61 continue
59 continue
62
60
63 ctx = get(rev)
61 rev = ctx.rev()
64 if df and not df(ctx.date()[0]): # doesn't match date format
62 if df and not df(ctx.date()[0]): # doesn't match date format
65 continue
63 continue
66
64
@@ -189,9 +189,25 b' def colorshowpatch(orig, self, node):'
189 finally:
189 finally:
190 self.ui.write = oldwrite
190 self.ui.write = oldwrite
191
191
192 def colordiffstat(orig, s):
193 lines = s.split('\n')
194 for i, line in enumerate(lines):
195 if line and line[-1] in '+-':
196 name, graph = line.rsplit(' ', 1)
197 graph = graph.replace('-',
198 render_effects('-', _diff_effects['deleted']))
199 graph = graph.replace('+',
200 render_effects('+', _diff_effects['inserted']))
201 lines[i] = ' '.join([name, graph])
202 orig('\n'.join(lines))
203
192 def colordiff(orig, ui, repo, *pats, **opts):
204 def colordiff(orig, ui, repo, *pats, **opts):
193 '''run the diff command with colored output'''
205 '''run the diff command with colored output'''
194 oldwrite = extensions.wrapfunction(ui, 'write', colorwrap)
206 if opts.get('stat'):
207 wrapper = colordiffstat
208 else:
209 wrapper = colorwrap
210 oldwrite = extensions.wrapfunction(ui, 'write', wrapper)
195 try:
211 try:
196 orig(ui, repo, *pats, **opts)
212 orig(ui, repo, *pats, **opts)
197 finally:
213 finally:
@@ -103,7 +103,10 b' def convert(ui, src, dest=None, revmapfi'
103 revision control system whose parents should be modified (same
103 revision control system whose parents should be modified (same
104 format as a key in .hg/shamap). The values are the revision IDs
104 format as a key in .hg/shamap). The values are the revision IDs
105 (in either the source or destination revision control system) that
105 (in either the source or destination revision control system) that
106 should be used as the new parents for that node.
106 should be used as the new parents for that node. For example, if
107 you have merged "release-1.0" into "trunk", then you should
108 specify the revision on "trunk" as the first parent and the one on
109 the "release-1.0" branch as the second.
107
110
108 The branchmap is a file that allows you to rename a branch when it is
111 The branchmap is a file that allows you to rename a branch when it is
109 being brought in from whatever external repository. When used in
112 being brought in from whatever external repository. When used in
@@ -420,9 +420,18 b' class queue(object):'
420
420
421 def printdiff(self, repo, node1, node2=None, files=None,
421 def printdiff(self, repo, node1, node2=None, files=None,
422 fp=None, changes=None, opts={}):
422 fp=None, changes=None, opts={}):
423 stat = opts.get('stat')
424 if stat:
425 opts['unified'] = '0'
426
423 m = cmdutil.match(repo, files, opts)
427 m = cmdutil.match(repo, files, opts)
424 chunks = patch.diff(repo, node1, node2, m, changes, self.diffopts())
428 chunks = patch.diff(repo, node1, node2, m, changes, self.diffopts())
425 write = fp is None and repo.ui.write or fp.write
429 write = fp is None and repo.ui.write or fp.write
430 if stat:
431 width = self.ui.interactive() and util.termwidth() or 80
432 write(patch.diffstat(util.iterlines(chunks), width=width,
433 git=self.diffopts().git))
434 else:
426 for chunk in chunks:
435 for chunk in chunks:
427 write(chunk)
436 write(chunk)
428
437
@@ -76,9 +76,9 b' from mercurial import cmdutil, commands,'
76 from mercurial.i18n import _
76 from mercurial.i18n import _
77 from mercurial.node import bin
77 from mercurial.node import bin
78
78
79 def prompt(ui, prompt, default='', rest=': ', empty_ok=False):
79 def prompt(ui, prompt, default=None, rest=':'):
80 if not ui.interactive():
80 if not ui.interactive():
81 if default or empty_ok:
81 if default is not None:
82 return default
82 return default
83 raise util.Abort(_("%sPlease enter a valid value" % (prompt+rest)))
83 raise util.Abort(_("%s Please enter a valid value" % (prompt+rest)))
84 if default:
84 if default:
@@ -90,8 +90,6 b" def prompt(ui, prompt, default='', rest="
90 return r
90 return r
91 if default is not None:
91 if default is not None:
92 return default
92 return default
93 if empty_ok:
94 return r
95 ui.warn(_('Please enter a valid value.\n'))
93 ui.warn(_('Please enter a valid value.\n'))
96
94
97 def cdiffstat(ui, summary, patchlines):
95 def cdiffstat(ui, summary, patchlines):
@@ -333,7 +331,8 b' def patchbomb(ui, repo, *revs, **opts):'
333 subj = '[PATCH %0*d of %d %s] ' % (tlen, 0, len(patches), flag)
331 subj = '[PATCH %0*d of %d %s]' % (tlen, 0, len(patches), flag)
334 else:
332 else:
335 subj = '[PATCH %0*d of %d] ' % (tlen, 0, len(patches))
333 subj = '[PATCH %0*d of %d]' % (tlen, 0, len(patches))
336 subj += opts.get('subject') or prompt(ui, 'Subject:', rest=subj)
334 subj += ' ' + (opts.get('subject') or
335 prompt(ui, 'Subject: ', rest=subj))
337
336
338 body = ''
337 body = ''
339 if opts.get('diffstat'):
338 if opts.get('diffstat'):
@@ -50,7 +50,7 b' class bundlerevlog(revlog.revlog):'
50 continue
50 continue
51 for p in (p1, p2):
51 for p in (p1, p2):
52 if not p in self.nodemap:
52 if not p in self.nodemap:
53 raise error.LookupError(p1, self.indexfile,
53 raise error.LookupError(p, self.indexfile,
54 _("unknown parent"))
54 _("unknown parent"))
55 if linkmapper is None:
55 if linkmapper is None:
56 link = n
56 link = n
@@ -653,8 +653,6 b' class changeset_printer(object):'
653
653
654 log = self.repo.changelog
654 log = self.repo.changelog
655 date = util.datestr(ctx.date())
655 date = util.datestr(ctx.date())
656 extra = ctx.extra()
657 branch = extra.get("branch")
658
656
659 hexfunc = self.ui.debugflag and hex or short
657 hexfunc = self.ui.debugflag and hex or short
660
658
@@ -663,6 +661,7 b' class changeset_printer(object):'
663
661
664 self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode)))
662 self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode)))
665
663
664 branch = ctx.branch()
666 # don't show the default branch name
665 # don't show the default branch name
667 if branch != 'default':
666 if branch != 'default':
668 branch = encoding.tolocal(branch)
667 branch = encoding.tolocal(branch)
@@ -691,6 +690,7 b' class changeset_printer(object):'
691 copies = ['%s (%s)' % c for c in copies]
690 copies = ['%s (%s)' % c for c in copies]
692 self.ui.write(_("copies: %s\n") % ' '.join(copies))
691 self.ui.write(_("copies: %s\n") % ' '.join(copies))
693
692
693 extra = ctx.extra()
694 if extra and self.ui.debugflag:
694 if extra and self.ui.debugflag:
695 for key, value in sorted(extra.items()):
695 for key, value in sorted(extra.items()):
696 self.ui.write(_("extra: %s=%s\n")
696 self.ui.write(_("extra: %s=%s\n")
@@ -1024,9 +1024,9 b' def finddate(ui, repo, date):'
1024 """Find the tipmost changeset that matches the given date spec"""
1024 """Find the tipmost changeset that matches the given date spec"""
1025 df = util.matchdate(date)
1025 df = util.matchdate(date)
1026 get = util.cachefunc(lambda r: repo[r])
1026 get = util.cachefunc(lambda r: repo[r])
1027 changeiter, matchfn = walkchangerevs(ui, repo, [], get, {'rev':None})
1027 m = matchall(repo)
1028 results = {}
1028 results = {}
1029 for st, rev, fns in changeiter:
1029 for st, rev, fns in walkchangerevs(ui, repo, m, get, {'rev':None}):
1030 if st == 'add':
1030 if st == 'add':
1031 d = get(rev).date()
1031 d = get(rev).date()
1032 if df(d[0]):
1032 if df(d[0]):
@@ -1039,7 +1039,7 b' def finddate(ui, repo, date):'
1039
1039
1040 raise util.Abort(_("revision matching date not found"))
1040 raise util.Abort(_("revision matching date not found"))
1041
1041
1042 def walkchangerevs(ui, repo, pats, change, opts):
1042 def walkchangerevs(ui, repo, match, opts):
1043 '''Iterate over files and the revs in which they changed.
1043 '''Iterate over files and the revs in which they changed.
1044
1044
1045 Callers most commonly need to iterate backwards over the history
1045 Callers most commonly need to iterate backwards over the history
@@ -1050,12 +1050,8 b' def walkchangerevs(ui, repo, pats, chang'
1050 window, we first walk forwards to gather data, then in the desired
1050 window, we first walk forwards to gather data, then in the desired
1051 order (usually backwards) to display it.
1051 order (usually backwards) to display it.
1052
1052
1053 This function returns an (iterator, matchfn) tuple. The iterator
1053 This function returns an iterator. The iterator yields 3-tuples.
1054 yields 3-tuples. They will be of one of the following forms:
1054 They will be of one of the following forms:
1055
1056 "window", incrementing, lastrev: stepping through a window,
1057 positive if walking forwards through revs, last rev in the
1058 sequence iterated over - use to reset state for the current window
1059
1055
1060 "add", rev, fns: out-of-order traversal of the given filenames
1056 "add", rev, fns: out-of-order traversal of the given filenames
1061 fns, which changed during revision rev - use to gather data for
1057 fns, which changed during revision rev - use to gather data for
@@ -1078,11 +1074,10 b' def walkchangerevs(ui, repo, pats, chang'
1078 if windowsize < sizelimit:
1074 if windowsize < sizelimit:
1079 windowsize *= 2
1075 windowsize *= 2
1080
1076
1081 m = match(repo, pats, opts)
1082 follow = opts.get('follow') or opts.get('follow_first')
1077 follow = opts.get('follow') or opts.get('follow_first')
1083
1078
1084 if not len(repo):
1079 if not len(repo):
1085 return [], m
1080 return []
1086
1081
1087 if follow:
1082 if follow:
1088 defrange = '%s:0' % repo['.'].rev()
1083 defrange = '%s:0' % repo['.'].rev()
@@ -1090,10 +1085,11 b' def walkchangerevs(ui, repo, pats, chang'
1090 defrange = '-1:0'
1085 defrange = '-1:0'
1091 revs = revrange(repo, opts['rev'] or [defrange])
1086 revs = revrange(repo, opts['rev'] or [defrange])
1092 wanted = set()
1087 wanted = set()
1093 slowpath = m.anypats() or (m.files() and opts.get('removed'))
1088 slowpath = match.anypats() or (match.files() and opts.get('removed'))
1094 fncache = {}
1089 fncache = {}
1090 change = util.cachefunc(repo.changectx)
1095
1091
1096 if not slowpath and not m.files():
1092 if not slowpath and not match.files():
1097 # No files, no patterns. Display all revs.
1093 # No files, no patterns. Display all revs.
1098 wanted = set(revs)
1094 wanted = set(revs)
1099 copies = []
1095 copies = []
@@ -1117,7 +1113,7 b' def walkchangerevs(ui, repo, pats, chang'
1117 if rev[0] < cl_count:
1113 if rev[0] < cl_count:
1118 yield rev
1114 yield rev
1119 def iterfiles():
1115 def iterfiles():
1120 for filename in m.files():
1116 for filename in match.files():
1121 yield filename, None
1117 yield filename, None
1122 for filename_node in copies:
1118 for filename_node in copies:
1123 yield filename_node
1119 yield filename_node
@@ -1157,7 +1153,7 b' def walkchangerevs(ui, repo, pats, chang'
1157 yield change(j)
1153 yield change(j)
1158
1154
1159 for ctx in changerevgen():
1155 for ctx in changerevgen():
1160 matches = filter(m, ctx.files())
1156 matches = filter(match, ctx.files())
1161 if matches:
1157 if matches:
1162 fncache[ctx.rev()] = matches
1158 fncache[ctx.rev()] = matches
1163 wanted.add(ctx.rev())
1159 wanted.add(ctx.rev())
@@ -1210,7 +1206,7 b' def walkchangerevs(ui, repo, pats, chang'
1210 wanted.discard(x)
1206 wanted.discard(x)
1211
1207
1212 def iterate():
1208 def iterate():
1213 if follow and not m.files():
1209 if follow and not match.files():
1214 ff = followfilter(onlyfirst=opts.get('follow_first'))
1210 ff = followfilter(onlyfirst=opts.get('follow_first'))
1215 def want(rev):
1211 def want(rev):
1216 return ff.match(rev) and rev in wanted
1212 return ff.match(rev) and rev in wanted
@@ -1219,20 +1215,20 b' def walkchangerevs(ui, repo, pats, chang'
1219 return rev in wanted
1215 return rev in wanted
1220
1216
1221 for i, window in increasing_windows(0, len(revs)):
1217 for i, window in increasing_windows(0, len(revs)):
1222 yield 'window', revs[0] < revs[-1], revs[-1]
1223 nrevs = [rev for rev in revs[i:i+window] if want(rev)]
1218 nrevs = [rev for rev in revs[i:i+window] if want(rev)]
1224 for rev in sorted(nrevs):
1219 for rev in sorted(nrevs):
1225 fns = fncache.get(rev)
1220 fns = fncache.get(rev)
1221 ctx = change(rev)
1226 if not fns:
1222 if not fns:
1227 def fns_generator():
1223 def fns_generator():
1228 for f in change(rev).files():
1224 for f in ctx.files():
1229 if m(f):
1225 if match(f):
1230 yield f
1226 yield f
1231 fns = fns_generator()
1227 fns = fns_generator()
1232 yield 'add', rev, fns
1228 yield 'add', ctx, fns
1233 for rev in nrevs:
1229 for rev in nrevs:
1234 yield 'iter', rev, None
1230 yield 'iter', change(rev), None
1235 return iterate(), m
1231 return iterate()
1236
1232
1237 def commit(ui, repo, commitfunc, pats, opts):
1233 def commit(ui, repo, commitfunc, pats, opts):
1238 '''commit the specified files or all outstanding changes'''
1234 '''commit the specified files or all outstanding changes'''
@@ -1085,6 +1085,7 b' def diff(ui, repo, *pats, **opts):'
1085
1085
1086 revs = opts.get('rev')
1086 revs = opts.get('rev')
1087 change = opts.get('change')
1087 change = opts.get('change')
1088 stat = opts.get('stat')
1088
1089
1089 if revs and change:
1090 if revs and change:
1090 msg = _('cannot specify --rev and --change at the same time')
1091 msg = _('cannot specify --rev and --change at the same time')
@@ -1095,8 +1096,17 b' def diff(ui, repo, *pats, **opts):'
1095 else:
1096 else:
1096 node1, node2 = cmdutil.revpair(repo, revs)
1097 node1, node2 = cmdutil.revpair(repo, revs)
1097
1098
1099 if stat:
1100 opts['unified'] = '0'
1101 diffopts = patch.diffopts(ui, opts)
1102
1098 m = cmdutil.match(repo, pats, opts)
1103 m = cmdutil.match(repo, pats, opts)
1099 it = patch.diff(repo, node1, node2, match=m, opts=patch.diffopts(ui, opts))
1104 it = patch.diff(repo, node1, node2, match=m, opts=diffopts)
1105 if stat:
1106 width = ui.interactive() and util.termwidth() or 80
1107 ui.write(patch.diffstat(util.iterlines(it), width=width,
1108 git=diffopts.git))
1109 else:
1100 for chunk in it:
1110 for chunk in it:
1101 ui.write(chunk)
1111 ui.write(chunk)
1102
1112
@@ -1257,7 +1267,8 b' def grep(ui, repo, pattern, *pats, **opt'
1257 for i in xrange(blo, bhi):
1267 for i in xrange(blo, bhi):
1258 yield ('+', b[i])
1268 yield ('+', b[i])
1259
1269
1260 def display(fn, r, pstates, states):
1270 def display(fn, ctx, pstates, states):
1271 rev = ctx.rev()
1261 datefunc = ui.quiet and util.shortdate or util.datestr
1272 datefunc = ui.quiet and util.shortdate or util.datestr
1262 found = False
1273 found = False
1263 filerevmatches = {}
1274 filerevmatches = {}
@@ -1266,17 +1277,17 b' def grep(ui, repo, pattern, *pats, **opt'
1266 else:
1277 else:
1267 iter = [('', l) for l in states]
1278 iter = [('', l) for l in states]
1268 for change, l in iter:
1279 for change, l in iter:
1269 cols = [fn, str(r)]
1280 cols = [fn, str(rev)]
1270 if opts.get('line_number'):
1281 if opts.get('line_number'):
1271 cols.append(str(l.linenum))
1282 cols.append(str(l.linenum))
1272 if opts.get('all'):
1283 if opts.get('all'):
1273 cols.append(change)
1284 cols.append(change)
1274 if opts.get('user'):
1285 if opts.get('user'):
1275 cols.append(ui.shortuser(get(r).user()))
1286 cols.append(ui.shortuser(ctx.user()))
1276 if opts.get('date'):
1287 if opts.get('date'):
1277 cols.append(datefunc(get(r).date()))
1288 cols.append(datefunc(ctx.date()))
1278 if opts.get('files_with_matches'):
1289 if opts.get('files_with_matches'):
1279 c = (fn, r)
1290 c = (fn, rev)
1280 if c in filerevmatches:
1291 if c in filerevmatches:
1281 continue
1292 continue
1282 filerevmatches[c] = 1
1293 filerevmatches[c] = 1
@@ -1288,16 +1299,12 b' def grep(ui, repo, pattern, *pats, **opt'
1288
1299
1289 skip = {}
1300 skip = {}
1290 revfiles = {}
1301 revfiles = {}
1291 get = util.cachefunc(lambda r: repo[r])
1302 matchfn = cmdutil.match(repo, pats, opts)
1292 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
1293 found = False
1303 found = False
1294 follow = opts.get('follow')
1304 follow = opts.get('follow')
1295 for st, rev, fns in changeiter:
1305 for st, ctx, fns in cmdutil.walkchangerevs(ui, repo, matchfn, opts):
1296 if st == 'window':
1306 if st == 'add':
1297 matches.clear()
1307 rev = ctx.rev()
1298 revfiles.clear()
1299 elif st == 'add':
1300 ctx = get(rev)
1301 pctx = ctx.parents()[0]
1308 pctx = ctx.parents()[0]
1302 parent = pctx.rev()
1309 parent = pctx.rev()
1303 matches.setdefault(rev, {})
1310 matches.setdefault(rev, {})
@@ -1331,7 +1338,8 b' def grep(ui, repo, pattern, *pats, **opt'
1331 except error.LookupError:
1338 except error.LookupError:
1332 pass
1339 pass
1333 elif st == 'iter':
1340 elif st == 'iter':
1334 parent = get(rev).parents()[0].rev()
1341 rev = ctx.rev()
1342 parent = ctx.parents()[0].rev()
1335 for fn in sorted(revfiles.get(rev, [])):
1343 for fn in sorted(revfiles.get(rev, [])):
1336 states = matches[rev][fn]
1344 states = matches[rev][fn]
1337 copy = copies.get(rev, {}).get(fn)
1345 copy = copies.get(rev, {}).get(fn)
@@ -1341,12 +1349,14 b' def grep(ui, repo, pattern, *pats, **opt'
1341 continue
1349 continue
1342 pstates = matches.get(parent, {}).get(copy or fn, [])
1350 pstates = matches.get(parent, {}).get(copy or fn, [])
1343 if pstates or states:
1351 if pstates or states:
1344 r = display(fn, rev, pstates, states)
1352 r = display(fn, ctx, pstates, states)
1345 found = found or r
1353 found = found or r
1346 if r and not opts.get('all'):
1354 if r and not opts.get('all'):
1347 skip[fn] = True
1355 skip[fn] = True
1348 if copy:
1356 if copy:
1349 skip[copy] = True
1357 skip[copy] = True
1358 del matches[rev]
1359 del revfiles[rev]
1350
1360
1351 def heads(ui, repo, *branchrevs, **opts):
1361 def heads(ui, repo, *branchrevs, **opts):
1352 """show current repository heads or show branch heads
1362 """show current repository heads or show branch heads
@@ -1604,7 +1614,7 b' def help_(ui, name=None, with_version=Fa'
1604 for title, options in option_lists:
1614 for title, options in option_lists:
1605 opt_output.append(("\n%s" % title, None))
1615 opt_output.append(("\n%s" % title, None))
1606 for shortopt, longopt, default, desc in options:
1616 for shortopt, longopt, default, desc in options:
1607 if "DEPRECATED" in desc and not ui.verbose: continue
1617 if _("DEPRECATED") in desc and not ui.verbose: continue
1608 opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
1618 opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
1609 longopt and " --%s" % longopt),
1619 longopt and " --%s" % longopt),
1610 "%s%s" % (desc,
1620 "%s%s" % (desc,
@@ -1708,7 +1718,8 b' def identify(ui, repo, source=None,'
1708 def import_(ui, repo, patch1, *patches, **opts):
1718 def import_(ui, repo, patch1, *patches, **opts):
1709 """import an ordered set of patches
1719 """import an ordered set of patches
1710
1720
1711 Import a list of patches and commit them individually.
1721 Import a list of patches and commit them individually (unless
1722 --no-commit is specified).
1712
1723
1713 If there are outstanding changes in the working directory, import
1724 If there are outstanding changes in the working directory, import
1714 will abort unless given the -f/--force flag.
1725 will abort unless given the -f/--force flag.
@@ -1979,9 +1990,7 b' def log(ui, repo, *pats, **opts):'
1979 will appear in files:.
1990 will appear in files:.
1980 """
1991 """
1981
1992
1982 get = util.cachefunc(lambda r: repo[r])
1993 matchfn = cmdutil.match(repo, pats, opts)
1983 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
1984
1985 limit = cmdutil.loglimit(opts)
1994 limit = cmdutil.loglimit(opts)
1986 count = 0
1995 count = 0
1987
1996
@@ -2028,7 +2037,8 b' def log(ui, repo, *pats, **opts):'
2028 only_branches = opts.get('only_branch')
2037 only_branches = opts.get('only_branch')
2029
2038
2030 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
2039 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
2031 for st, rev, fns in changeiter:
2040 for st, ctx, fns in cmdutil.walkchangerevs(ui, repo, matchfn, opts):
2041 rev = ctx.rev()
2032 if st == 'add':
2042 if st == 'add':
2033 parents = [p for p in repo.changelog.parentrevs(rev)
2043 parents = [p for p in repo.changelog.parentrevs(rev)
2034 if p != nullrev]
2044 if p != nullrev]
@@ -2037,7 +2047,6 b' def log(ui, repo, *pats, **opts):'
2037 if opts.get('only_merges') and len(parents) != 2:
2047 if opts.get('only_merges') and len(parents) != 2:
2038 continue
2048 continue
2039
2049
2040 ctx = get(rev)
2041 if only_branches and ctx.branch() not in only_branches:
2050 if only_branches and ctx.branch() not in only_branches:
2042 continue
2051 continue
2043
2052
@@ -2070,6 +2079,7 b' def log(ui, repo, *pats, **opts):'
2070
2079
2071 elif st == 'iter':
2080 elif st == 'iter':
2072 if count == limit: break
2081 if count == limit: break
2082
2073 if displayer.flush(rev):
2083 if displayer.flush(rev):
2074 count += 1
2084 count += 1
2075
2085
@@ -2298,6 +2308,8 b' def pull(ui, repo, source="default", **o'
2298 raise util.Abort(err)
2308 raise util.Abort(err)
2299
2309
2300 modheads = repo.pull(other, heads=revs, force=opts.get('force'))
2310 modheads = repo.pull(other, heads=revs, force=opts.get('force'))
2311 if checkout:
2312 checkout = str(repo.changelog.rev(other.lookup(checkout)))
2301 return postincoming(ui, repo, modheads, opts.get('update'), checkout)
2313 return postincoming(ui, repo, modheads, opts.get('update'), checkout)
2302
2314
2303 def push(ui, repo, dest=None, **opts):
2315 def push(ui, repo, dest=None, **opts):
@@ -2433,7 +2445,7 b' def rename(ui, repo, *pats, **opts):'
2433 def resolve(ui, repo, *pats, **opts):
2445 def resolve(ui, repo, *pats, **opts):
2434 """retry file merges from a merge or update
2446 """retry file merges from a merge or update
2435
2447
2436 This command will cleanly retry unresolved file merges using file
2448 This command can cleanly retry unresolved file merges using file
2437 revisions preserved from the last update or merge. To attempt to
2449 revisions preserved from the last update or merge. To attempt to
2438 resolve all unresolved files, use the -a/--all switch.
2450 resolve all unresolved files, use the -a/--all switch.
2439
2451
@@ -2451,7 +2463,8 b' def resolve(ui, repo, *pats, **opts):'
2451 R = resolved
2463 R = resolved
2452 """
2464 """
2453
2465
2454 all, mark, unmark, show = [opts.get(o) for o in 'all mark unmark list'.split()]
2466 all, mark, unmark, show, nostatus = \
2467 [opts.get(o) for o in 'all mark unmark list no_status'.split()]
2455
2468
2456 if (show and (mark or unmark)) or (mark and unmark):
2469 if (show and (mark or unmark)) or (mark and unmark):
2457 raise util.Abort(_("too many options specified"))
2470 raise util.Abort(_("too many options specified"))
@@ -2467,6 +2480,9 b' def resolve(ui, repo, *pats, **opts):'
2467 for f in ms:
2480 for f in ms:
2468 if m(f):
2481 if m(f):
2469 if show:
2482 if show:
2483 if nostatus:
2484 ui.write("%s\n" % f)
2485 else:
2470 ui.write("%s %s\n" % (ms[f].upper(), f))
2486 ui.write("%s %s\n" % (ms[f].upper(), f))
2471 elif mark:
2487 elif mark:
2472 ms.mark(f, "r")
2488 ms.mark(f, "r")
@@ -3260,7 +3276,8 b' diffopts2 = ['
3260 _('ignore changes in the amount of white space')),
3276 _('ignore changes in the amount of white space')),
3261 ('B', 'ignore-blank-lines', None,
3277 ('B', 'ignore-blank-lines', None,
3262 _('ignore changes whose lines are all blank')),
3278 _('ignore changes whose lines are all blank')),
3263 ('U', 'unified', '', _('number of lines of context to show'))
3279 ('U', 'unified', '', _('number of lines of context to show')),
3280 ('', 'stat', None, _('output diffstat-style summary of changes')),
3264 ]
3281 ]
3265
3282
3266 similarityopts = [
3283 similarityopts = [
@@ -3475,7 +3492,7 b' table = {'
3475 ('n', 'newest-first', None, _('show newest record first')),
3492 ('n', 'newest-first', None, _('show newest record first')),
3476 ('', 'bundle', '', _('file to store the bundles into')),
3493 ('', 'bundle', '', _('file to store the bundles into')),
3477 ('r', 'rev', [],
3494 ('r', 'rev', [],
3478 _('a specific revision up to which you would like to pull')),
3495 _('a specific remote revision up to which you would like to pull')),
3479 ] + logopts + remoteopts,
3496 ] + logopts + remoteopts,
3480 _('[-p] [-n] [-M] [-f] [-r REV]...'
3497 _('[-p] [-n] [-M] [-f] [-r REV]...'
3481 ' [--bundle FILENAME] [SOURCE]')),
3498 ' [--bundle FILENAME] [SOURCE]')),
@@ -3543,7 +3560,7 b' table = {'
3543 ('f', 'force', None,
3560 ('f', 'force', None,
3544 _('run even when remote repository is unrelated')),
3561 _('run even when remote repository is unrelated')),
3545 ('r', 'rev', [],
3562 ('r', 'rev', [],
3546 _('a specific revision up to which you would like to pull')),
3563 _('a specific remote revision up to which you would like to pull')),
3547 ] + remoteopts,
3564 ] + remoteopts,
3548 _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
3565 _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
3549 "^push":
3566 "^push":
@@ -3573,7 +3590,8 b' table = {'
3573 [('a', 'all', None, _('remerge all unresolved files')),
3590 [('a', 'all', None, _('remerge all unresolved files')),
3574 ('l', 'list', None, _('list state of files needing merge')),
3591 ('l', 'list', None, _('list state of files needing merge')),
3575 ('m', 'mark', None, _('mark files as resolved')),
3592 ('m', 'mark', None, _('mark files as resolved')),
3576 ('u', 'unmark', None, _('unmark files as resolved'))]
3593 ('u', 'unmark', None, _('unmark files as resolved')),
3594 ('n', 'no-status', None, _('hide status prefix'))]
3577 + walkopts,
3595 + walkopts,
3578 _('[OPTION]... [FILE]...')),
3596 _('[OPTION]... [FILE]...')),
3579 "revert":
3597 "revert":
@@ -1364,7 +1364,8 b' def diffstatdata(lines):'
1364 for line in lines:
1364 for line in lines:
1365 if line.startswith('diff'):
1365 if line.startswith('diff'):
1366 if filename:
1366 if filename:
1367 yield (filename, adds, removes)
1367 isbinary = adds == 0 and removes == 0
1368 yield (filename, adds, removes, isbinary)
1368 # set numbers to 0 anyway when starting new file
1369 # set numbers to 0 anyway when starting new file
1369 adds, removes = 0, 0
1370 adds, removes = 0, 0
1370 if line.startswith('diff --git'):
1371 if line.startswith('diff --git'):
@@ -1377,21 +1378,27 b' def diffstatdata(lines):'
1377 elif line.startswith('-') and not line.startswith('---'):
1378 elif line.startswith('-') and not line.startswith('---'):
1378 removes += 1
1379 removes += 1
1379 if filename:
1380 if filename:
1380 yield (filename, adds, removes)
1381 isbinary = adds == 0 and removes == 0
1382 yield (filename, adds, removes, isbinary)
1381
1383
1382 def diffstat(lines, width=80):
1384 def diffstat(lines, width=80, git=False):
1383 output = []
1385 output = []
1384 stats = list(diffstatdata(lines))
1386 stats = list(diffstatdata(lines))
1385
1387
1386 maxtotal, maxname = 0, 0
1388 maxtotal, maxname = 0, 0
1387 totaladds, totalremoves = 0, 0
1389 totaladds, totalremoves = 0, 0
1388 for filename, adds, removes in stats:
1390 hasbinary = False
1391 for filename, adds, removes, isbinary in stats:
1389 totaladds += adds
1392 totaladds += adds
1390 totalremoves += removes
1393 totalremoves += removes
1391 maxname = max(maxname, len(filename))
1394 maxname = max(maxname, len(filename))
1392 maxtotal = max(maxtotal, adds+removes)
1395 maxtotal = max(maxtotal, adds+removes)
1396 if isbinary:
1397 hasbinary = True
1393
1398
1394 countwidth = len(str(maxtotal))
1399 countwidth = len(str(maxtotal))
1400 if hasbinary and countwidth < 3:
1401 countwidth = 3
1395 graphwidth = width - countwidth - maxname - 6
1402 graphwidth = width - countwidth - maxname - 6
1396 if graphwidth < 10:
1403 if graphwidth < 10:
1397 graphwidth = 10
1404 graphwidth = 10
@@ -1404,11 +1411,15 b' def diffstat(lines, width=80):'
1404 # if there were at least some changes.
1411 # if there were at least some changes.
1405 return max(i * graphwidth // maxtotal, int(bool(i)))
1412 return max(i * graphwidth // maxtotal, int(bool(i)))
1406
1413
1407 for filename, adds, removes in stats:
1414 for filename, adds, removes, isbinary in stats:
1415 if git and isbinary:
1416 count = 'Bin'
1417 else:
1418 count = adds + removes
1408 pluses = '+' * scale(adds)
1419 pluses = '+' * scale(adds)
1409 minuses = '-' * scale(removes)
1420 minuses = '-' * scale(removes)
1410 output.append(' %-*s | %*.d %s%s\n' % (maxname, filename, countwidth,
1421 output.append(' %-*s | %*s %s%s\n' % (maxname, filename, countwidth,
1411 adds+removes, pluses, minuses))
1422 count, pluses, minuses))
1412
1423
1413 if stats:
1424 if stats:
1414 output.append(_(' %d files changed, %d insertions(+), %d deletions(-)\n')
1425 output.append(_(' %d files changed, %d insertions(+), %d deletions(-)\n')
@@ -27,6 +27,7 b' def _verify(repo):'
27 ui = repo.ui
27 ui = repo.ui
28 cl = repo.changelog
28 cl = repo.changelog
29 mf = repo.manifest
29 mf = repo.manifest
30 lrugetctx = util.lrucachefunc(repo.changectx)
30
31
31 if not repo.cancopy():
32 if not repo.cancopy():
32 raise util.Abort(_("cannot verify bundle or remote repos"))
33 raise util.Abort(_("cannot verify bundle or remote repos"))
@@ -78,6 +79,13 b' def _verify(repo):'
78 msg = _("rev %d points to unexpected changeset %d")
79 msg = _("rev %d points to unexpected changeset %d")
79 err(None, msg % (i, lr), f)
80 err(None, msg % (i, lr), f)
80 if linkrevs:
81 if linkrevs:
82 if f and len(linkrevs) > 1:
83 try:
84 # attempt to filter down to real linkrevs
85 linkrevs = [l for l in linkrevs
86 if lrugetctx(l)[f].filenode() == node]
87 except:
88 pass
81 warn(_(" (expected %s)") % " ".join(map(str, linkrevs)))
89 warn(_(" (expected %s)") % " ".join(map(str, linkrevs)))
82 lr = None # can't be trusted
90 lr = None # can't be trusted
83
91
@@ -136,9 +144,7 b' def _verify(repo):'
136 if not f:
144 if not f:
137 err(lr, _("file without name in manifest"))
145 err(lr, _("file without name in manifest"))
138 elif f != "/dev/null":
146 elif f != "/dev/null":
139 fns = filenodes.setdefault(f, {})
147 filenodes.setdefault(f, {}).setdefault(fn, lr)
140 if fn not in fns:
141 fns[fn] = i
142 except Exception, inst:
148 except Exception, inst:
143 exc(lr, _("reading manifest delta %s") % short(n), inst)
149 exc(lr, _("reading manifest delta %s") % short(n), inst)
144
150
@@ -173,7 +179,6 b' def _verify(repo):'
173 elif size > 0:
179 elif size > 0:
174 storefiles.add(f)
180 storefiles.add(f)
175
181
176 lrugetctx = util.lrucachefunc(repo.changectx)
177 files = sorted(set(filenodes) | set(filelinkrevs))
182 files = sorted(set(filenodes) | set(filelinkrevs))
178 for f in files:
183 for f in files:
179 try:
184 try:
@@ -250,7 +255,7 b' def _verify(repo):'
250
255
251 # cross-check
256 # cross-check
252 if f in filenodes:
257 if f in filenodes:
253 fns = [(mf.linkrev(l), n) for n,l in filenodes[f].iteritems()]
258 fns = [(lr, n) for n,lr in filenodes[f].iteritems()]
254 for lr, node in sorted(fns):
259 for lr, node in sorted(fns):
255 err(lr, _("%s in manifests not found") % short(node), f)
260 err(lr, _("%s in manifests not found") % short(node), f)
256
261
@@ -81,7 +81,10 b' convert a foreign SCM repository to a Me'
81 revision ID in the source revision control system whose parents should be
81 revision ID in the source revision control system whose parents should be
82 modified (same format as a key in .hg/shamap). The values are the revision
82 modified (same format as a key in .hg/shamap). The values are the revision
83 IDs (in either the source or destination revision control system) that
83 IDs (in either the source or destination revision control system) that
84 should be used as the new parents for that node.
84 should be used as the new parents for that node. For example, if you have
85 merged "release-1.0" into "trunk", then you should specify the revision on
86 "trunk" as the first parent and the one on the "release-1.0" branch as the
87 second.
85
88
86 The branchmap is a file that allows you to rename a branch when it is
89 The branchmap is a file that allows you to rename a branch when it is
87 being brought in from whatever external repository. When used in
90 being brought in from whatever external repository. When used in
@@ -167,7 +167,7 b' add: include, exclude, dry-run'
167 annotate: rev, follow, text, user, date, number, changeset, line-number, include, exclude
167 annotate: rev, follow, text, user, date, number, changeset, line-number, include, exclude
168 clone: noupdate, rev, pull, uncompressed, ssh, remotecmd
168 clone: noupdate, rev, pull, uncompressed, ssh, remotecmd
169 commit: addremove, close-branch, include, exclude, message, logfile, date, user
169 commit: addremove, close-branch, include, exclude, message, logfile, date, user
170 diff: rev, change, text, git, nodates, show-function, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, include, exclude
170 diff: rev, change, text, git, nodates, show-function, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude
171 export: output, switch-parent, text, git, nodates
171 export: output, switch-parent, text, git, nodates
172 forget: include, exclude
172 forget: include, exclude
173 init: ssh, remotecmd
173 init: ssh, remotecmd
@@ -218,7 +218,7 b' parents: rev, style, template'
218 paths:
218 paths:
219 recover:
219 recover:
220 rename: after, force, include, exclude, dry-run
220 rename: after, force, include, exclude, dry-run
221 resolve: all, list, mark, unmark, include, exclude
221 resolve: all, list, mark, unmark, no-status, include, exclude
222 revert: all, date, rev, no-backup, include, exclude, dry-run
222 revert: all, date, rev, no-backup, include, exclude, dry-run
223 rollback:
223 rollback:
224 root:
224 root:
@@ -35,6 +35,9 b' hg diff --nodates --color=always'
35 echo '% --unified=2'
35 echo '% --unified=2'
36 hg diff --nodates -U 2 --color=always
36 hg diff --nodates -U 2 --color=always
37
37
38 echo '% diffstat'
39 hg diff --stat --color=always
40
38 echo "record=" >> $HGRCPATH
41 echo "record=" >> $HGRCPATH
39 echo "[ui]" >> $HGRCPATH
42 echo "[ui]" >> $HGRCPATH
40 echo "interactive=true" >> $HGRCPATH
43 echo "interactive=true" >> $HGRCPATH
@@ -23,6 +23,9 b' adding a'
23 +dd
23 +dd
24 a
24 a
25 a
25 a
26 % diffstat
27 a | 2 +-
28 1 files changed, 1 insertions(+), 1 deletions(-)
26 % record
29 % record
27 diff --git a/a b/a
30 diff --git a/a b/a
28 old mode 100644
31 old mode 100644
@@ -241,6 +241,7 b' options:'
241 -b --ignore-space-change ignore changes in the amount of white space
241 -b --ignore-space-change ignore changes in the amount of white space
242 -B --ignore-blank-lines ignore changes whose lines are all blank
242 -B --ignore-blank-lines ignore changes whose lines are all blank
243 -U --unified number of lines of context to show
243 -U --unified number of lines of context to show
244 --stat output diffstat-style summary of changes
244 -I --include include names matching the given patterns
245 -I --include include names matching the given patterns
245 -X --exclude exclude names matching the given patterns
246 -X --exclude exclude names matching the given patterns
246
247
General Comments 0
You need to be logged in to leave comments. Login now