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