##// END OF EJS Templates
py3: use dict.items() instead of dict.iteritems() in tests...
Pulkit Goyal -
r36345:58c1368a default
parent child Browse files
Show More
@@ -1,78 +1,78 b''
1 # extension to emulate invoking 'dirstate.write()' at the time
1 # extension to emulate invoking 'dirstate.write()' at the time
2 # specified by '[fakedirstatewritetime] fakenow', only when
2 # specified by '[fakedirstatewritetime] fakenow', only when
3 # 'dirstate.write()' is invoked via functions below:
3 # 'dirstate.write()' is invoked via functions below:
4 #
4 #
5 # - 'workingctx._poststatusfixup()' (= 'repo.status()')
5 # - 'workingctx._poststatusfixup()' (= 'repo.status()')
6 # - 'committablectx.markcommitted()'
6 # - 'committablectx.markcommitted()'
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from mercurial import (
10 from mercurial import (
11 context,
11 context,
12 dirstate,
12 dirstate,
13 extensions,
13 extensions,
14 policy,
14 policy,
15 registrar,
15 registrar,
16 util,
16 util,
17 )
17 )
18
18
19 configtable = {}
19 configtable = {}
20 configitem = registrar.configitem(configtable)
20 configitem = registrar.configitem(configtable)
21
21
22 configitem(b'fakedirstatewritetime', b'fakenow',
22 configitem(b'fakedirstatewritetime', b'fakenow',
23 default=None,
23 default=None,
24 )
24 )
25
25
26 parsers = policy.importmod(r'parsers')
26 parsers = policy.importmod(r'parsers')
27
27
28 def pack_dirstate(fakenow, orig, dmap, copymap, pl, now):
28 def pack_dirstate(fakenow, orig, dmap, copymap, pl, now):
29 # execute what original parsers.pack_dirstate should do actually
29 # execute what original parsers.pack_dirstate should do actually
30 # for consistency
30 # for consistency
31 actualnow = int(now)
31 actualnow = int(now)
32 for f, e in dmap.iteritems():
32 for f, e in dmap.items():
33 if e[0] == 'n' and e[3] == actualnow:
33 if e[0] == 'n' and e[3] == actualnow:
34 e = parsers.dirstatetuple(e[0], e[1], e[2], -1)
34 e = parsers.dirstatetuple(e[0], e[1], e[2], -1)
35 dmap[f] = e
35 dmap[f] = e
36
36
37 return orig(dmap, copymap, pl, fakenow)
37 return orig(dmap, copymap, pl, fakenow)
38
38
39 def fakewrite(ui, func):
39 def fakewrite(ui, func):
40 # fake "now" of 'pack_dirstate' only if it is invoked while 'func'
40 # fake "now" of 'pack_dirstate' only if it is invoked while 'func'
41
41
42 fakenow = ui.config(b'fakedirstatewritetime', b'fakenow')
42 fakenow = ui.config(b'fakedirstatewritetime', b'fakenow')
43 if not fakenow:
43 if not fakenow:
44 # Execute original one, if fakenow isn't configured. This is
44 # Execute original one, if fakenow isn't configured. This is
45 # useful to prevent subrepos from executing replaced one,
45 # useful to prevent subrepos from executing replaced one,
46 # because replacing 'parsers.pack_dirstate' is also effective
46 # because replacing 'parsers.pack_dirstate' is also effective
47 # in subrepos.
47 # in subrepos.
48 return func()
48 return func()
49
49
50 # parsing 'fakenow' in YYYYmmddHHMM format makes comparison between
50 # parsing 'fakenow' in YYYYmmddHHMM format makes comparison between
51 # 'fakenow' value and 'touch -t YYYYmmddHHMM' argument easy
51 # 'fakenow' value and 'touch -t YYYYmmddHHMM' argument easy
52 fakenow = util.parsedate(fakenow, [b'%Y%m%d%H%M'])[0]
52 fakenow = util.parsedate(fakenow, [b'%Y%m%d%H%M'])[0]
53
53
54 orig_pack_dirstate = parsers.pack_dirstate
54 orig_pack_dirstate = parsers.pack_dirstate
55 orig_dirstate_getfsnow = dirstate._getfsnow
55 orig_dirstate_getfsnow = dirstate._getfsnow
56 wrapper = lambda *args: pack_dirstate(fakenow, orig_pack_dirstate, *args)
56 wrapper = lambda *args: pack_dirstate(fakenow, orig_pack_dirstate, *args)
57
57
58 parsers.pack_dirstate = wrapper
58 parsers.pack_dirstate = wrapper
59 dirstate._getfsnow = lambda *args: fakenow
59 dirstate._getfsnow = lambda *args: fakenow
60 try:
60 try:
61 return func()
61 return func()
62 finally:
62 finally:
63 parsers.pack_dirstate = orig_pack_dirstate
63 parsers.pack_dirstate = orig_pack_dirstate
64 dirstate._getfsnow = orig_dirstate_getfsnow
64 dirstate._getfsnow = orig_dirstate_getfsnow
65
65
66 def _poststatusfixup(orig, workingctx, status, fixup):
66 def _poststatusfixup(orig, workingctx, status, fixup):
67 ui = workingctx.repo().ui
67 ui = workingctx.repo().ui
68 return fakewrite(ui, lambda : orig(workingctx, status, fixup))
68 return fakewrite(ui, lambda : orig(workingctx, status, fixup))
69
69
70 def markcommitted(orig, committablectx, node):
70 def markcommitted(orig, committablectx, node):
71 ui = committablectx.repo().ui
71 ui = committablectx.repo().ui
72 return fakewrite(ui, lambda : orig(committablectx, node))
72 return fakewrite(ui, lambda : orig(committablectx, node))
73
73
74 def extsetup(ui):
74 def extsetup(ui):
75 extensions.wrapfunction(context.workingctx, '_poststatusfixup',
75 extensions.wrapfunction(context.workingctx, '_poststatusfixup',
76 _poststatusfixup)
76 _poststatusfixup)
77 extensions.wrapfunction(context.committablectx, 'markcommitted',
77 extensions.wrapfunction(context.committablectx, 'markcommitted',
78 markcommitted)
78 markcommitted)
@@ -1,114 +1,114 b''
1 from __future__ import absolute_import, print_function
1 from __future__ import absolute_import, print_function
2
2
3 from mercurial import demandimport; demandimport.enable()
3 from mercurial import demandimport; demandimport.enable()
4 from mercurial import (
4 from mercurial import (
5 error,
5 error,
6 ui as uimod,
6 ui as uimod,
7 url,
7 url,
8 util,
8 util,
9 )
9 )
10
10
11 urlerr = util.urlerr
11 urlerr = util.urlerr
12 urlreq = util.urlreq
12 urlreq = util.urlreq
13
13
14 class myui(uimod.ui):
14 class myui(uimod.ui):
15 def interactive(self):
15 def interactive(self):
16 return False
16 return False
17
17
18 origui = myui.load()
18 origui = myui.load()
19
19
20 def writeauth(items):
20 def writeauth(items):
21 ui = origui.copy()
21 ui = origui.copy()
22 for name, value in items.iteritems():
22 for name, value in items.items():
23 ui.setconfig('auth', name, value)
23 ui.setconfig('auth', name, value)
24 return ui
24 return ui
25
25
26 def dumpdict(dict):
26 def dumpdict(dict):
27 return '{' + ', '.join(['%s: %s' % (k, dict[k])
27 return '{' + ', '.join(['%s: %s' % (k, dict[k])
28 for k in sorted(dict)]) + '}'
28 for k in sorted(dict)]) + '}'
29
29
30 def test(auth, urls=None):
30 def test(auth, urls=None):
31 print('CFG:', dumpdict(auth))
31 print('CFG:', dumpdict(auth))
32 prefixes = set()
32 prefixes = set()
33 for k in auth:
33 for k in auth:
34 prefixes.add(k.split('.', 1)[0])
34 prefixes.add(k.split('.', 1)[0])
35 for p in prefixes:
35 for p in prefixes:
36 for name in ('.username', '.password'):
36 for name in ('.username', '.password'):
37 if (p + name) not in auth:
37 if (p + name) not in auth:
38 auth[p + name] = p
38 auth[p + name] = p
39 auth = dict((k, v) for k, v in auth.iteritems() if v is not None)
39 auth = dict((k, v) for k, v in auth.items() if v is not None)
40
40
41 ui = writeauth(auth)
41 ui = writeauth(auth)
42
42
43 def _test(uri):
43 def _test(uri):
44 print('URI:', uri)
44 print('URI:', uri)
45 try:
45 try:
46 pm = url.passwordmgr(ui, urlreq.httppasswordmgrwithdefaultrealm())
46 pm = url.passwordmgr(ui, urlreq.httppasswordmgrwithdefaultrealm())
47 u, authinfo = util.url(uri).authinfo()
47 u, authinfo = util.url(uri).authinfo()
48 if authinfo is not None:
48 if authinfo is not None:
49 pm.add_password(*authinfo)
49 pm.add_password(*authinfo)
50 print(' ', pm.find_user_password('test', u))
50 print(' ', pm.find_user_password('test', u))
51 except error.Abort:
51 except error.Abort:
52 print(' ','abort')
52 print(' ','abort')
53
53
54 if not urls:
54 if not urls:
55 urls = [
55 urls = [
56 'http://example.org/foo',
56 'http://example.org/foo',
57 'http://example.org/foo/bar',
57 'http://example.org/foo/bar',
58 'http://example.org/bar',
58 'http://example.org/bar',
59 'https://example.org/foo',
59 'https://example.org/foo',
60 'https://example.org/foo/bar',
60 'https://example.org/foo/bar',
61 'https://example.org/bar',
61 'https://example.org/bar',
62 'https://x@example.org/bar',
62 'https://x@example.org/bar',
63 'https://y@example.org/bar',
63 'https://y@example.org/bar',
64 ]
64 ]
65 for u in urls:
65 for u in urls:
66 _test(u)
66 _test(u)
67
67
68
68
69 print('\n*** Test in-uri schemes\n')
69 print('\n*** Test in-uri schemes\n')
70 test({'x.prefix': 'http://example.org'})
70 test({'x.prefix': 'http://example.org'})
71 test({'x.prefix': 'https://example.org'})
71 test({'x.prefix': 'https://example.org'})
72 test({'x.prefix': 'http://example.org', 'x.schemes': 'https'})
72 test({'x.prefix': 'http://example.org', 'x.schemes': 'https'})
73 test({'x.prefix': 'https://example.org', 'x.schemes': 'http'})
73 test({'x.prefix': 'https://example.org', 'x.schemes': 'http'})
74
74
75 print('\n*** Test separately configured schemes\n')
75 print('\n*** Test separately configured schemes\n')
76 test({'x.prefix': 'example.org', 'x.schemes': 'http'})
76 test({'x.prefix': 'example.org', 'x.schemes': 'http'})
77 test({'x.prefix': 'example.org', 'x.schemes': 'https'})
77 test({'x.prefix': 'example.org', 'x.schemes': 'https'})
78 test({'x.prefix': 'example.org', 'x.schemes': 'http https'})
78 test({'x.prefix': 'example.org', 'x.schemes': 'http https'})
79
79
80 print('\n*** Test prefix matching\n')
80 print('\n*** Test prefix matching\n')
81 test({'x.prefix': 'http://example.org/foo',
81 test({'x.prefix': 'http://example.org/foo',
82 'y.prefix': 'http://example.org/bar'})
82 'y.prefix': 'http://example.org/bar'})
83 test({'x.prefix': 'http://example.org/foo',
83 test({'x.prefix': 'http://example.org/foo',
84 'y.prefix': 'http://example.org/foo/bar'})
84 'y.prefix': 'http://example.org/foo/bar'})
85 test({'x.prefix': '*', 'y.prefix': 'https://example.org/bar'})
85 test({'x.prefix': '*', 'y.prefix': 'https://example.org/bar'})
86
86
87 print('\n*** Test user matching\n')
87 print('\n*** Test user matching\n')
88 test({'x.prefix': 'http://example.org/foo',
88 test({'x.prefix': 'http://example.org/foo',
89 'x.username': None,
89 'x.username': None,
90 'x.password': 'xpassword'},
90 'x.password': 'xpassword'},
91 urls=['http://y@example.org/foo'])
91 urls=['http://y@example.org/foo'])
92 test({'x.prefix': 'http://example.org/foo',
92 test({'x.prefix': 'http://example.org/foo',
93 'x.username': None,
93 'x.username': None,
94 'x.password': 'xpassword',
94 'x.password': 'xpassword',
95 'y.prefix': 'http://example.org/foo',
95 'y.prefix': 'http://example.org/foo',
96 'y.username': 'y',
96 'y.username': 'y',
97 'y.password': 'ypassword'},
97 'y.password': 'ypassword'},
98 urls=['http://y@example.org/foo'])
98 urls=['http://y@example.org/foo'])
99 test({'x.prefix': 'http://example.org/foo/bar',
99 test({'x.prefix': 'http://example.org/foo/bar',
100 'x.username': None,
100 'x.username': None,
101 'x.password': 'xpassword',
101 'x.password': 'xpassword',
102 'y.prefix': 'http://example.org/foo',
102 'y.prefix': 'http://example.org/foo',
103 'y.username': 'y',
103 'y.username': 'y',
104 'y.password': 'ypassword'},
104 'y.password': 'ypassword'},
105 urls=['http://y@example.org/foo/bar'])
105 urls=['http://y@example.org/foo/bar'])
106
106
107 def testauthinfo(fullurl, authurl):
107 def testauthinfo(fullurl, authurl):
108 print('URIs:', fullurl, authurl)
108 print('URIs:', fullurl, authurl)
109 pm = urlreq.httppasswordmgrwithdefaultrealm()
109 pm = urlreq.httppasswordmgrwithdefaultrealm()
110 pm.add_password(*util.url(fullurl).authinfo()[1])
110 pm.add_password(*util.url(fullurl).authinfo()[1])
111 print(pm.find_user_password('test', authurl))
111 print(pm.find_user_password('test', authurl))
112
112
113 print('\n*** Test urllib2 and util.url\n')
113 print('\n*** Test urllib2 and util.url\n')
114 testauthinfo('http://user@example.com:8080/foo', 'http://example.com:8080/foo')
114 testauthinfo('http://user@example.com:8080/foo', 'http://example.com:8080/foo')
@@ -1,2617 +1,2617 b''
1 Log on empty repository: checking consistency
1 Log on empty repository: checking consistency
2
2
3 $ hg init empty
3 $ hg init empty
4 $ cd empty
4 $ cd empty
5 $ hg log
5 $ hg log
6 $ hg log -r 1
6 $ hg log -r 1
7 abort: unknown revision '1'!
7 abort: unknown revision '1'!
8 [255]
8 [255]
9 $ hg log -r -1:0
9 $ hg log -r -1:0
10 abort: unknown revision '-1'!
10 abort: unknown revision '-1'!
11 [255]
11 [255]
12 $ hg log -r 'branch(name)'
12 $ hg log -r 'branch(name)'
13 abort: unknown revision 'name'!
13 abort: unknown revision 'name'!
14 [255]
14 [255]
15 $ hg log -r null -q
15 $ hg log -r null -q
16 -1:000000000000
16 -1:000000000000
17
17
18 $ cd ..
18 $ cd ..
19
19
20 The g is crafted to have 2 filelog topological heads in a linear
20 The g is crafted to have 2 filelog topological heads in a linear
21 changeset graph
21 changeset graph
22
22
23 $ hg init a
23 $ hg init a
24 $ cd a
24 $ cd a
25 $ echo a > a
25 $ echo a > a
26 $ echo f > f
26 $ echo f > f
27 $ hg ci -Ama -d '1 0'
27 $ hg ci -Ama -d '1 0'
28 adding a
28 adding a
29 adding f
29 adding f
30
30
31 $ hg cp a b
31 $ hg cp a b
32 $ hg cp f g
32 $ hg cp f g
33 $ hg ci -mb -d '2 0'
33 $ hg ci -mb -d '2 0'
34
34
35 $ mkdir dir
35 $ mkdir dir
36 $ hg mv b dir
36 $ hg mv b dir
37 $ echo g >> g
37 $ echo g >> g
38 $ echo f >> f
38 $ echo f >> f
39 $ hg ci -mc -d '3 0'
39 $ hg ci -mc -d '3 0'
40
40
41 $ hg mv a b
41 $ hg mv a b
42 $ hg cp -f f g
42 $ hg cp -f f g
43 $ echo a > d
43 $ echo a > d
44 $ hg add d
44 $ hg add d
45 $ hg ci -md -d '4 0'
45 $ hg ci -md -d '4 0'
46
46
47 $ hg mv dir/b e
47 $ hg mv dir/b e
48 $ hg ci -me -d '5 0'
48 $ hg ci -me -d '5 0'
49
49
50 Make sure largefiles doesn't interfere with logging a regular file
50 Make sure largefiles doesn't interfere with logging a regular file
51 $ hg --debug log a -T '{rev}: {desc}\n' --config extensions.largefiles=
51 $ hg --debug log a -T '{rev}: {desc}\n' --config extensions.largefiles=
52 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
52 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
53 updated patterns: .hglf/a, a
53 updated patterns: .hglf/a, a
54 0: a
54 0: a
55 $ hg log a
55 $ hg log a
56 changeset: 0:9161b9aeaf16
56 changeset: 0:9161b9aeaf16
57 user: test
57 user: test
58 date: Thu Jan 01 00:00:01 1970 +0000
58 date: Thu Jan 01 00:00:01 1970 +0000
59 summary: a
59 summary: a
60
60
61 $ hg log glob:a*
61 $ hg log glob:a*
62 changeset: 3:2ca5ba701980
62 changeset: 3:2ca5ba701980
63 user: test
63 user: test
64 date: Thu Jan 01 00:00:04 1970 +0000
64 date: Thu Jan 01 00:00:04 1970 +0000
65 summary: d
65 summary: d
66
66
67 changeset: 0:9161b9aeaf16
67 changeset: 0:9161b9aeaf16
68 user: test
68 user: test
69 date: Thu Jan 01 00:00:01 1970 +0000
69 date: Thu Jan 01 00:00:01 1970 +0000
70 summary: a
70 summary: a
71
71
72 $ hg --debug log glob:a* -T '{rev}: {desc}\n' --config extensions.largefiles=
72 $ hg --debug log glob:a* -T '{rev}: {desc}\n' --config extensions.largefiles=
73 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
73 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
74 updated patterns: glob:.hglf/a*, glob:a*
74 updated patterns: glob:.hglf/a*, glob:a*
75 3: d
75 3: d
76 0: a
76 0: a
77
77
78 log on directory
78 log on directory
79
79
80 $ hg log dir
80 $ hg log dir
81 changeset: 4:7e4639b4691b
81 changeset: 4:7e4639b4691b
82 tag: tip
82 tag: tip
83 user: test
83 user: test
84 date: Thu Jan 01 00:00:05 1970 +0000
84 date: Thu Jan 01 00:00:05 1970 +0000
85 summary: e
85 summary: e
86
86
87 changeset: 2:f8954cd4dc1f
87 changeset: 2:f8954cd4dc1f
88 user: test
88 user: test
89 date: Thu Jan 01 00:00:03 1970 +0000
89 date: Thu Jan 01 00:00:03 1970 +0000
90 summary: c
90 summary: c
91
91
92 $ hg log somethingthatdoesntexist dir
92 $ hg log somethingthatdoesntexist dir
93 changeset: 4:7e4639b4691b
93 changeset: 4:7e4639b4691b
94 tag: tip
94 tag: tip
95 user: test
95 user: test
96 date: Thu Jan 01 00:00:05 1970 +0000
96 date: Thu Jan 01 00:00:05 1970 +0000
97 summary: e
97 summary: e
98
98
99 changeset: 2:f8954cd4dc1f
99 changeset: 2:f8954cd4dc1f
100 user: test
100 user: test
101 date: Thu Jan 01 00:00:03 1970 +0000
101 date: Thu Jan 01 00:00:03 1970 +0000
102 summary: c
102 summary: c
103
103
104
104
105 -X, with explicit path
105 -X, with explicit path
106
106
107 $ hg log a -X a
107 $ hg log a -X a
108
108
109 -f, non-existent directory
109 -f, non-existent directory
110
110
111 $ hg log -f dir
111 $ hg log -f dir
112 abort: cannot follow file not in parent revision: "dir"
112 abort: cannot follow file not in parent revision: "dir"
113 [255]
113 [255]
114
114
115 -f, directory
115 -f, directory
116
116
117 $ hg up -q 3
117 $ hg up -q 3
118 $ hg log -f dir
118 $ hg log -f dir
119 changeset: 2:f8954cd4dc1f
119 changeset: 2:f8954cd4dc1f
120 user: test
120 user: test
121 date: Thu Jan 01 00:00:03 1970 +0000
121 date: Thu Jan 01 00:00:03 1970 +0000
122 summary: c
122 summary: c
123
123
124 -f, directory with --patch
124 -f, directory with --patch
125
125
126 $ hg log -f dir -p
126 $ hg log -f dir -p
127 changeset: 2:f8954cd4dc1f
127 changeset: 2:f8954cd4dc1f
128 user: test
128 user: test
129 date: Thu Jan 01 00:00:03 1970 +0000
129 date: Thu Jan 01 00:00:03 1970 +0000
130 summary: c
130 summary: c
131
131
132 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
132 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
133 --- /dev/null* (glob)
133 --- /dev/null* (glob)
134 +++ b/dir/b* (glob)
134 +++ b/dir/b* (glob)
135 @@ -0,0 +1,1 @@
135 @@ -0,0 +1,1 @@
136 +a
136 +a
137
137
138
138
139 -f, pattern
139 -f, pattern
140
140
141 $ hg log -f -I 'dir**' -p
141 $ hg log -f -I 'dir**' -p
142 changeset: 2:f8954cd4dc1f
142 changeset: 2:f8954cd4dc1f
143 user: test
143 user: test
144 date: Thu Jan 01 00:00:03 1970 +0000
144 date: Thu Jan 01 00:00:03 1970 +0000
145 summary: c
145 summary: c
146
146
147 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
147 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
148 --- /dev/null* (glob)
148 --- /dev/null* (glob)
149 +++ b/dir/b* (glob)
149 +++ b/dir/b* (glob)
150 @@ -0,0 +1,1 @@
150 @@ -0,0 +1,1 @@
151 +a
151 +a
152
152
153 $ hg up -q 4
153 $ hg up -q 4
154
154
155 -f, a wrong style
155 -f, a wrong style
156
156
157 $ hg log -f -l1 --style something
157 $ hg log -f -l1 --style something
158 abort: style 'something' not found
158 abort: style 'something' not found
159 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
159 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
160 [255]
160 [255]
161
161
162 -f, phases style
162 -f, phases style
163
163
164
164
165 $ hg log -f -l1 --style phases
165 $ hg log -f -l1 --style phases
166 changeset: 4:7e4639b4691b
166 changeset: 4:7e4639b4691b
167 tag: tip
167 tag: tip
168 phase: draft
168 phase: draft
169 user: test
169 user: test
170 date: Thu Jan 01 00:00:05 1970 +0000
170 date: Thu Jan 01 00:00:05 1970 +0000
171 summary: e
171 summary: e
172
172
173
173
174 $ hg log -f -l1 --style phases -q
174 $ hg log -f -l1 --style phases -q
175 4:7e4639b4691b
175 4:7e4639b4691b
176
176
177 -f, but no args
177 -f, but no args
178
178
179 $ hg log -f
179 $ hg log -f
180 changeset: 4:7e4639b4691b
180 changeset: 4:7e4639b4691b
181 tag: tip
181 tag: tip
182 user: test
182 user: test
183 date: Thu Jan 01 00:00:05 1970 +0000
183 date: Thu Jan 01 00:00:05 1970 +0000
184 summary: e
184 summary: e
185
185
186 changeset: 3:2ca5ba701980
186 changeset: 3:2ca5ba701980
187 user: test
187 user: test
188 date: Thu Jan 01 00:00:04 1970 +0000
188 date: Thu Jan 01 00:00:04 1970 +0000
189 summary: d
189 summary: d
190
190
191 changeset: 2:f8954cd4dc1f
191 changeset: 2:f8954cd4dc1f
192 user: test
192 user: test
193 date: Thu Jan 01 00:00:03 1970 +0000
193 date: Thu Jan 01 00:00:03 1970 +0000
194 summary: c
194 summary: c
195
195
196 changeset: 1:d89b0a12d229
196 changeset: 1:d89b0a12d229
197 user: test
197 user: test
198 date: Thu Jan 01 00:00:02 1970 +0000
198 date: Thu Jan 01 00:00:02 1970 +0000
199 summary: b
199 summary: b
200
200
201 changeset: 0:9161b9aeaf16
201 changeset: 0:9161b9aeaf16
202 user: test
202 user: test
203 date: Thu Jan 01 00:00:01 1970 +0000
203 date: Thu Jan 01 00:00:01 1970 +0000
204 summary: a
204 summary: a
205
205
206
206
207 one rename
207 one rename
208
208
209 $ hg up -q 2
209 $ hg up -q 2
210 $ hg log -vf a
210 $ hg log -vf a
211 changeset: 0:9161b9aeaf16
211 changeset: 0:9161b9aeaf16
212 user: test
212 user: test
213 date: Thu Jan 01 00:00:01 1970 +0000
213 date: Thu Jan 01 00:00:01 1970 +0000
214 files: a f
214 files: a f
215 description:
215 description:
216 a
216 a
217
217
218
218
219
219
220 many renames
220 many renames
221
221
222 $ hg up -q tip
222 $ hg up -q tip
223 $ hg log -vf e
223 $ hg log -vf e
224 changeset: 4:7e4639b4691b
224 changeset: 4:7e4639b4691b
225 tag: tip
225 tag: tip
226 user: test
226 user: test
227 date: Thu Jan 01 00:00:05 1970 +0000
227 date: Thu Jan 01 00:00:05 1970 +0000
228 files: dir/b e
228 files: dir/b e
229 description:
229 description:
230 e
230 e
231
231
232
232
233 changeset: 2:f8954cd4dc1f
233 changeset: 2:f8954cd4dc1f
234 user: test
234 user: test
235 date: Thu Jan 01 00:00:03 1970 +0000
235 date: Thu Jan 01 00:00:03 1970 +0000
236 files: b dir/b f g
236 files: b dir/b f g
237 description:
237 description:
238 c
238 c
239
239
240
240
241 changeset: 1:d89b0a12d229
241 changeset: 1:d89b0a12d229
242 user: test
242 user: test
243 date: Thu Jan 01 00:00:02 1970 +0000
243 date: Thu Jan 01 00:00:02 1970 +0000
244 files: b g
244 files: b g
245 description:
245 description:
246 b
246 b
247
247
248
248
249 changeset: 0:9161b9aeaf16
249 changeset: 0:9161b9aeaf16
250 user: test
250 user: test
251 date: Thu Jan 01 00:00:01 1970 +0000
251 date: Thu Jan 01 00:00:01 1970 +0000
252 files: a f
252 files: a f
253 description:
253 description:
254 a
254 a
255
255
256
256
257
257
258
258
259 log -pf dir/b
259 log -pf dir/b
260
260
261 $ hg up -q 3
261 $ hg up -q 3
262 $ hg log -pf dir/b
262 $ hg log -pf dir/b
263 changeset: 2:f8954cd4dc1f
263 changeset: 2:f8954cd4dc1f
264 user: test
264 user: test
265 date: Thu Jan 01 00:00:03 1970 +0000
265 date: Thu Jan 01 00:00:03 1970 +0000
266 summary: c
266 summary: c
267
267
268 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
268 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
269 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
269 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
270 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
270 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
271 @@ -0,0 +1,1 @@
271 @@ -0,0 +1,1 @@
272 +a
272 +a
273
273
274 changeset: 1:d89b0a12d229
274 changeset: 1:d89b0a12d229
275 user: test
275 user: test
276 date: Thu Jan 01 00:00:02 1970 +0000
276 date: Thu Jan 01 00:00:02 1970 +0000
277 summary: b
277 summary: b
278
278
279 diff -r 9161b9aeaf16 -r d89b0a12d229 b
279 diff -r 9161b9aeaf16 -r d89b0a12d229 b
280 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
280 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
281 +++ b/b Thu Jan 01 00:00:02 1970 +0000
281 +++ b/b Thu Jan 01 00:00:02 1970 +0000
282 @@ -0,0 +1,1 @@
282 @@ -0,0 +1,1 @@
283 +a
283 +a
284
284
285 changeset: 0:9161b9aeaf16
285 changeset: 0:9161b9aeaf16
286 user: test
286 user: test
287 date: Thu Jan 01 00:00:01 1970 +0000
287 date: Thu Jan 01 00:00:01 1970 +0000
288 summary: a
288 summary: a
289
289
290 diff -r 000000000000 -r 9161b9aeaf16 a
290 diff -r 000000000000 -r 9161b9aeaf16 a
291 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
291 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
292 +++ b/a Thu Jan 01 00:00:01 1970 +0000
292 +++ b/a Thu Jan 01 00:00:01 1970 +0000
293 @@ -0,0 +1,1 @@
293 @@ -0,0 +1,1 @@
294 +a
294 +a
295
295
296
296
297 log -pf b inside dir
297 log -pf b inside dir
298
298
299 $ hg --cwd=dir log -pf b
299 $ hg --cwd=dir log -pf b
300 changeset: 2:f8954cd4dc1f
300 changeset: 2:f8954cd4dc1f
301 user: test
301 user: test
302 date: Thu Jan 01 00:00:03 1970 +0000
302 date: Thu Jan 01 00:00:03 1970 +0000
303 summary: c
303 summary: c
304
304
305 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
305 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
306 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
306 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
307 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
307 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
308 @@ -0,0 +1,1 @@
308 @@ -0,0 +1,1 @@
309 +a
309 +a
310
310
311 changeset: 1:d89b0a12d229
311 changeset: 1:d89b0a12d229
312 user: test
312 user: test
313 date: Thu Jan 01 00:00:02 1970 +0000
313 date: Thu Jan 01 00:00:02 1970 +0000
314 summary: b
314 summary: b
315
315
316 diff -r 9161b9aeaf16 -r d89b0a12d229 b
316 diff -r 9161b9aeaf16 -r d89b0a12d229 b
317 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
317 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
318 +++ b/b Thu Jan 01 00:00:02 1970 +0000
318 +++ b/b Thu Jan 01 00:00:02 1970 +0000
319 @@ -0,0 +1,1 @@
319 @@ -0,0 +1,1 @@
320 +a
320 +a
321
321
322 changeset: 0:9161b9aeaf16
322 changeset: 0:9161b9aeaf16
323 user: test
323 user: test
324 date: Thu Jan 01 00:00:01 1970 +0000
324 date: Thu Jan 01 00:00:01 1970 +0000
325 summary: a
325 summary: a
326
326
327 diff -r 000000000000 -r 9161b9aeaf16 a
327 diff -r 000000000000 -r 9161b9aeaf16 a
328 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
328 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
329 +++ b/a Thu Jan 01 00:00:01 1970 +0000
329 +++ b/a Thu Jan 01 00:00:01 1970 +0000
330 @@ -0,0 +1,1 @@
330 @@ -0,0 +1,1 @@
331 +a
331 +a
332
332
333
333
334 log -pf, but no args
334 log -pf, but no args
335
335
336 $ hg log -pf
336 $ hg log -pf
337 changeset: 3:2ca5ba701980
337 changeset: 3:2ca5ba701980
338 user: test
338 user: test
339 date: Thu Jan 01 00:00:04 1970 +0000
339 date: Thu Jan 01 00:00:04 1970 +0000
340 summary: d
340 summary: d
341
341
342 diff -r f8954cd4dc1f -r 2ca5ba701980 a
342 diff -r f8954cd4dc1f -r 2ca5ba701980 a
343 --- a/a Thu Jan 01 00:00:03 1970 +0000
343 --- a/a Thu Jan 01 00:00:03 1970 +0000
344 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
344 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
345 @@ -1,1 +0,0 @@
345 @@ -1,1 +0,0 @@
346 -a
346 -a
347 diff -r f8954cd4dc1f -r 2ca5ba701980 b
347 diff -r f8954cd4dc1f -r 2ca5ba701980 b
348 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
348 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
349 +++ b/b Thu Jan 01 00:00:04 1970 +0000
349 +++ b/b Thu Jan 01 00:00:04 1970 +0000
350 @@ -0,0 +1,1 @@
350 @@ -0,0 +1,1 @@
351 +a
351 +a
352 diff -r f8954cd4dc1f -r 2ca5ba701980 d
352 diff -r f8954cd4dc1f -r 2ca5ba701980 d
353 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
353 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
354 +++ b/d Thu Jan 01 00:00:04 1970 +0000
354 +++ b/d Thu Jan 01 00:00:04 1970 +0000
355 @@ -0,0 +1,1 @@
355 @@ -0,0 +1,1 @@
356 +a
356 +a
357 diff -r f8954cd4dc1f -r 2ca5ba701980 g
357 diff -r f8954cd4dc1f -r 2ca5ba701980 g
358 --- a/g Thu Jan 01 00:00:03 1970 +0000
358 --- a/g Thu Jan 01 00:00:03 1970 +0000
359 +++ b/g Thu Jan 01 00:00:04 1970 +0000
359 +++ b/g Thu Jan 01 00:00:04 1970 +0000
360 @@ -1,2 +1,2 @@
360 @@ -1,2 +1,2 @@
361 f
361 f
362 -g
362 -g
363 +f
363 +f
364
364
365 changeset: 2:f8954cd4dc1f
365 changeset: 2:f8954cd4dc1f
366 user: test
366 user: test
367 date: Thu Jan 01 00:00:03 1970 +0000
367 date: Thu Jan 01 00:00:03 1970 +0000
368 summary: c
368 summary: c
369
369
370 diff -r d89b0a12d229 -r f8954cd4dc1f b
370 diff -r d89b0a12d229 -r f8954cd4dc1f b
371 --- a/b Thu Jan 01 00:00:02 1970 +0000
371 --- a/b Thu Jan 01 00:00:02 1970 +0000
372 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
372 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
373 @@ -1,1 +0,0 @@
373 @@ -1,1 +0,0 @@
374 -a
374 -a
375 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
375 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
376 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
376 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
377 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
377 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
378 @@ -0,0 +1,1 @@
378 @@ -0,0 +1,1 @@
379 +a
379 +a
380 diff -r d89b0a12d229 -r f8954cd4dc1f f
380 diff -r d89b0a12d229 -r f8954cd4dc1f f
381 --- a/f Thu Jan 01 00:00:02 1970 +0000
381 --- a/f Thu Jan 01 00:00:02 1970 +0000
382 +++ b/f Thu Jan 01 00:00:03 1970 +0000
382 +++ b/f Thu Jan 01 00:00:03 1970 +0000
383 @@ -1,1 +1,2 @@
383 @@ -1,1 +1,2 @@
384 f
384 f
385 +f
385 +f
386 diff -r d89b0a12d229 -r f8954cd4dc1f g
386 diff -r d89b0a12d229 -r f8954cd4dc1f g
387 --- a/g Thu Jan 01 00:00:02 1970 +0000
387 --- a/g Thu Jan 01 00:00:02 1970 +0000
388 +++ b/g Thu Jan 01 00:00:03 1970 +0000
388 +++ b/g Thu Jan 01 00:00:03 1970 +0000
389 @@ -1,1 +1,2 @@
389 @@ -1,1 +1,2 @@
390 f
390 f
391 +g
391 +g
392
392
393 changeset: 1:d89b0a12d229
393 changeset: 1:d89b0a12d229
394 user: test
394 user: test
395 date: Thu Jan 01 00:00:02 1970 +0000
395 date: Thu Jan 01 00:00:02 1970 +0000
396 summary: b
396 summary: b
397
397
398 diff -r 9161b9aeaf16 -r d89b0a12d229 b
398 diff -r 9161b9aeaf16 -r d89b0a12d229 b
399 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
399 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
400 +++ b/b Thu Jan 01 00:00:02 1970 +0000
400 +++ b/b Thu Jan 01 00:00:02 1970 +0000
401 @@ -0,0 +1,1 @@
401 @@ -0,0 +1,1 @@
402 +a
402 +a
403 diff -r 9161b9aeaf16 -r d89b0a12d229 g
403 diff -r 9161b9aeaf16 -r d89b0a12d229 g
404 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
404 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
405 +++ b/g Thu Jan 01 00:00:02 1970 +0000
405 +++ b/g Thu Jan 01 00:00:02 1970 +0000
406 @@ -0,0 +1,1 @@
406 @@ -0,0 +1,1 @@
407 +f
407 +f
408
408
409 changeset: 0:9161b9aeaf16
409 changeset: 0:9161b9aeaf16
410 user: test
410 user: test
411 date: Thu Jan 01 00:00:01 1970 +0000
411 date: Thu Jan 01 00:00:01 1970 +0000
412 summary: a
412 summary: a
413
413
414 diff -r 000000000000 -r 9161b9aeaf16 a
414 diff -r 000000000000 -r 9161b9aeaf16 a
415 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
415 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
416 +++ b/a Thu Jan 01 00:00:01 1970 +0000
416 +++ b/a Thu Jan 01 00:00:01 1970 +0000
417 @@ -0,0 +1,1 @@
417 @@ -0,0 +1,1 @@
418 +a
418 +a
419 diff -r 000000000000 -r 9161b9aeaf16 f
419 diff -r 000000000000 -r 9161b9aeaf16 f
420 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
420 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
421 +++ b/f Thu Jan 01 00:00:01 1970 +0000
421 +++ b/f Thu Jan 01 00:00:01 1970 +0000
422 @@ -0,0 +1,1 @@
422 @@ -0,0 +1,1 @@
423 +f
423 +f
424
424
425
425
426 log -vf dir/b
426 log -vf dir/b
427
427
428 $ hg log -vf dir/b
428 $ hg log -vf dir/b
429 changeset: 2:f8954cd4dc1f
429 changeset: 2:f8954cd4dc1f
430 user: test
430 user: test
431 date: Thu Jan 01 00:00:03 1970 +0000
431 date: Thu Jan 01 00:00:03 1970 +0000
432 files: b dir/b f g
432 files: b dir/b f g
433 description:
433 description:
434 c
434 c
435
435
436
436
437 changeset: 1:d89b0a12d229
437 changeset: 1:d89b0a12d229
438 user: test
438 user: test
439 date: Thu Jan 01 00:00:02 1970 +0000
439 date: Thu Jan 01 00:00:02 1970 +0000
440 files: b g
440 files: b g
441 description:
441 description:
442 b
442 b
443
443
444
444
445 changeset: 0:9161b9aeaf16
445 changeset: 0:9161b9aeaf16
446 user: test
446 user: test
447 date: Thu Jan 01 00:00:01 1970 +0000
447 date: Thu Jan 01 00:00:01 1970 +0000
448 files: a f
448 files: a f
449 description:
449 description:
450 a
450 a
451
451
452
452
453
453
454
454
455 -f and multiple filelog heads
455 -f and multiple filelog heads
456
456
457 $ hg up -q 2
457 $ hg up -q 2
458 $ hg log -f g --template '{rev}\n'
458 $ hg log -f g --template '{rev}\n'
459 2
459 2
460 1
460 1
461 0
461 0
462 $ hg up -q tip
462 $ hg up -q tip
463 $ hg log -f g --template '{rev}\n'
463 $ hg log -f g --template '{rev}\n'
464 3
464 3
465 2
465 2
466 0
466 0
467
467
468 follow files from the specified revisions (issue4959)
468 follow files from the specified revisions (issue4959)
469
469
470 $ hg log -G -T '{rev} {files},{file_copies % " {source}->{name}"}\n'
470 $ hg log -G -T '{rev} {files},{file_copies % " {source}->{name}"}\n'
471 @ 4 dir/b e, dir/b->e
471 @ 4 dir/b e, dir/b->e
472 |
472 |
473 o 3 a b d g, a->b f->g
473 o 3 a b d g, a->b f->g
474 |
474 |
475 o 2 b dir/b f g, b->dir/b
475 o 2 b dir/b f g, b->dir/b
476 |
476 |
477 o 1 b g, a->b f->g
477 o 1 b g, a->b f->g
478 |
478 |
479 o 0 a f,
479 o 0 a f,
480
480
481
481
482 $ hg log -T '{rev}\n' -fr 4 e
482 $ hg log -T '{rev}\n' -fr 4 e
483 4
483 4
484 2
484 2
485 1
485 1
486 0
486 0
487 $ hg log -T '{rev}\n' -fr 2 g
487 $ hg log -T '{rev}\n' -fr 2 g
488 2
488 2
489 1
489 1
490 0
490 0
491 $ hg log -T '{rev}\n' -fr '2+3' g
491 $ hg log -T '{rev}\n' -fr '2+3' g
492 3
492 3
493 2
493 2
494 1
494 1
495 0
495 0
496
496
497 follow files from the specified revisions with glob patterns (issue5053)
497 follow files from the specified revisions with glob patterns (issue5053)
498 (BROKEN: should follow copies from e@4)
498 (BROKEN: should follow copies from e@4)
499
499
500 $ hg log -T '{rev}\n' -fr4 e -X '[abcdfg]'
500 $ hg log -T '{rev}\n' -fr4 e -X '[abcdfg]'
501 4
501 4
502 2 (false !)
502 2 (false !)
503 1 (false !)
503 1 (false !)
504 0 (false !)
504 0 (false !)
505
505
506 follow files from the specified revisions with missing patterns
506 follow files from the specified revisions with missing patterns
507 (BROKEN: should follow copies from e@4)
507 (BROKEN: should follow copies from e@4)
508
508
509 $ hg log -T '{rev}\n' -fr4 e x
509 $ hg log -T '{rev}\n' -fr4 e x
510 4
510 4
511 2 (false !)
511 2 (false !)
512 1 (false !)
512 1 (false !)
513 0 (false !)
513 0 (false !)
514
514
515 follow files from the specified revisions across copies with -p/--patch
515 follow files from the specified revisions across copies with -p/--patch
516
516
517 $ hg log -T '== rev: {rev},{file_copies % " {source}->{name}"} ==\n' -fpr 4 e g
517 $ hg log -T '== rev: {rev},{file_copies % " {source}->{name}"} ==\n' -fpr 4 e g
518 == rev: 4, dir/b->e ==
518 == rev: 4, dir/b->e ==
519 diff -r 2ca5ba701980 -r 7e4639b4691b e
519 diff -r 2ca5ba701980 -r 7e4639b4691b e
520 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
520 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
521 +++ b/e Thu Jan 01 00:00:05 1970 +0000
521 +++ b/e Thu Jan 01 00:00:05 1970 +0000
522 @@ -0,0 +1,1 @@
522 @@ -0,0 +1,1 @@
523 +a
523 +a
524
524
525 == rev: 3, a->b f->g ==
525 == rev: 3, a->b f->g ==
526 diff -r f8954cd4dc1f -r 2ca5ba701980 g
526 diff -r f8954cd4dc1f -r 2ca5ba701980 g
527 --- a/g Thu Jan 01 00:00:03 1970 +0000
527 --- a/g Thu Jan 01 00:00:03 1970 +0000
528 +++ b/g Thu Jan 01 00:00:04 1970 +0000
528 +++ b/g Thu Jan 01 00:00:04 1970 +0000
529 @@ -1,2 +1,2 @@
529 @@ -1,2 +1,2 @@
530 f
530 f
531 -g
531 -g
532 +f
532 +f
533
533
534 == rev: 2, b->dir/b ==
534 == rev: 2, b->dir/b ==
535 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
535 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
536 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
536 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
537 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
537 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
538 @@ -0,0 +1,1 @@
538 @@ -0,0 +1,1 @@
539 +a
539 +a
540 diff -r d89b0a12d229 -r f8954cd4dc1f f
540 diff -r d89b0a12d229 -r f8954cd4dc1f f
541 --- a/f Thu Jan 01 00:00:02 1970 +0000
541 --- a/f Thu Jan 01 00:00:02 1970 +0000
542 +++ b/f Thu Jan 01 00:00:03 1970 +0000
542 +++ b/f Thu Jan 01 00:00:03 1970 +0000
543 @@ -1,1 +1,2 @@
543 @@ -1,1 +1,2 @@
544 f
544 f
545 +f
545 +f
546
546
547 == rev: 1, a->b f->g ==
547 == rev: 1, a->b f->g ==
548 diff -r 9161b9aeaf16 -r d89b0a12d229 b
548 diff -r 9161b9aeaf16 -r d89b0a12d229 b
549 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
549 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
550 +++ b/b Thu Jan 01 00:00:02 1970 +0000
550 +++ b/b Thu Jan 01 00:00:02 1970 +0000
551 @@ -0,0 +1,1 @@
551 @@ -0,0 +1,1 @@
552 +a
552 +a
553
553
554 == rev: 0, ==
554 == rev: 0, ==
555 diff -r 000000000000 -r 9161b9aeaf16 a
555 diff -r 000000000000 -r 9161b9aeaf16 a
556 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
556 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
557 +++ b/a Thu Jan 01 00:00:01 1970 +0000
557 +++ b/a Thu Jan 01 00:00:01 1970 +0000
558 @@ -0,0 +1,1 @@
558 @@ -0,0 +1,1 @@
559 +a
559 +a
560 diff -r 000000000000 -r 9161b9aeaf16 f
560 diff -r 000000000000 -r 9161b9aeaf16 f
561 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
561 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
562 +++ b/f Thu Jan 01 00:00:01 1970 +0000
562 +++ b/f Thu Jan 01 00:00:01 1970 +0000
563 @@ -0,0 +1,1 @@
563 @@ -0,0 +1,1 @@
564 +f
564 +f
565
565
566
566
567 log copies with --copies
567 log copies with --copies
568
568
569 $ hg log -vC --template '{rev} {file_copies}\n'
569 $ hg log -vC --template '{rev} {file_copies}\n'
570 4 e (dir/b)
570 4 e (dir/b)
571 3 b (a)g (f)
571 3 b (a)g (f)
572 2 dir/b (b)
572 2 dir/b (b)
573 1 b (a)g (f)
573 1 b (a)g (f)
574 0
574 0
575
575
576 log copies switch without --copies, with old filecopy template
576 log copies switch without --copies, with old filecopy template
577
577
578 $ hg log -v --template '{rev} {file_copies_switch%filecopy}\n'
578 $ hg log -v --template '{rev} {file_copies_switch%filecopy}\n'
579 4
579 4
580 3
580 3
581 2
581 2
582 1
582 1
583 0
583 0
584
584
585 log copies switch with --copies
585 log copies switch with --copies
586
586
587 $ hg log -vC --template '{rev} {file_copies_switch}\n'
587 $ hg log -vC --template '{rev} {file_copies_switch}\n'
588 4 e (dir/b)
588 4 e (dir/b)
589 3 b (a)g (f)
589 3 b (a)g (f)
590 2 dir/b (b)
590 2 dir/b (b)
591 1 b (a)g (f)
591 1 b (a)g (f)
592 0
592 0
593
593
594
594
595 log copies with hardcoded style and with --style=default
595 log copies with hardcoded style and with --style=default
596
596
597 $ hg log -vC -r4
597 $ hg log -vC -r4
598 changeset: 4:7e4639b4691b
598 changeset: 4:7e4639b4691b
599 tag: tip
599 tag: tip
600 user: test
600 user: test
601 date: Thu Jan 01 00:00:05 1970 +0000
601 date: Thu Jan 01 00:00:05 1970 +0000
602 files: dir/b e
602 files: dir/b e
603 copies: e (dir/b)
603 copies: e (dir/b)
604 description:
604 description:
605 e
605 e
606
606
607
607
608 $ hg log -vC -r4 --style=default
608 $ hg log -vC -r4 --style=default
609 changeset: 4:7e4639b4691b
609 changeset: 4:7e4639b4691b
610 tag: tip
610 tag: tip
611 user: test
611 user: test
612 date: Thu Jan 01 00:00:05 1970 +0000
612 date: Thu Jan 01 00:00:05 1970 +0000
613 files: dir/b e
613 files: dir/b e
614 copies: e (dir/b)
614 copies: e (dir/b)
615 description:
615 description:
616 e
616 e
617
617
618
618
619 $ hg log -vC -r4 -Tjson
619 $ hg log -vC -r4 -Tjson
620 [
620 [
621 {
621 {
622 "rev": 4,
622 "rev": 4,
623 "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3",
623 "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3",
624 "branch": "default",
624 "branch": "default",
625 "phase": "draft",
625 "phase": "draft",
626 "user": "test",
626 "user": "test",
627 "date": [5, 0],
627 "date": [5, 0],
628 "desc": "e",
628 "desc": "e",
629 "bookmarks": [],
629 "bookmarks": [],
630 "tags": ["tip"],
630 "tags": ["tip"],
631 "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"],
631 "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"],
632 "files": ["dir/b", "e"],
632 "files": ["dir/b", "e"],
633 "copies": {"e": "dir/b"}
633 "copies": {"e": "dir/b"}
634 }
634 }
635 ]
635 ]
636
636
637 log copies, non-linear manifest
637 log copies, non-linear manifest
638
638
639 $ hg up -C 3
639 $ hg up -C 3
640 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
640 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
641 $ hg mv dir/b e
641 $ hg mv dir/b e
642 $ echo foo > foo
642 $ echo foo > foo
643 $ hg ci -Ame2 -d '6 0'
643 $ hg ci -Ame2 -d '6 0'
644 adding foo
644 adding foo
645 created new head
645 created new head
646 $ hg log -v --template '{rev} {file_copies}\n' -r 5
646 $ hg log -v --template '{rev} {file_copies}\n' -r 5
647 5 e (dir/b)
647 5 e (dir/b)
648
648
649
649
650 log copies, execute bit set
650 log copies, execute bit set
651
651
652 #if execbit
652 #if execbit
653 $ chmod +x e
653 $ chmod +x e
654 $ hg ci -me3 -d '7 0'
654 $ hg ci -me3 -d '7 0'
655 $ hg log -v --template '{rev} {file_copies}\n' -r 6
655 $ hg log -v --template '{rev} {file_copies}\n' -r 6
656 6
656 6
657 #endif
657 #endif
658
658
659
659
660 log -p d
660 log -p d
661
661
662 $ hg log -pv d
662 $ hg log -pv d
663 changeset: 3:2ca5ba701980
663 changeset: 3:2ca5ba701980
664 user: test
664 user: test
665 date: Thu Jan 01 00:00:04 1970 +0000
665 date: Thu Jan 01 00:00:04 1970 +0000
666 files: a b d g
666 files: a b d g
667 description:
667 description:
668 d
668 d
669
669
670
670
671 diff -r f8954cd4dc1f -r 2ca5ba701980 d
671 diff -r f8954cd4dc1f -r 2ca5ba701980 d
672 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
672 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
673 +++ b/d Thu Jan 01 00:00:04 1970 +0000
673 +++ b/d Thu Jan 01 00:00:04 1970 +0000
674 @@ -0,0 +1,1 @@
674 @@ -0,0 +1,1 @@
675 +a
675 +a
676
676
677
677
678
678
679 log --removed file
679 log --removed file
680
680
681 $ hg log --removed -v a
681 $ hg log --removed -v a
682 changeset: 3:2ca5ba701980
682 changeset: 3:2ca5ba701980
683 user: test
683 user: test
684 date: Thu Jan 01 00:00:04 1970 +0000
684 date: Thu Jan 01 00:00:04 1970 +0000
685 files: a b d g
685 files: a b d g
686 description:
686 description:
687 d
687 d
688
688
689
689
690 changeset: 0:9161b9aeaf16
690 changeset: 0:9161b9aeaf16
691 user: test
691 user: test
692 date: Thu Jan 01 00:00:01 1970 +0000
692 date: Thu Jan 01 00:00:01 1970 +0000
693 files: a f
693 files: a f
694 description:
694 description:
695 a
695 a
696
696
697
697
698
698
699 log --removed revrange file
699 log --removed revrange file
700
700
701 $ hg log --removed -v -r0:2 a
701 $ hg log --removed -v -r0:2 a
702 changeset: 0:9161b9aeaf16
702 changeset: 0:9161b9aeaf16
703 user: test
703 user: test
704 date: Thu Jan 01 00:00:01 1970 +0000
704 date: Thu Jan 01 00:00:01 1970 +0000
705 files: a f
705 files: a f
706 description:
706 description:
707 a
707 a
708
708
709
709
710 $ cd ..
710 $ cd ..
711
711
712 log --follow tests
712 log --follow tests
713
713
714 $ hg init follow
714 $ hg init follow
715 $ cd follow
715 $ cd follow
716
716
717 $ echo base > base
717 $ echo base > base
718 $ hg ci -Ambase -d '1 0'
718 $ hg ci -Ambase -d '1 0'
719 adding base
719 adding base
720
720
721 $ echo r1 >> base
721 $ echo r1 >> base
722 $ hg ci -Amr1 -d '1 0'
722 $ hg ci -Amr1 -d '1 0'
723 $ echo r2 >> base
723 $ echo r2 >> base
724 $ hg ci -Amr2 -d '1 0'
724 $ hg ci -Amr2 -d '1 0'
725
725
726 $ hg up -C 1
726 $ hg up -C 1
727 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
727 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
728 $ echo b1 > b1
728 $ echo b1 > b1
729
729
730 log -r "follow('set:clean()')"
730 log -r "follow('set:clean()')"
731
731
732 $ hg log -r "follow('set:clean()')"
732 $ hg log -r "follow('set:clean()')"
733 changeset: 0:67e992f2c4f3
733 changeset: 0:67e992f2c4f3
734 user: test
734 user: test
735 date: Thu Jan 01 00:00:01 1970 +0000
735 date: Thu Jan 01 00:00:01 1970 +0000
736 summary: base
736 summary: base
737
737
738 changeset: 1:3d5bf5654eda
738 changeset: 1:3d5bf5654eda
739 user: test
739 user: test
740 date: Thu Jan 01 00:00:01 1970 +0000
740 date: Thu Jan 01 00:00:01 1970 +0000
741 summary: r1
741 summary: r1
742
742
743
743
744 $ hg ci -Amb1 -d '1 0'
744 $ hg ci -Amb1 -d '1 0'
745 adding b1
745 adding b1
746 created new head
746 created new head
747
747
748
748
749 log -f
749 log -f
750
750
751 $ hg log -f
751 $ hg log -f
752 changeset: 3:e62f78d544b4
752 changeset: 3:e62f78d544b4
753 tag: tip
753 tag: tip
754 parent: 1:3d5bf5654eda
754 parent: 1:3d5bf5654eda
755 user: test
755 user: test
756 date: Thu Jan 01 00:00:01 1970 +0000
756 date: Thu Jan 01 00:00:01 1970 +0000
757 summary: b1
757 summary: b1
758
758
759 changeset: 1:3d5bf5654eda
759 changeset: 1:3d5bf5654eda
760 user: test
760 user: test
761 date: Thu Jan 01 00:00:01 1970 +0000
761 date: Thu Jan 01 00:00:01 1970 +0000
762 summary: r1
762 summary: r1
763
763
764 changeset: 0:67e992f2c4f3
764 changeset: 0:67e992f2c4f3
765 user: test
765 user: test
766 date: Thu Jan 01 00:00:01 1970 +0000
766 date: Thu Jan 01 00:00:01 1970 +0000
767 summary: base
767 summary: base
768
768
769
769
770 log -r follow('glob:b*')
770 log -r follow('glob:b*')
771
771
772 $ hg log -r "follow('glob:b*')"
772 $ hg log -r "follow('glob:b*')"
773 changeset: 0:67e992f2c4f3
773 changeset: 0:67e992f2c4f3
774 user: test
774 user: test
775 date: Thu Jan 01 00:00:01 1970 +0000
775 date: Thu Jan 01 00:00:01 1970 +0000
776 summary: base
776 summary: base
777
777
778 changeset: 1:3d5bf5654eda
778 changeset: 1:3d5bf5654eda
779 user: test
779 user: test
780 date: Thu Jan 01 00:00:01 1970 +0000
780 date: Thu Jan 01 00:00:01 1970 +0000
781 summary: r1
781 summary: r1
782
782
783 changeset: 3:e62f78d544b4
783 changeset: 3:e62f78d544b4
784 tag: tip
784 tag: tip
785 parent: 1:3d5bf5654eda
785 parent: 1:3d5bf5654eda
786 user: test
786 user: test
787 date: Thu Jan 01 00:00:01 1970 +0000
787 date: Thu Jan 01 00:00:01 1970 +0000
788 summary: b1
788 summary: b1
789
789
790 log -f -r '1 + 4'
790 log -f -r '1 + 4'
791
791
792 $ hg up -C 0
792 $ hg up -C 0
793 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
793 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
794 $ echo b2 > b2
794 $ echo b2 > b2
795 $ hg ci -Amb2 -d '1 0'
795 $ hg ci -Amb2 -d '1 0'
796 adding b2
796 adding b2
797 created new head
797 created new head
798 $ hg log -f -r '1 + 4'
798 $ hg log -f -r '1 + 4'
799 changeset: 4:ddb82e70d1a1
799 changeset: 4:ddb82e70d1a1
800 tag: tip
800 tag: tip
801 parent: 0:67e992f2c4f3
801 parent: 0:67e992f2c4f3
802 user: test
802 user: test
803 date: Thu Jan 01 00:00:01 1970 +0000
803 date: Thu Jan 01 00:00:01 1970 +0000
804 summary: b2
804 summary: b2
805
805
806 changeset: 1:3d5bf5654eda
806 changeset: 1:3d5bf5654eda
807 user: test
807 user: test
808 date: Thu Jan 01 00:00:01 1970 +0000
808 date: Thu Jan 01 00:00:01 1970 +0000
809 summary: r1
809 summary: r1
810
810
811 changeset: 0:67e992f2c4f3
811 changeset: 0:67e992f2c4f3
812 user: test
812 user: test
813 date: Thu Jan 01 00:00:01 1970 +0000
813 date: Thu Jan 01 00:00:01 1970 +0000
814 summary: base
814 summary: base
815
815
816
816
817 log -fr with aliases: 'A' should be expanded, but 'reverse()' should have no
817 log -fr with aliases: 'A' should be expanded, but 'reverse()' should have no
818 effect
818 effect
819
819
820 $ hg log --config 'revsetalias.reverse(x)=x' --config 'revsetalias.A=1+4' -qfrA
820 $ hg log --config 'revsetalias.reverse(x)=x' --config 'revsetalias.A=1+4' -qfrA
821 4:ddb82e70d1a1
821 4:ddb82e70d1a1
822 1:3d5bf5654eda
822 1:3d5bf5654eda
823 0:67e992f2c4f3
823 0:67e992f2c4f3
824
824
825 log -r "follow('set:grep(b2)')"
825 log -r "follow('set:grep(b2)')"
826
826
827 $ hg log -r "follow('set:grep(b2)')"
827 $ hg log -r "follow('set:grep(b2)')"
828 changeset: 4:ddb82e70d1a1
828 changeset: 4:ddb82e70d1a1
829 tag: tip
829 tag: tip
830 parent: 0:67e992f2c4f3
830 parent: 0:67e992f2c4f3
831 user: test
831 user: test
832 date: Thu Jan 01 00:00:01 1970 +0000
832 date: Thu Jan 01 00:00:01 1970 +0000
833 summary: b2
833 summary: b2
834
834
835 log -r "follow('set:grep(b2)', 4)"
835 log -r "follow('set:grep(b2)', 4)"
836
836
837 $ hg up -qC 0
837 $ hg up -qC 0
838 $ hg log -r "follow('set:grep(b2)', 4)"
838 $ hg log -r "follow('set:grep(b2)', 4)"
839 changeset: 4:ddb82e70d1a1
839 changeset: 4:ddb82e70d1a1
840 tag: tip
840 tag: tip
841 parent: 0:67e992f2c4f3
841 parent: 0:67e992f2c4f3
842 user: test
842 user: test
843 date: Thu Jan 01 00:00:01 1970 +0000
843 date: Thu Jan 01 00:00:01 1970 +0000
844 summary: b2
844 summary: b2
845
845
846
846
847 follow files starting from multiple revisions:
847 follow files starting from multiple revisions:
848
848
849 $ hg log -T '{rev}: {files}\n' -r "follow('glob:b?', startrev=2+3+4)"
849 $ hg log -T '{rev}: {files}\n' -r "follow('glob:b?', startrev=2+3+4)"
850 3: b1
850 3: b1
851 4: b2
851 4: b2
852
852
853 follow files starting from empty revision:
853 follow files starting from empty revision:
854
854
855 $ hg log -T '{rev}: {files}\n' -r "follow('glob:*', startrev=.-.)"
855 $ hg log -T '{rev}: {files}\n' -r "follow('glob:*', startrev=.-.)"
856
856
857 follow starting from revisions:
857 follow starting from revisions:
858
858
859 $ hg log -Gq -r "follow(startrev=2+4)"
859 $ hg log -Gq -r "follow(startrev=2+4)"
860 o 4:ddb82e70d1a1
860 o 4:ddb82e70d1a1
861 |
861 |
862 | o 2:60c670bf5b30
862 | o 2:60c670bf5b30
863 | |
863 | |
864 | o 1:3d5bf5654eda
864 | o 1:3d5bf5654eda
865 |/
865 |/
866 @ 0:67e992f2c4f3
866 @ 0:67e992f2c4f3
867
867
868
868
869 follow the current revision:
869 follow the current revision:
870
870
871 $ hg log -Gq -r "follow()"
871 $ hg log -Gq -r "follow()"
872 @ 0:67e992f2c4f3
872 @ 0:67e992f2c4f3
873
873
874
874
875 $ hg up -qC 4
875 $ hg up -qC 4
876
876
877 log -f -r null
877 log -f -r null
878
878
879 $ hg log -f -r null
879 $ hg log -f -r null
880 changeset: -1:000000000000
880 changeset: -1:000000000000
881 user:
881 user:
882 date: Thu Jan 01 00:00:00 1970 +0000
882 date: Thu Jan 01 00:00:00 1970 +0000
883
883
884 $ hg log -f -r null -G
884 $ hg log -f -r null -G
885 o changeset: -1:000000000000
885 o changeset: -1:000000000000
886 user:
886 user:
887 date: Thu Jan 01 00:00:00 1970 +0000
887 date: Thu Jan 01 00:00:00 1970 +0000
888
888
889
889
890
890
891 log -f with null parent
891 log -f with null parent
892
892
893 $ hg up -C null
893 $ hg up -C null
894 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
894 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
895 $ hg log -f
895 $ hg log -f
896
896
897
897
898 log -r . with two parents
898 log -r . with two parents
899
899
900 $ hg up -C 3
900 $ hg up -C 3
901 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
901 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
902 $ hg merge tip
902 $ hg merge tip
903 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
903 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
904 (branch merge, don't forget to commit)
904 (branch merge, don't forget to commit)
905 $ hg log -r .
905 $ hg log -r .
906 changeset: 3:e62f78d544b4
906 changeset: 3:e62f78d544b4
907 parent: 1:3d5bf5654eda
907 parent: 1:3d5bf5654eda
908 user: test
908 user: test
909 date: Thu Jan 01 00:00:01 1970 +0000
909 date: Thu Jan 01 00:00:01 1970 +0000
910 summary: b1
910 summary: b1
911
911
912
912
913
913
914 log -r . with one parent
914 log -r . with one parent
915
915
916 $ hg ci -mm12 -d '1 0'
916 $ hg ci -mm12 -d '1 0'
917 $ hg log -r .
917 $ hg log -r .
918 changeset: 5:302e9dd6890d
918 changeset: 5:302e9dd6890d
919 tag: tip
919 tag: tip
920 parent: 3:e62f78d544b4
920 parent: 3:e62f78d544b4
921 parent: 4:ddb82e70d1a1
921 parent: 4:ddb82e70d1a1
922 user: test
922 user: test
923 date: Thu Jan 01 00:00:01 1970 +0000
923 date: Thu Jan 01 00:00:01 1970 +0000
924 summary: m12
924 summary: m12
925
925
926
926
927 $ echo postm >> b1
927 $ echo postm >> b1
928 $ hg ci -Amb1.1 -d'1 0'
928 $ hg ci -Amb1.1 -d'1 0'
929
929
930
930
931 log --follow-first
931 log --follow-first
932
932
933 $ hg log --follow-first
933 $ hg log --follow-first
934 changeset: 6:2404bbcab562
934 changeset: 6:2404bbcab562
935 tag: tip
935 tag: tip
936 user: test
936 user: test
937 date: Thu Jan 01 00:00:01 1970 +0000
937 date: Thu Jan 01 00:00:01 1970 +0000
938 summary: b1.1
938 summary: b1.1
939
939
940 changeset: 5:302e9dd6890d
940 changeset: 5:302e9dd6890d
941 parent: 3:e62f78d544b4
941 parent: 3:e62f78d544b4
942 parent: 4:ddb82e70d1a1
942 parent: 4:ddb82e70d1a1
943 user: test
943 user: test
944 date: Thu Jan 01 00:00:01 1970 +0000
944 date: Thu Jan 01 00:00:01 1970 +0000
945 summary: m12
945 summary: m12
946
946
947 changeset: 3:e62f78d544b4
947 changeset: 3:e62f78d544b4
948 parent: 1:3d5bf5654eda
948 parent: 1:3d5bf5654eda
949 user: test
949 user: test
950 date: Thu Jan 01 00:00:01 1970 +0000
950 date: Thu Jan 01 00:00:01 1970 +0000
951 summary: b1
951 summary: b1
952
952
953 changeset: 1:3d5bf5654eda
953 changeset: 1:3d5bf5654eda
954 user: test
954 user: test
955 date: Thu Jan 01 00:00:01 1970 +0000
955 date: Thu Jan 01 00:00:01 1970 +0000
956 summary: r1
956 summary: r1
957
957
958 changeset: 0:67e992f2c4f3
958 changeset: 0:67e992f2c4f3
959 user: test
959 user: test
960 date: Thu Jan 01 00:00:01 1970 +0000
960 date: Thu Jan 01 00:00:01 1970 +0000
961 summary: base
961 summary: base
962
962
963
963
964
964
965 log -P 2
965 log -P 2
966
966
967 $ hg log -P 2
967 $ hg log -P 2
968 changeset: 6:2404bbcab562
968 changeset: 6:2404bbcab562
969 tag: tip
969 tag: tip
970 user: test
970 user: test
971 date: Thu Jan 01 00:00:01 1970 +0000
971 date: Thu Jan 01 00:00:01 1970 +0000
972 summary: b1.1
972 summary: b1.1
973
973
974 changeset: 5:302e9dd6890d
974 changeset: 5:302e9dd6890d
975 parent: 3:e62f78d544b4
975 parent: 3:e62f78d544b4
976 parent: 4:ddb82e70d1a1
976 parent: 4:ddb82e70d1a1
977 user: test
977 user: test
978 date: Thu Jan 01 00:00:01 1970 +0000
978 date: Thu Jan 01 00:00:01 1970 +0000
979 summary: m12
979 summary: m12
980
980
981 changeset: 4:ddb82e70d1a1
981 changeset: 4:ddb82e70d1a1
982 parent: 0:67e992f2c4f3
982 parent: 0:67e992f2c4f3
983 user: test
983 user: test
984 date: Thu Jan 01 00:00:01 1970 +0000
984 date: Thu Jan 01 00:00:01 1970 +0000
985 summary: b2
985 summary: b2
986
986
987 changeset: 3:e62f78d544b4
987 changeset: 3:e62f78d544b4
988 parent: 1:3d5bf5654eda
988 parent: 1:3d5bf5654eda
989 user: test
989 user: test
990 date: Thu Jan 01 00:00:01 1970 +0000
990 date: Thu Jan 01 00:00:01 1970 +0000
991 summary: b1
991 summary: b1
992
992
993
993
994
994
995 log -r tip -p --git
995 log -r tip -p --git
996
996
997 $ hg log -r tip -p --git
997 $ hg log -r tip -p --git
998 changeset: 6:2404bbcab562
998 changeset: 6:2404bbcab562
999 tag: tip
999 tag: tip
1000 user: test
1000 user: test
1001 date: Thu Jan 01 00:00:01 1970 +0000
1001 date: Thu Jan 01 00:00:01 1970 +0000
1002 summary: b1.1
1002 summary: b1.1
1003
1003
1004 diff --git a/b1 b/b1
1004 diff --git a/b1 b/b1
1005 --- a/b1
1005 --- a/b1
1006 +++ b/b1
1006 +++ b/b1
1007 @@ -1,1 +1,2 @@
1007 @@ -1,1 +1,2 @@
1008 b1
1008 b1
1009 +postm
1009 +postm
1010
1010
1011
1011
1012
1012
1013 log -r ""
1013 log -r ""
1014
1014
1015 $ hg log -r ''
1015 $ hg log -r ''
1016 hg: parse error: empty query
1016 hg: parse error: empty query
1017 [255]
1017 [255]
1018
1018
1019 log -r <some unknown node id>
1019 log -r <some unknown node id>
1020
1020
1021 $ hg log -r 1000000000000000000000000000000000000000
1021 $ hg log -r 1000000000000000000000000000000000000000
1022 abort: unknown revision '1000000000000000000000000000000000000000'!
1022 abort: unknown revision '1000000000000000000000000000000000000000'!
1023 [255]
1023 [255]
1024
1024
1025 log -k r1
1025 log -k r1
1026
1026
1027 $ hg log -k r1
1027 $ hg log -k r1
1028 changeset: 1:3d5bf5654eda
1028 changeset: 1:3d5bf5654eda
1029 user: test
1029 user: test
1030 date: Thu Jan 01 00:00:01 1970 +0000
1030 date: Thu Jan 01 00:00:01 1970 +0000
1031 summary: r1
1031 summary: r1
1032
1032
1033 log -p -l2 --color=always
1033 log -p -l2 --color=always
1034
1034
1035 $ hg --config extensions.color= --config color.mode=ansi \
1035 $ hg --config extensions.color= --config color.mode=ansi \
1036 > log -p -l2 --color=always
1036 > log -p -l2 --color=always
1037 \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc)
1037 \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc)
1038 tag: tip
1038 tag: tip
1039 user: test
1039 user: test
1040 date: Thu Jan 01 00:00:01 1970 +0000
1040 date: Thu Jan 01 00:00:01 1970 +0000
1041 summary: b1.1
1041 summary: b1.1
1042
1042
1043 \x1b[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1\x1b[0m (esc)
1043 \x1b[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1\x1b[0m (esc)
1044 \x1b[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1044 \x1b[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1045 \x1b[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1045 \x1b[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1046 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
1046 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
1047 b1
1047 b1
1048 \x1b[0;32m+postm\x1b[0m (esc)
1048 \x1b[0;32m+postm\x1b[0m (esc)
1049
1049
1050 \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc)
1050 \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc)
1051 parent: 3:e62f78d544b4
1051 parent: 3:e62f78d544b4
1052 parent: 4:ddb82e70d1a1
1052 parent: 4:ddb82e70d1a1
1053 user: test
1053 user: test
1054 date: Thu Jan 01 00:00:01 1970 +0000
1054 date: Thu Jan 01 00:00:01 1970 +0000
1055 summary: m12
1055 summary: m12
1056
1056
1057 \x1b[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2\x1b[0m (esc)
1057 \x1b[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2\x1b[0m (esc)
1058 \x1b[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000\x1b[0m (esc)
1058 \x1b[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000\x1b[0m (esc)
1059 \x1b[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1059 \x1b[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc)
1060 \x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m (esc)
1060 \x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m (esc)
1061 \x1b[0;32m+b2\x1b[0m (esc)
1061 \x1b[0;32m+b2\x1b[0m (esc)
1062
1062
1063
1063
1064
1064
1065 log -r tip --stat
1065 log -r tip --stat
1066
1066
1067 $ hg log -r tip --stat
1067 $ hg log -r tip --stat
1068 changeset: 6:2404bbcab562
1068 changeset: 6:2404bbcab562
1069 tag: tip
1069 tag: tip
1070 user: test
1070 user: test
1071 date: Thu Jan 01 00:00:01 1970 +0000
1071 date: Thu Jan 01 00:00:01 1970 +0000
1072 summary: b1.1
1072 summary: b1.1
1073
1073
1074 b1 | 1 +
1074 b1 | 1 +
1075 1 files changed, 1 insertions(+), 0 deletions(-)
1075 1 files changed, 1 insertions(+), 0 deletions(-)
1076
1076
1077
1077
1078 $ cd ..
1078 $ cd ..
1079
1079
1080 log --follow --patch FILE in repository where linkrev isn't trustworthy
1080 log --follow --patch FILE in repository where linkrev isn't trustworthy
1081 (issue5376)
1081 (issue5376)
1082
1082
1083 $ hg init follow-dup
1083 $ hg init follow-dup
1084 $ cd follow-dup
1084 $ cd follow-dup
1085 $ cat <<EOF >> .hg/hgrc
1085 $ cat <<EOF >> .hg/hgrc
1086 > [ui]
1086 > [ui]
1087 > logtemplate = '=== {rev}: {desc}\n'
1087 > logtemplate = '=== {rev}: {desc}\n'
1088 > [diff]
1088 > [diff]
1089 > nodates = True
1089 > nodates = True
1090 > EOF
1090 > EOF
1091 $ echo 0 >> a
1091 $ echo 0 >> a
1092 $ hg ci -qAm 'a0'
1092 $ hg ci -qAm 'a0'
1093 $ echo 1 >> a
1093 $ echo 1 >> a
1094 $ hg ci -m 'a1'
1094 $ hg ci -m 'a1'
1095 $ hg up -q 0
1095 $ hg up -q 0
1096 $ echo 1 >> a
1096 $ echo 1 >> a
1097 $ touch b
1097 $ touch b
1098 $ hg ci -qAm 'a1 with b'
1098 $ hg ci -qAm 'a1 with b'
1099 $ echo 3 >> a
1099 $ echo 3 >> a
1100 $ hg ci -m 'a3'
1100 $ hg ci -m 'a3'
1101
1101
1102 fctx.rev() == 2, but fctx.linkrev() == 1
1102 fctx.rev() == 2, but fctx.linkrev() == 1
1103
1103
1104 $ hg log -pf a
1104 $ hg log -pf a
1105 === 3: a3
1105 === 3: a3
1106 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
1106 diff -r 4ea02ba94d66 -r e7a6331a34f0 a
1107 --- a/a
1107 --- a/a
1108 +++ b/a
1108 +++ b/a
1109 @@ -1,2 +1,3 @@
1109 @@ -1,2 +1,3 @@
1110 0
1110 0
1111 1
1111 1
1112 +3
1112 +3
1113
1113
1114 === 2: a1 with b
1114 === 2: a1 with b
1115 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1115 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1116 --- a/a
1116 --- a/a
1117 +++ b/a
1117 +++ b/a
1118 @@ -1,1 +1,2 @@
1118 @@ -1,1 +1,2 @@
1119 0
1119 0
1120 +1
1120 +1
1121
1121
1122 === 0: a0
1122 === 0: a0
1123 diff -r 000000000000 -r 49b5e81287e2 a
1123 diff -r 000000000000 -r 49b5e81287e2 a
1124 --- /dev/null
1124 --- /dev/null
1125 +++ b/a
1125 +++ b/a
1126 @@ -0,0 +1,1 @@
1126 @@ -0,0 +1,1 @@
1127 +0
1127 +0
1128
1128
1129
1129
1130 fctx.introrev() == 2, but fctx.linkrev() == 1
1130 fctx.introrev() == 2, but fctx.linkrev() == 1
1131
1131
1132 $ hg up -q 2
1132 $ hg up -q 2
1133 $ hg log -pf a
1133 $ hg log -pf a
1134 === 2: a1 with b
1134 === 2: a1 with b
1135 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1135 diff -r 49b5e81287e2 -r 4ea02ba94d66 a
1136 --- a/a
1136 --- a/a
1137 +++ b/a
1137 +++ b/a
1138 @@ -1,1 +1,2 @@
1138 @@ -1,1 +1,2 @@
1139 0
1139 0
1140 +1
1140 +1
1141
1141
1142 === 0: a0
1142 === 0: a0
1143 diff -r 000000000000 -r 49b5e81287e2 a
1143 diff -r 000000000000 -r 49b5e81287e2 a
1144 --- /dev/null
1144 --- /dev/null
1145 +++ b/a
1145 +++ b/a
1146 @@ -0,0 +1,1 @@
1146 @@ -0,0 +1,1 @@
1147 +0
1147 +0
1148
1148
1149
1149
1150 $ cd ..
1150 $ cd ..
1151
1151
1152 Multiple copy sources of a file:
1152 Multiple copy sources of a file:
1153
1153
1154 $ hg init follow-multi
1154 $ hg init follow-multi
1155 $ cd follow-multi
1155 $ cd follow-multi
1156 $ echo 0 >> a
1156 $ echo 0 >> a
1157 $ hg ci -qAm 'a'
1157 $ hg ci -qAm 'a'
1158 $ hg cp a b
1158 $ hg cp a b
1159 $ hg ci -m 'a->b'
1159 $ hg ci -m 'a->b'
1160 $ echo 2 >> a
1160 $ echo 2 >> a
1161 $ hg ci -m 'a'
1161 $ hg ci -m 'a'
1162 $ echo 3 >> b
1162 $ echo 3 >> b
1163 $ hg ci -m 'b'
1163 $ hg ci -m 'b'
1164 $ echo 4 >> a
1164 $ echo 4 >> a
1165 $ echo 4 >> b
1165 $ echo 4 >> b
1166 $ hg ci -m 'a,b'
1166 $ hg ci -m 'a,b'
1167 $ echo 5 >> a
1167 $ echo 5 >> a
1168 $ hg ci -m 'a0'
1168 $ hg ci -m 'a0'
1169 $ echo 6 >> b
1169 $ echo 6 >> b
1170 $ hg ci -m 'b0'
1170 $ hg ci -m 'b0'
1171 $ hg up -q 4
1171 $ hg up -q 4
1172 $ echo 7 >> b
1172 $ echo 7 >> b
1173 $ hg ci -m 'b1'
1173 $ hg ci -m 'b1'
1174 created new head
1174 created new head
1175 $ echo 8 >> a
1175 $ echo 8 >> a
1176 $ hg ci -m 'a1'
1176 $ hg ci -m 'a1'
1177 $ hg rm a
1177 $ hg rm a
1178 $ hg mv b a
1178 $ hg mv b a
1179 $ hg ci -m 'b1->a1'
1179 $ hg ci -m 'b1->a1'
1180 $ hg merge -qt :local
1180 $ hg merge -qt :local
1181 $ hg ci -m '(a0,b1->a1)->a'
1181 $ hg ci -m '(a0,b1->a1)->a'
1182
1182
1183 $ hg log -GT '{rev}: {desc}\n'
1183 $ hg log -GT '{rev}: {desc}\n'
1184 @ 10: (a0,b1->a1)->a
1184 @ 10: (a0,b1->a1)->a
1185 |\
1185 |\
1186 | o 9: b1->a1
1186 | o 9: b1->a1
1187 | |
1187 | |
1188 | o 8: a1
1188 | o 8: a1
1189 | |
1189 | |
1190 | o 7: b1
1190 | o 7: b1
1191 | |
1191 | |
1192 o | 6: b0
1192 o | 6: b0
1193 | |
1193 | |
1194 o | 5: a0
1194 o | 5: a0
1195 |/
1195 |/
1196 o 4: a,b
1196 o 4: a,b
1197 |
1197 |
1198 o 3: b
1198 o 3: b
1199 |
1199 |
1200 o 2: a
1200 o 2: a
1201 |
1201 |
1202 o 1: a->b
1202 o 1: a->b
1203 |
1203 |
1204 o 0: a
1204 o 0: a
1205
1205
1206
1206
1207 since file 'a' has multiple copy sources at the revision 4, ancestors can't
1207 since file 'a' has multiple copy sources at the revision 4, ancestors can't
1208 be indexed solely by fctx.linkrev().
1208 be indexed solely by fctx.linkrev().
1209
1209
1210 $ hg log -T '{rev}: {desc}\n' -f a
1210 $ hg log -T '{rev}: {desc}\n' -f a
1211 10: (a0,b1->a1)->a
1211 10: (a0,b1->a1)->a
1212 9: b1->a1
1212 9: b1->a1
1213 7: b1
1213 7: b1
1214 5: a0
1214 5: a0
1215 4: a,b
1215 4: a,b
1216 3: b
1216 3: b
1217 2: a
1217 2: a
1218 1: a->b
1218 1: a->b
1219 0: a
1219 0: a
1220
1220
1221 $ cd ..
1221 $ cd ..
1222
1222
1223 Test that log should respect the order of -rREV even if multiple OR conditions
1223 Test that log should respect the order of -rREV even if multiple OR conditions
1224 are specified (issue5100):
1224 are specified (issue5100):
1225
1225
1226 $ hg init revorder
1226 $ hg init revorder
1227 $ cd revorder
1227 $ cd revorder
1228
1228
1229 $ hg branch -q b0
1229 $ hg branch -q b0
1230 $ echo 0 >> f0
1230 $ echo 0 >> f0
1231 $ hg ci -qAm k0 -u u0
1231 $ hg ci -qAm k0 -u u0
1232 $ hg branch -q b1
1232 $ hg branch -q b1
1233 $ echo 1 >> f1
1233 $ echo 1 >> f1
1234 $ hg ci -qAm k1 -u u1
1234 $ hg ci -qAm k1 -u u1
1235 $ hg branch -q b2
1235 $ hg branch -q b2
1236 $ echo 2 >> f2
1236 $ echo 2 >> f2
1237 $ hg ci -qAm k2 -u u2
1237 $ hg ci -qAm k2 -u u2
1238
1238
1239 $ hg update -q b2
1239 $ hg update -q b2
1240 $ echo 3 >> f2
1240 $ echo 3 >> f2
1241 $ hg ci -qAm k2 -u u2
1241 $ hg ci -qAm k2 -u u2
1242 $ hg update -q b1
1242 $ hg update -q b1
1243 $ echo 4 >> f1
1243 $ echo 4 >> f1
1244 $ hg ci -qAm k1 -u u1
1244 $ hg ci -qAm k1 -u u1
1245 $ hg update -q b0
1245 $ hg update -q b0
1246 $ echo 5 >> f0
1246 $ echo 5 >> f0
1247 $ hg ci -qAm k0 -u u0
1247 $ hg ci -qAm k0 -u u0
1248
1248
1249 summary of revisions:
1249 summary of revisions:
1250
1250
1251 $ hg log -G -T '{rev} {branch} {author} {desc} {files}\n'
1251 $ hg log -G -T '{rev} {branch} {author} {desc} {files}\n'
1252 @ 5 b0 u0 k0 f0
1252 @ 5 b0 u0 k0 f0
1253 |
1253 |
1254 | o 4 b1 u1 k1 f1
1254 | o 4 b1 u1 k1 f1
1255 | |
1255 | |
1256 | | o 3 b2 u2 k2 f2
1256 | | o 3 b2 u2 k2 f2
1257 | | |
1257 | | |
1258 | | o 2 b2 u2 k2 f2
1258 | | o 2 b2 u2 k2 f2
1259 | |/
1259 | |/
1260 | o 1 b1 u1 k1 f1
1260 | o 1 b1 u1 k1 f1
1261 |/
1261 |/
1262 o 0 b0 u0 k0 f0
1262 o 0 b0 u0 k0 f0
1263
1263
1264
1264
1265 log -b BRANCH in ascending order:
1265 log -b BRANCH in ascending order:
1266
1266
1267 $ hg log -r0:tip -T '{rev} {branch}\n' -b b0 -b b1
1267 $ hg log -r0:tip -T '{rev} {branch}\n' -b b0 -b b1
1268 0 b0
1268 0 b0
1269 1 b1
1269 1 b1
1270 4 b1
1270 4 b1
1271 5 b0
1271 5 b0
1272 $ hg log -r0:tip -T '{rev} {branch}\n' -b b1 -b b0
1272 $ hg log -r0:tip -T '{rev} {branch}\n' -b b1 -b b0
1273 0 b0
1273 0 b0
1274 1 b1
1274 1 b1
1275 4 b1
1275 4 b1
1276 5 b0
1276 5 b0
1277
1277
1278 log --only-branch BRANCH in descending order:
1278 log --only-branch BRANCH in descending order:
1279
1279
1280 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b1 --only-branch b2
1280 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b1 --only-branch b2
1281 4 b1
1281 4 b1
1282 3 b2
1282 3 b2
1283 2 b2
1283 2 b2
1284 1 b1
1284 1 b1
1285 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b2 --only-branch b1
1285 $ hg log -rtip:0 -T '{rev} {branch}\n' --only-branch b2 --only-branch b1
1286 4 b1
1286 4 b1
1287 3 b2
1287 3 b2
1288 2 b2
1288 2 b2
1289 1 b1
1289 1 b1
1290
1290
1291 log -u USER in ascending order, against compound set:
1291 log -u USER in ascending order, against compound set:
1292
1292
1293 $ hg log -r'::head()' -T '{rev} {author}\n' -u u0 -u u2
1293 $ hg log -r'::head()' -T '{rev} {author}\n' -u u0 -u u2
1294 0 u0
1294 0 u0
1295 2 u2
1295 2 u2
1296 3 u2
1296 3 u2
1297 5 u0
1297 5 u0
1298 $ hg log -r'::head()' -T '{rev} {author}\n' -u u2 -u u0
1298 $ hg log -r'::head()' -T '{rev} {author}\n' -u u2 -u u0
1299 0 u0
1299 0 u0
1300 2 u2
1300 2 u2
1301 3 u2
1301 3 u2
1302 5 u0
1302 5 u0
1303
1303
1304 log -k TEXT in descending order, against compound set:
1304 log -k TEXT in descending order, against compound set:
1305
1305
1306 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k0 -k k1 -k k2
1306 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k0 -k k1 -k k2
1307 5 k0
1307 5 k0
1308 3 k2
1308 3 k2
1309 2 k2
1309 2 k2
1310 1 k1
1310 1 k1
1311 0 k0
1311 0 k0
1312 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k2 -k k1 -k k0
1312 $ hg log -r'5 + reverse(::3)' -T '{rev} {desc}\n' -k k2 -k k1 -k k0
1313 5 k0
1313 5 k0
1314 3 k2
1314 3 k2
1315 2 k2
1315 2 k2
1316 1 k1
1316 1 k1
1317 0 k0
1317 0 k0
1318
1318
1319 log FILE in ascending order, against dagrange:
1319 log FILE in ascending order, against dagrange:
1320
1320
1321 $ hg log -r1:: -T '{rev} {files}\n' f1 f2
1321 $ hg log -r1:: -T '{rev} {files}\n' f1 f2
1322 1 f1
1322 1 f1
1323 2 f2
1323 2 f2
1324 3 f2
1324 3 f2
1325 4 f1
1325 4 f1
1326 $ hg log -r1:: -T '{rev} {files}\n' f2 f1
1326 $ hg log -r1:: -T '{rev} {files}\n' f2 f1
1327 1 f1
1327 1 f1
1328 2 f2
1328 2 f2
1329 3 f2
1329 3 f2
1330 4 f1
1330 4 f1
1331
1331
1332 $ cd ..
1332 $ cd ..
1333
1333
1334 User
1334 User
1335
1335
1336 $ hg init usertest
1336 $ hg init usertest
1337 $ cd usertest
1337 $ cd usertest
1338
1338
1339 $ echo a > a
1339 $ echo a > a
1340 $ hg ci -A -m "a" -u "User One <user1@example.org>"
1340 $ hg ci -A -m "a" -u "User One <user1@example.org>"
1341 adding a
1341 adding a
1342 $ echo b > b
1342 $ echo b > b
1343 $ hg ci -A -m "b" -u "User Two <user2@example.org>"
1343 $ hg ci -A -m "b" -u "User Two <user2@example.org>"
1344 adding b
1344 adding b
1345
1345
1346 $ hg log -u "User One <user1@example.org>"
1346 $ hg log -u "User One <user1@example.org>"
1347 changeset: 0:29a4c94f1924
1347 changeset: 0:29a4c94f1924
1348 user: User One <user1@example.org>
1348 user: User One <user1@example.org>
1349 date: Thu Jan 01 00:00:00 1970 +0000
1349 date: Thu Jan 01 00:00:00 1970 +0000
1350 summary: a
1350 summary: a
1351
1351
1352 $ hg log -u "user1" -u "user2"
1352 $ hg log -u "user1" -u "user2"
1353 changeset: 1:e834b5e69c0e
1353 changeset: 1:e834b5e69c0e
1354 tag: tip
1354 tag: tip
1355 user: User Two <user2@example.org>
1355 user: User Two <user2@example.org>
1356 date: Thu Jan 01 00:00:00 1970 +0000
1356 date: Thu Jan 01 00:00:00 1970 +0000
1357 summary: b
1357 summary: b
1358
1358
1359 changeset: 0:29a4c94f1924
1359 changeset: 0:29a4c94f1924
1360 user: User One <user1@example.org>
1360 user: User One <user1@example.org>
1361 date: Thu Jan 01 00:00:00 1970 +0000
1361 date: Thu Jan 01 00:00:00 1970 +0000
1362 summary: a
1362 summary: a
1363
1363
1364 $ hg log -u "user3"
1364 $ hg log -u "user3"
1365
1365
1366 "-u USER" shouldn't be overridden by "user(USER)" alias
1366 "-u USER" shouldn't be overridden by "user(USER)" alias
1367
1367
1368 $ hg log --config 'revsetalias.user(x)=branch(x)' -u default
1368 $ hg log --config 'revsetalias.user(x)=branch(x)' -u default
1369 $ hg log --config 'revsetalias.user(x)=branch(x)' -u user1
1369 $ hg log --config 'revsetalias.user(x)=branch(x)' -u user1
1370 changeset: 0:29a4c94f1924
1370 changeset: 0:29a4c94f1924
1371 user: User One <user1@example.org>
1371 user: User One <user1@example.org>
1372 date: Thu Jan 01 00:00:00 1970 +0000
1372 date: Thu Jan 01 00:00:00 1970 +0000
1373 summary: a
1373 summary: a
1374
1374
1375
1375
1376 $ cd ..
1376 $ cd ..
1377
1377
1378 $ hg init branches
1378 $ hg init branches
1379 $ cd branches
1379 $ cd branches
1380
1380
1381 $ echo a > a
1381 $ echo a > a
1382 $ hg ci -A -m "commit on default"
1382 $ hg ci -A -m "commit on default"
1383 adding a
1383 adding a
1384 $ hg branch test
1384 $ hg branch test
1385 marked working directory as branch test
1385 marked working directory as branch test
1386 (branches are permanent and global, did you want a bookmark?)
1386 (branches are permanent and global, did you want a bookmark?)
1387 $ echo b > b
1387 $ echo b > b
1388 $ hg ci -A -m "commit on test"
1388 $ hg ci -A -m "commit on test"
1389 adding b
1389 adding b
1390
1390
1391 $ hg up default
1391 $ hg up default
1392 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1392 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1393 $ echo c > c
1393 $ echo c > c
1394 $ hg ci -A -m "commit on default"
1394 $ hg ci -A -m "commit on default"
1395 adding c
1395 adding c
1396 $ hg up test
1396 $ hg up test
1397 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1397 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1398 $ echo c > c
1398 $ echo c > c
1399 $ hg ci -A -m "commit on test"
1399 $ hg ci -A -m "commit on test"
1400 adding c
1400 adding c
1401
1401
1402
1402
1403 log -b default
1403 log -b default
1404
1404
1405 $ hg log -b default
1405 $ hg log -b default
1406 changeset: 2:c3a4f03cc9a7
1406 changeset: 2:c3a4f03cc9a7
1407 parent: 0:24427303d56f
1407 parent: 0:24427303d56f
1408 user: test
1408 user: test
1409 date: Thu Jan 01 00:00:00 1970 +0000
1409 date: Thu Jan 01 00:00:00 1970 +0000
1410 summary: commit on default
1410 summary: commit on default
1411
1411
1412 changeset: 0:24427303d56f
1412 changeset: 0:24427303d56f
1413 user: test
1413 user: test
1414 date: Thu Jan 01 00:00:00 1970 +0000
1414 date: Thu Jan 01 00:00:00 1970 +0000
1415 summary: commit on default
1415 summary: commit on default
1416
1416
1417
1417
1418
1418
1419 log -b test
1419 log -b test
1420
1420
1421 $ hg log -b test
1421 $ hg log -b test
1422 changeset: 3:f5d8de11c2e2
1422 changeset: 3:f5d8de11c2e2
1423 branch: test
1423 branch: test
1424 tag: tip
1424 tag: tip
1425 parent: 1:d32277701ccb
1425 parent: 1:d32277701ccb
1426 user: test
1426 user: test
1427 date: Thu Jan 01 00:00:00 1970 +0000
1427 date: Thu Jan 01 00:00:00 1970 +0000
1428 summary: commit on test
1428 summary: commit on test
1429
1429
1430 changeset: 1:d32277701ccb
1430 changeset: 1:d32277701ccb
1431 branch: test
1431 branch: test
1432 user: test
1432 user: test
1433 date: Thu Jan 01 00:00:00 1970 +0000
1433 date: Thu Jan 01 00:00:00 1970 +0000
1434 summary: commit on test
1434 summary: commit on test
1435
1435
1436
1436
1437
1437
1438 log -b dummy
1438 log -b dummy
1439
1439
1440 $ hg log -b dummy
1440 $ hg log -b dummy
1441 abort: unknown revision 'dummy'!
1441 abort: unknown revision 'dummy'!
1442 [255]
1442 [255]
1443
1443
1444
1444
1445 log -b .
1445 log -b .
1446
1446
1447 $ hg log -b .
1447 $ hg log -b .
1448 changeset: 3:f5d8de11c2e2
1448 changeset: 3:f5d8de11c2e2
1449 branch: test
1449 branch: test
1450 tag: tip
1450 tag: tip
1451 parent: 1:d32277701ccb
1451 parent: 1:d32277701ccb
1452 user: test
1452 user: test
1453 date: Thu Jan 01 00:00:00 1970 +0000
1453 date: Thu Jan 01 00:00:00 1970 +0000
1454 summary: commit on test
1454 summary: commit on test
1455
1455
1456 changeset: 1:d32277701ccb
1456 changeset: 1:d32277701ccb
1457 branch: test
1457 branch: test
1458 user: test
1458 user: test
1459 date: Thu Jan 01 00:00:00 1970 +0000
1459 date: Thu Jan 01 00:00:00 1970 +0000
1460 summary: commit on test
1460 summary: commit on test
1461
1461
1462
1462
1463
1463
1464 log -b default -b test
1464 log -b default -b test
1465
1465
1466 $ hg log -b default -b test
1466 $ hg log -b default -b test
1467 changeset: 3:f5d8de11c2e2
1467 changeset: 3:f5d8de11c2e2
1468 branch: test
1468 branch: test
1469 tag: tip
1469 tag: tip
1470 parent: 1:d32277701ccb
1470 parent: 1:d32277701ccb
1471 user: test
1471 user: test
1472 date: Thu Jan 01 00:00:00 1970 +0000
1472 date: Thu Jan 01 00:00:00 1970 +0000
1473 summary: commit on test
1473 summary: commit on test
1474
1474
1475 changeset: 2:c3a4f03cc9a7
1475 changeset: 2:c3a4f03cc9a7
1476 parent: 0:24427303d56f
1476 parent: 0:24427303d56f
1477 user: test
1477 user: test
1478 date: Thu Jan 01 00:00:00 1970 +0000
1478 date: Thu Jan 01 00:00:00 1970 +0000
1479 summary: commit on default
1479 summary: commit on default
1480
1480
1481 changeset: 1:d32277701ccb
1481 changeset: 1:d32277701ccb
1482 branch: test
1482 branch: test
1483 user: test
1483 user: test
1484 date: Thu Jan 01 00:00:00 1970 +0000
1484 date: Thu Jan 01 00:00:00 1970 +0000
1485 summary: commit on test
1485 summary: commit on test
1486
1486
1487 changeset: 0:24427303d56f
1487 changeset: 0:24427303d56f
1488 user: test
1488 user: test
1489 date: Thu Jan 01 00:00:00 1970 +0000
1489 date: Thu Jan 01 00:00:00 1970 +0000
1490 summary: commit on default
1490 summary: commit on default
1491
1491
1492
1492
1493
1493
1494 log -b default -b .
1494 log -b default -b .
1495
1495
1496 $ hg log -b default -b .
1496 $ hg log -b default -b .
1497 changeset: 3:f5d8de11c2e2
1497 changeset: 3:f5d8de11c2e2
1498 branch: test
1498 branch: test
1499 tag: tip
1499 tag: tip
1500 parent: 1:d32277701ccb
1500 parent: 1:d32277701ccb
1501 user: test
1501 user: test
1502 date: Thu Jan 01 00:00:00 1970 +0000
1502 date: Thu Jan 01 00:00:00 1970 +0000
1503 summary: commit on test
1503 summary: commit on test
1504
1504
1505 changeset: 2:c3a4f03cc9a7
1505 changeset: 2:c3a4f03cc9a7
1506 parent: 0:24427303d56f
1506 parent: 0:24427303d56f
1507 user: test
1507 user: test
1508 date: Thu Jan 01 00:00:00 1970 +0000
1508 date: Thu Jan 01 00:00:00 1970 +0000
1509 summary: commit on default
1509 summary: commit on default
1510
1510
1511 changeset: 1:d32277701ccb
1511 changeset: 1:d32277701ccb
1512 branch: test
1512 branch: test
1513 user: test
1513 user: test
1514 date: Thu Jan 01 00:00:00 1970 +0000
1514 date: Thu Jan 01 00:00:00 1970 +0000
1515 summary: commit on test
1515 summary: commit on test
1516
1516
1517 changeset: 0:24427303d56f
1517 changeset: 0:24427303d56f
1518 user: test
1518 user: test
1519 date: Thu Jan 01 00:00:00 1970 +0000
1519 date: Thu Jan 01 00:00:00 1970 +0000
1520 summary: commit on default
1520 summary: commit on default
1521
1521
1522
1522
1523
1523
1524 log -b . -b test
1524 log -b . -b test
1525
1525
1526 $ hg log -b . -b test
1526 $ hg log -b . -b test
1527 changeset: 3:f5d8de11c2e2
1527 changeset: 3:f5d8de11c2e2
1528 branch: test
1528 branch: test
1529 tag: tip
1529 tag: tip
1530 parent: 1:d32277701ccb
1530 parent: 1:d32277701ccb
1531 user: test
1531 user: test
1532 date: Thu Jan 01 00:00:00 1970 +0000
1532 date: Thu Jan 01 00:00:00 1970 +0000
1533 summary: commit on test
1533 summary: commit on test
1534
1534
1535 changeset: 1:d32277701ccb
1535 changeset: 1:d32277701ccb
1536 branch: test
1536 branch: test
1537 user: test
1537 user: test
1538 date: Thu Jan 01 00:00:00 1970 +0000
1538 date: Thu Jan 01 00:00:00 1970 +0000
1539 summary: commit on test
1539 summary: commit on test
1540
1540
1541
1541
1542
1542
1543 log -b 2
1543 log -b 2
1544
1544
1545 $ hg log -b 2
1545 $ hg log -b 2
1546 changeset: 2:c3a4f03cc9a7
1546 changeset: 2:c3a4f03cc9a7
1547 parent: 0:24427303d56f
1547 parent: 0:24427303d56f
1548 user: test
1548 user: test
1549 date: Thu Jan 01 00:00:00 1970 +0000
1549 date: Thu Jan 01 00:00:00 1970 +0000
1550 summary: commit on default
1550 summary: commit on default
1551
1551
1552 changeset: 0:24427303d56f
1552 changeset: 0:24427303d56f
1553 user: test
1553 user: test
1554 date: Thu Jan 01 00:00:00 1970 +0000
1554 date: Thu Jan 01 00:00:00 1970 +0000
1555 summary: commit on default
1555 summary: commit on default
1556
1556
1557 #if gettext
1557 #if gettext
1558
1558
1559 Test that all log names are translated (e.g. branches, bookmarks, tags):
1559 Test that all log names are translated (e.g. branches, bookmarks, tags):
1560
1560
1561 $ hg bookmark babar -r tip
1561 $ hg bookmark babar -r tip
1562
1562
1563 $ HGENCODING=UTF-8 LANGUAGE=de hg log -r tip
1563 $ HGENCODING=UTF-8 LANGUAGE=de hg log -r tip
1564 \xc3\x84nderung: 3:f5d8de11c2e2 (esc)
1564 \xc3\x84nderung: 3:f5d8de11c2e2 (esc)
1565 Zweig: test
1565 Zweig: test
1566 Lesezeichen: babar
1566 Lesezeichen: babar
1567 Marke: tip
1567 Marke: tip
1568 Vorg\xc3\xa4nger: 1:d32277701ccb (esc)
1568 Vorg\xc3\xa4nger: 1:d32277701ccb (esc)
1569 Nutzer: test
1569 Nutzer: test
1570 Datum: Thu Jan 01 00:00:00 1970 +0000
1570 Datum: Thu Jan 01 00:00:00 1970 +0000
1571 Zusammenfassung: commit on test
1571 Zusammenfassung: commit on test
1572
1572
1573 $ hg bookmark -d babar
1573 $ hg bookmark -d babar
1574
1574
1575 #endif
1575 #endif
1576
1576
1577 log -p --cwd dir (in subdir)
1577 log -p --cwd dir (in subdir)
1578
1578
1579 $ mkdir dir
1579 $ mkdir dir
1580 $ hg log -p --cwd dir
1580 $ hg log -p --cwd dir
1581 changeset: 3:f5d8de11c2e2
1581 changeset: 3:f5d8de11c2e2
1582 branch: test
1582 branch: test
1583 tag: tip
1583 tag: tip
1584 parent: 1:d32277701ccb
1584 parent: 1:d32277701ccb
1585 user: test
1585 user: test
1586 date: Thu Jan 01 00:00:00 1970 +0000
1586 date: Thu Jan 01 00:00:00 1970 +0000
1587 summary: commit on test
1587 summary: commit on test
1588
1588
1589 diff -r d32277701ccb -r f5d8de11c2e2 c
1589 diff -r d32277701ccb -r f5d8de11c2e2 c
1590 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1590 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1591 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1591 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1592 @@ -0,0 +1,1 @@
1592 @@ -0,0 +1,1 @@
1593 +c
1593 +c
1594
1594
1595 changeset: 2:c3a4f03cc9a7
1595 changeset: 2:c3a4f03cc9a7
1596 parent: 0:24427303d56f
1596 parent: 0:24427303d56f
1597 user: test
1597 user: test
1598 date: Thu Jan 01 00:00:00 1970 +0000
1598 date: Thu Jan 01 00:00:00 1970 +0000
1599 summary: commit on default
1599 summary: commit on default
1600
1600
1601 diff -r 24427303d56f -r c3a4f03cc9a7 c
1601 diff -r 24427303d56f -r c3a4f03cc9a7 c
1602 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1602 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1603 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1603 +++ b/c Thu Jan 01 00:00:00 1970 +0000
1604 @@ -0,0 +1,1 @@
1604 @@ -0,0 +1,1 @@
1605 +c
1605 +c
1606
1606
1607 changeset: 1:d32277701ccb
1607 changeset: 1:d32277701ccb
1608 branch: test
1608 branch: test
1609 user: test
1609 user: test
1610 date: Thu Jan 01 00:00:00 1970 +0000
1610 date: Thu Jan 01 00:00:00 1970 +0000
1611 summary: commit on test
1611 summary: commit on test
1612
1612
1613 diff -r 24427303d56f -r d32277701ccb b
1613 diff -r 24427303d56f -r d32277701ccb b
1614 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1614 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1615 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1615 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1616 @@ -0,0 +1,1 @@
1616 @@ -0,0 +1,1 @@
1617 +b
1617 +b
1618
1618
1619 changeset: 0:24427303d56f
1619 changeset: 0:24427303d56f
1620 user: test
1620 user: test
1621 date: Thu Jan 01 00:00:00 1970 +0000
1621 date: Thu Jan 01 00:00:00 1970 +0000
1622 summary: commit on default
1622 summary: commit on default
1623
1623
1624 diff -r 000000000000 -r 24427303d56f a
1624 diff -r 000000000000 -r 24427303d56f a
1625 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1625 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1626 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1626 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1627 @@ -0,0 +1,1 @@
1627 @@ -0,0 +1,1 @@
1628 +a
1628 +a
1629
1629
1630
1630
1631
1631
1632 log -p -R repo
1632 log -p -R repo
1633
1633
1634 $ cd dir
1634 $ cd dir
1635 $ hg log -p -R .. ../a
1635 $ hg log -p -R .. ../a
1636 changeset: 0:24427303d56f
1636 changeset: 0:24427303d56f
1637 user: test
1637 user: test
1638 date: Thu Jan 01 00:00:00 1970 +0000
1638 date: Thu Jan 01 00:00:00 1970 +0000
1639 summary: commit on default
1639 summary: commit on default
1640
1640
1641 diff -r 000000000000 -r 24427303d56f a
1641 diff -r 000000000000 -r 24427303d56f a
1642 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1642 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1643 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1643 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1644 @@ -0,0 +1,1 @@
1644 @@ -0,0 +1,1 @@
1645 +a
1645 +a
1646
1646
1647
1647
1648 $ cd ../..
1648 $ cd ../..
1649
1649
1650 $ hg init follow2
1650 $ hg init follow2
1651 $ cd follow2
1651 $ cd follow2
1652
1652
1653 # Build the following history:
1653 # Build the following history:
1654 # tip - o - x - o - x - x
1654 # tip - o - x - o - x - x
1655 # \ /
1655 # \ /
1656 # o - o - o - x
1656 # o - o - o - x
1657 # \ /
1657 # \ /
1658 # o
1658 # o
1659 #
1659 #
1660 # Where "o" is a revision containing "foo" and
1660 # Where "o" is a revision containing "foo" and
1661 # "x" is a revision without "foo"
1661 # "x" is a revision without "foo"
1662
1662
1663 $ touch init
1663 $ touch init
1664 $ hg ci -A -m "init, unrelated"
1664 $ hg ci -A -m "init, unrelated"
1665 adding init
1665 adding init
1666 $ echo 'foo' > init
1666 $ echo 'foo' > init
1667 $ hg ci -m "change, unrelated"
1667 $ hg ci -m "change, unrelated"
1668 $ echo 'foo' > foo
1668 $ echo 'foo' > foo
1669 $ hg ci -A -m "add unrelated old foo"
1669 $ hg ci -A -m "add unrelated old foo"
1670 adding foo
1670 adding foo
1671 $ hg rm foo
1671 $ hg rm foo
1672 $ hg ci -m "delete foo, unrelated"
1672 $ hg ci -m "delete foo, unrelated"
1673 $ echo 'related' > foo
1673 $ echo 'related' > foo
1674 $ hg ci -A -m "add foo, related"
1674 $ hg ci -A -m "add foo, related"
1675 adding foo
1675 adding foo
1676
1676
1677 $ hg up 0
1677 $ hg up 0
1678 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1678 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1679 $ touch branch
1679 $ touch branch
1680 $ hg ci -A -m "first branch, unrelated"
1680 $ hg ci -A -m "first branch, unrelated"
1681 adding branch
1681 adding branch
1682 created new head
1682 created new head
1683 $ touch foo
1683 $ touch foo
1684 $ hg ci -A -m "create foo, related"
1684 $ hg ci -A -m "create foo, related"
1685 adding foo
1685 adding foo
1686 $ echo 'change' > foo
1686 $ echo 'change' > foo
1687 $ hg ci -m "change foo, related"
1687 $ hg ci -m "change foo, related"
1688
1688
1689 $ hg up 6
1689 $ hg up 6
1690 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1690 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1691 $ echo 'change foo in branch' > foo
1691 $ echo 'change foo in branch' > foo
1692 $ hg ci -m "change foo in branch, related"
1692 $ hg ci -m "change foo in branch, related"
1693 created new head
1693 created new head
1694 $ hg merge 7
1694 $ hg merge 7
1695 merging foo
1695 merging foo
1696 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1696 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1697 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1697 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1698 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1698 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1699 [1]
1699 [1]
1700 $ echo 'merge 1' > foo
1700 $ echo 'merge 1' > foo
1701 $ hg resolve -m foo
1701 $ hg resolve -m foo
1702 (no more unresolved files)
1702 (no more unresolved files)
1703 $ hg ci -m "First merge, related"
1703 $ hg ci -m "First merge, related"
1704
1704
1705 $ hg merge 4
1705 $ hg merge 4
1706 merging foo
1706 merging foo
1707 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1707 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
1708 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
1708 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
1709 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1709 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
1710 [1]
1710 [1]
1711 $ echo 'merge 2' > foo
1711 $ echo 'merge 2' > foo
1712 $ hg resolve -m foo
1712 $ hg resolve -m foo
1713 (no more unresolved files)
1713 (no more unresolved files)
1714 $ hg ci -m "Last merge, related"
1714 $ hg ci -m "Last merge, related"
1715
1715
1716 $ hg log --graph
1716 $ hg log --graph
1717 @ changeset: 10:4dae8563d2c5
1717 @ changeset: 10:4dae8563d2c5
1718 |\ tag: tip
1718 |\ tag: tip
1719 | | parent: 9:7b35701b003e
1719 | | parent: 9:7b35701b003e
1720 | | parent: 4:88176d361b69
1720 | | parent: 4:88176d361b69
1721 | | user: test
1721 | | user: test
1722 | | date: Thu Jan 01 00:00:00 1970 +0000
1722 | | date: Thu Jan 01 00:00:00 1970 +0000
1723 | | summary: Last merge, related
1723 | | summary: Last merge, related
1724 | |
1724 | |
1725 | o changeset: 9:7b35701b003e
1725 | o changeset: 9:7b35701b003e
1726 | |\ parent: 8:e5416ad8a855
1726 | |\ parent: 8:e5416ad8a855
1727 | | | parent: 7:87fe3144dcfa
1727 | | | parent: 7:87fe3144dcfa
1728 | | | user: test
1728 | | | user: test
1729 | | | date: Thu Jan 01 00:00:00 1970 +0000
1729 | | | date: Thu Jan 01 00:00:00 1970 +0000
1730 | | | summary: First merge, related
1730 | | | summary: First merge, related
1731 | | |
1731 | | |
1732 | | o changeset: 8:e5416ad8a855
1732 | | o changeset: 8:e5416ad8a855
1733 | | | parent: 6:dc6c325fe5ee
1733 | | | parent: 6:dc6c325fe5ee
1734 | | | user: test
1734 | | | user: test
1735 | | | date: Thu Jan 01 00:00:00 1970 +0000
1735 | | | date: Thu Jan 01 00:00:00 1970 +0000
1736 | | | summary: change foo in branch, related
1736 | | | summary: change foo in branch, related
1737 | | |
1737 | | |
1738 | o | changeset: 7:87fe3144dcfa
1738 | o | changeset: 7:87fe3144dcfa
1739 | |/ user: test
1739 | |/ user: test
1740 | | date: Thu Jan 01 00:00:00 1970 +0000
1740 | | date: Thu Jan 01 00:00:00 1970 +0000
1741 | | summary: change foo, related
1741 | | summary: change foo, related
1742 | |
1742 | |
1743 | o changeset: 6:dc6c325fe5ee
1743 | o changeset: 6:dc6c325fe5ee
1744 | | user: test
1744 | | user: test
1745 | | date: Thu Jan 01 00:00:00 1970 +0000
1745 | | date: Thu Jan 01 00:00:00 1970 +0000
1746 | | summary: create foo, related
1746 | | summary: create foo, related
1747 | |
1747 | |
1748 | o changeset: 5:73db34516eb9
1748 | o changeset: 5:73db34516eb9
1749 | | parent: 0:e87515fd044a
1749 | | parent: 0:e87515fd044a
1750 | | user: test
1750 | | user: test
1751 | | date: Thu Jan 01 00:00:00 1970 +0000
1751 | | date: Thu Jan 01 00:00:00 1970 +0000
1752 | | summary: first branch, unrelated
1752 | | summary: first branch, unrelated
1753 | |
1753 | |
1754 o | changeset: 4:88176d361b69
1754 o | changeset: 4:88176d361b69
1755 | | user: test
1755 | | user: test
1756 | | date: Thu Jan 01 00:00:00 1970 +0000
1756 | | date: Thu Jan 01 00:00:00 1970 +0000
1757 | | summary: add foo, related
1757 | | summary: add foo, related
1758 | |
1758 | |
1759 o | changeset: 3:dd78ae4afb56
1759 o | changeset: 3:dd78ae4afb56
1760 | | user: test
1760 | | user: test
1761 | | date: Thu Jan 01 00:00:00 1970 +0000
1761 | | date: Thu Jan 01 00:00:00 1970 +0000
1762 | | summary: delete foo, unrelated
1762 | | summary: delete foo, unrelated
1763 | |
1763 | |
1764 o | changeset: 2:c4c64aedf0f7
1764 o | changeset: 2:c4c64aedf0f7
1765 | | user: test
1765 | | user: test
1766 | | date: Thu Jan 01 00:00:00 1970 +0000
1766 | | date: Thu Jan 01 00:00:00 1970 +0000
1767 | | summary: add unrelated old foo
1767 | | summary: add unrelated old foo
1768 | |
1768 | |
1769 o | changeset: 1:e5faa7440653
1769 o | changeset: 1:e5faa7440653
1770 |/ user: test
1770 |/ user: test
1771 | date: Thu Jan 01 00:00:00 1970 +0000
1771 | date: Thu Jan 01 00:00:00 1970 +0000
1772 | summary: change, unrelated
1772 | summary: change, unrelated
1773 |
1773 |
1774 o changeset: 0:e87515fd044a
1774 o changeset: 0:e87515fd044a
1775 user: test
1775 user: test
1776 date: Thu Jan 01 00:00:00 1970 +0000
1776 date: Thu Jan 01 00:00:00 1970 +0000
1777 summary: init, unrelated
1777 summary: init, unrelated
1778
1778
1779
1779
1780 $ hg --traceback log -f foo
1780 $ hg --traceback log -f foo
1781 changeset: 10:4dae8563d2c5
1781 changeset: 10:4dae8563d2c5
1782 tag: tip
1782 tag: tip
1783 parent: 9:7b35701b003e
1783 parent: 9:7b35701b003e
1784 parent: 4:88176d361b69
1784 parent: 4:88176d361b69
1785 user: test
1785 user: test
1786 date: Thu Jan 01 00:00:00 1970 +0000
1786 date: Thu Jan 01 00:00:00 1970 +0000
1787 summary: Last merge, related
1787 summary: Last merge, related
1788
1788
1789 changeset: 9:7b35701b003e
1789 changeset: 9:7b35701b003e
1790 parent: 8:e5416ad8a855
1790 parent: 8:e5416ad8a855
1791 parent: 7:87fe3144dcfa
1791 parent: 7:87fe3144dcfa
1792 user: test
1792 user: test
1793 date: Thu Jan 01 00:00:00 1970 +0000
1793 date: Thu Jan 01 00:00:00 1970 +0000
1794 summary: First merge, related
1794 summary: First merge, related
1795
1795
1796 changeset: 8:e5416ad8a855
1796 changeset: 8:e5416ad8a855
1797 parent: 6:dc6c325fe5ee
1797 parent: 6:dc6c325fe5ee
1798 user: test
1798 user: test
1799 date: Thu Jan 01 00:00:00 1970 +0000
1799 date: Thu Jan 01 00:00:00 1970 +0000
1800 summary: change foo in branch, related
1800 summary: change foo in branch, related
1801
1801
1802 changeset: 7:87fe3144dcfa
1802 changeset: 7:87fe3144dcfa
1803 user: test
1803 user: test
1804 date: Thu Jan 01 00:00:00 1970 +0000
1804 date: Thu Jan 01 00:00:00 1970 +0000
1805 summary: change foo, related
1805 summary: change foo, related
1806
1806
1807 changeset: 6:dc6c325fe5ee
1807 changeset: 6:dc6c325fe5ee
1808 user: test
1808 user: test
1809 date: Thu Jan 01 00:00:00 1970 +0000
1809 date: Thu Jan 01 00:00:00 1970 +0000
1810 summary: create foo, related
1810 summary: create foo, related
1811
1811
1812 changeset: 4:88176d361b69
1812 changeset: 4:88176d361b69
1813 user: test
1813 user: test
1814 date: Thu Jan 01 00:00:00 1970 +0000
1814 date: Thu Jan 01 00:00:00 1970 +0000
1815 summary: add foo, related
1815 summary: add foo, related
1816
1816
1817
1817
1818 Also check when maxrev < lastrevfilelog
1818 Also check when maxrev < lastrevfilelog
1819
1819
1820 $ hg --traceback log -f -r4 foo
1820 $ hg --traceback log -f -r4 foo
1821 changeset: 4:88176d361b69
1821 changeset: 4:88176d361b69
1822 user: test
1822 user: test
1823 date: Thu Jan 01 00:00:00 1970 +0000
1823 date: Thu Jan 01 00:00:00 1970 +0000
1824 summary: add foo, related
1824 summary: add foo, related
1825
1825
1826 $ cd ..
1826 $ cd ..
1827
1827
1828 Issue2383: hg log showing _less_ differences than hg diff
1828 Issue2383: hg log showing _less_ differences than hg diff
1829
1829
1830 $ hg init issue2383
1830 $ hg init issue2383
1831 $ cd issue2383
1831 $ cd issue2383
1832
1832
1833 Create a test repo:
1833 Create a test repo:
1834
1834
1835 $ echo a > a
1835 $ echo a > a
1836 $ hg ci -Am0
1836 $ hg ci -Am0
1837 adding a
1837 adding a
1838 $ echo b > b
1838 $ echo b > b
1839 $ hg ci -Am1
1839 $ hg ci -Am1
1840 adding b
1840 adding b
1841 $ hg co 0
1841 $ hg co 0
1842 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1842 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1843 $ echo b > a
1843 $ echo b > a
1844 $ hg ci -m2
1844 $ hg ci -m2
1845 created new head
1845 created new head
1846
1846
1847 Merge:
1847 Merge:
1848
1848
1849 $ hg merge
1849 $ hg merge
1850 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1850 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1851 (branch merge, don't forget to commit)
1851 (branch merge, don't forget to commit)
1852
1852
1853 Make sure there's a file listed in the merge to trigger the bug:
1853 Make sure there's a file listed in the merge to trigger the bug:
1854
1854
1855 $ echo c > a
1855 $ echo c > a
1856 $ hg ci -m3
1856 $ hg ci -m3
1857
1857
1858 Two files shown here in diff:
1858 Two files shown here in diff:
1859
1859
1860 $ hg diff --rev 2:3
1860 $ hg diff --rev 2:3
1861 diff -r b09be438c43a -r 8e07aafe1edc a
1861 diff -r b09be438c43a -r 8e07aafe1edc a
1862 --- a/a Thu Jan 01 00:00:00 1970 +0000
1862 --- a/a Thu Jan 01 00:00:00 1970 +0000
1863 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1863 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1864 @@ -1,1 +1,1 @@
1864 @@ -1,1 +1,1 @@
1865 -b
1865 -b
1866 +c
1866 +c
1867 diff -r b09be438c43a -r 8e07aafe1edc b
1867 diff -r b09be438c43a -r 8e07aafe1edc b
1868 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1868 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1869 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1869 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1870 @@ -0,0 +1,1 @@
1870 @@ -0,0 +1,1 @@
1871 +b
1871 +b
1872
1872
1873 Diff here should be the same:
1873 Diff here should be the same:
1874
1874
1875 $ hg log -vpr 3
1875 $ hg log -vpr 3
1876 changeset: 3:8e07aafe1edc
1876 changeset: 3:8e07aafe1edc
1877 tag: tip
1877 tag: tip
1878 parent: 2:b09be438c43a
1878 parent: 2:b09be438c43a
1879 parent: 1:925d80f479bb
1879 parent: 1:925d80f479bb
1880 user: test
1880 user: test
1881 date: Thu Jan 01 00:00:00 1970 +0000
1881 date: Thu Jan 01 00:00:00 1970 +0000
1882 files: a
1882 files: a
1883 description:
1883 description:
1884 3
1884 3
1885
1885
1886
1886
1887 diff -r b09be438c43a -r 8e07aafe1edc a
1887 diff -r b09be438c43a -r 8e07aafe1edc a
1888 --- a/a Thu Jan 01 00:00:00 1970 +0000
1888 --- a/a Thu Jan 01 00:00:00 1970 +0000
1889 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1889 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1890 @@ -1,1 +1,1 @@
1890 @@ -1,1 +1,1 @@
1891 -b
1891 -b
1892 +c
1892 +c
1893 diff -r b09be438c43a -r 8e07aafe1edc b
1893 diff -r b09be438c43a -r 8e07aafe1edc b
1894 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1894 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1895 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1895 +++ b/b Thu Jan 01 00:00:00 1970 +0000
1896 @@ -0,0 +1,1 @@
1896 @@ -0,0 +1,1 @@
1897 +b
1897 +b
1898
1898
1899 $ cd ..
1899 $ cd ..
1900
1900
1901 'hg log -r rev fn' when last(filelog(fn)) != rev
1901 'hg log -r rev fn' when last(filelog(fn)) != rev
1902
1902
1903 $ hg init simplelog
1903 $ hg init simplelog
1904 $ cd simplelog
1904 $ cd simplelog
1905 $ echo f > a
1905 $ echo f > a
1906 $ hg ci -Am'a' -d '0 0'
1906 $ hg ci -Am'a' -d '0 0'
1907 adding a
1907 adding a
1908 $ echo f >> a
1908 $ echo f >> a
1909 $ hg ci -Am'a bis' -d '1 0'
1909 $ hg ci -Am'a bis' -d '1 0'
1910
1910
1911 $ hg log -r0 a
1911 $ hg log -r0 a
1912 changeset: 0:9f758d63dcde
1912 changeset: 0:9f758d63dcde
1913 user: test
1913 user: test
1914 date: Thu Jan 01 00:00:00 1970 +0000
1914 date: Thu Jan 01 00:00:00 1970 +0000
1915 summary: a
1915 summary: a
1916
1916
1917 enable obsolete to test hidden feature
1917 enable obsolete to test hidden feature
1918
1918
1919 $ cat >> $HGRCPATH << EOF
1919 $ cat >> $HGRCPATH << EOF
1920 > [experimental]
1920 > [experimental]
1921 > evolution.createmarkers=True
1921 > evolution.createmarkers=True
1922 > EOF
1922 > EOF
1923
1923
1924 $ hg log --template='{rev}:{node}\n'
1924 $ hg log --template='{rev}:{node}\n'
1925 1:a765632148dc55d38c35c4f247c618701886cb2f
1925 1:a765632148dc55d38c35c4f247c618701886cb2f
1926 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1926 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1927 $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f
1927 $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f
1928 obsoleted 1 changesets
1928 obsoleted 1 changesets
1929 $ hg up null -q
1929 $ hg up null -q
1930 $ hg log --template='{rev}:{node}\n'
1930 $ hg log --template='{rev}:{node}\n'
1931 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1931 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1932 $ hg log --template='{rev}:{node}\n' --hidden
1932 $ hg log --template='{rev}:{node}\n' --hidden
1933 1:a765632148dc55d38c35c4f247c618701886cb2f
1933 1:a765632148dc55d38c35c4f247c618701886cb2f
1934 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1934 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1935 $ hg log -r a
1935 $ hg log -r a
1936 abort: hidden revision 'a' is pruned!
1936 abort: hidden revision 'a' is pruned!
1937 (use --hidden to access hidden revisions)
1937 (use --hidden to access hidden revisions)
1938 [255]
1938 [255]
1939
1939
1940 test that parent prevent a changeset to be hidden
1940 test that parent prevent a changeset to be hidden
1941
1941
1942 $ hg up 1 -q --hidden
1942 $ hg up 1 -q --hidden
1943 updating to a hidden changeset a765632148dc
1943 updating to a hidden changeset a765632148dc
1944 (hidden revision 'a765632148dc' is pruned)
1944 (hidden revision 'a765632148dc' is pruned)
1945 $ hg log --template='{rev}:{node}\n'
1945 $ hg log --template='{rev}:{node}\n'
1946 1:a765632148dc55d38c35c4f247c618701886cb2f
1946 1:a765632148dc55d38c35c4f247c618701886cb2f
1947 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1947 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1948
1948
1949 test that second parent prevent a changeset to be hidden too
1949 test that second parent prevent a changeset to be hidden too
1950
1950
1951 $ hg debugsetparents 0 1 # nothing suitable to merge here
1951 $ hg debugsetparents 0 1 # nothing suitable to merge here
1952 $ hg log --template='{rev}:{node}\n'
1952 $ hg log --template='{rev}:{node}\n'
1953 1:a765632148dc55d38c35c4f247c618701886cb2f
1953 1:a765632148dc55d38c35c4f247c618701886cb2f
1954 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1954 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1955 $ hg debugsetparents 1
1955 $ hg debugsetparents 1
1956 $ hg up -q null
1956 $ hg up -q null
1957
1957
1958 bookmarks prevent a changeset being hidden
1958 bookmarks prevent a changeset being hidden
1959
1959
1960 $ hg bookmark --hidden -r 1 X
1960 $ hg bookmark --hidden -r 1 X
1961 bookmarking hidden changeset a765632148dc
1961 bookmarking hidden changeset a765632148dc
1962 (hidden revision 'a765632148dc' is pruned)
1962 (hidden revision 'a765632148dc' is pruned)
1963 $ hg log --template '{rev}:{node}\n'
1963 $ hg log --template '{rev}:{node}\n'
1964 1:a765632148dc55d38c35c4f247c618701886cb2f
1964 1:a765632148dc55d38c35c4f247c618701886cb2f
1965 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1965 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1966 $ hg bookmark -d X
1966 $ hg bookmark -d X
1967
1967
1968 divergent bookmarks are not hidden
1968 divergent bookmarks are not hidden
1969
1969
1970 $ hg bookmark --hidden -r 1 X@foo
1970 $ hg bookmark --hidden -r 1 X@foo
1971 bookmarking hidden changeset a765632148dc
1971 bookmarking hidden changeset a765632148dc
1972 (hidden revision 'a765632148dc' is pruned)
1972 (hidden revision 'a765632148dc' is pruned)
1973 $ hg log --template '{rev}:{node}\n'
1973 $ hg log --template '{rev}:{node}\n'
1974 1:a765632148dc55d38c35c4f247c618701886cb2f
1974 1:a765632148dc55d38c35c4f247c618701886cb2f
1975 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1975 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1976
1976
1977 test hidden revision 0 (issue5385)
1977 test hidden revision 0 (issue5385)
1978
1978
1979 $ hg bookmark -d X@foo
1979 $ hg bookmark -d X@foo
1980 $ hg up null -q
1980 $ hg up null -q
1981 $ hg debugobsolete 9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1981 $ hg debugobsolete 9f758d63dcde62d547ebfb08e1e7ee96535f2b05
1982 obsoleted 1 changesets
1982 obsoleted 1 changesets
1983 $ echo f > b
1983 $ echo f > b
1984 $ hg ci -Am'b' -d '2 0'
1984 $ hg ci -Am'b' -d '2 0'
1985 adding b
1985 adding b
1986 $ echo f >> b
1986 $ echo f >> b
1987 $ hg ci -m'b bis' -d '3 0'
1987 $ hg ci -m'b bis' -d '3 0'
1988 $ hg log -T'{rev}:{node}\n'
1988 $ hg log -T'{rev}:{node}\n'
1989 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1989 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1990 2:94375ec45bddd2a824535fc04855bd058c926ec0
1990 2:94375ec45bddd2a824535fc04855bd058c926ec0
1991
1991
1992 $ hg log -T'{rev}:{node}\n' -r:
1992 $ hg log -T'{rev}:{node}\n' -r:
1993 2:94375ec45bddd2a824535fc04855bd058c926ec0
1993 2:94375ec45bddd2a824535fc04855bd058c926ec0
1994 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1994 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1995 $ hg log -T'{rev}:{node}\n' -r:tip
1995 $ hg log -T'{rev}:{node}\n' -r:tip
1996 2:94375ec45bddd2a824535fc04855bd058c926ec0
1996 2:94375ec45bddd2a824535fc04855bd058c926ec0
1997 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1997 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
1998 $ hg log -T'{rev}:{node}\n' -r:0
1998 $ hg log -T'{rev}:{node}\n' -r:0
1999 abort: hidden revision '0' is pruned!
1999 abort: hidden revision '0' is pruned!
2000 (use --hidden to access hidden revisions)
2000 (use --hidden to access hidden revisions)
2001 [255]
2001 [255]
2002 $ hg log -T'{rev}:{node}\n' -f
2002 $ hg log -T'{rev}:{node}\n' -f
2003 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2003 3:d7d28b288a6b83d5d2cf49f10c5974deed3a1d2e
2004 2:94375ec45bddd2a824535fc04855bd058c926ec0
2004 2:94375ec45bddd2a824535fc04855bd058c926ec0
2005
2005
2006 clear extensions configuration
2006 clear extensions configuration
2007 $ echo '[extensions]' >> $HGRCPATH
2007 $ echo '[extensions]' >> $HGRCPATH
2008 $ echo "obs=!" >> $HGRCPATH
2008 $ echo "obs=!" >> $HGRCPATH
2009 $ cd ..
2009 $ cd ..
2010
2010
2011 test -u/-k for problematic encoding
2011 test -u/-k for problematic encoding
2012 # unicode: cp932:
2012 # unicode: cp932:
2013 # u30A2 0x83 0x41(= 'A')
2013 # u30A2 0x83 0x41(= 'A')
2014 # u30C2 0x83 0x61(= 'a')
2014 # u30C2 0x83 0x61(= 'a')
2015
2015
2016 $ hg init problematicencoding
2016 $ hg init problematicencoding
2017 $ cd problematicencoding
2017 $ cd problematicencoding
2018
2018
2019 $ $PYTHON > setup.sh <<EOF
2019 $ $PYTHON > setup.sh <<EOF
2020 > print(u'''
2020 > print(u'''
2021 > echo a > text
2021 > echo a > text
2022 > hg add text
2022 > hg add text
2023 > hg --encoding utf-8 commit -u '\u30A2' -m none
2023 > hg --encoding utf-8 commit -u '\u30A2' -m none
2024 > echo b > text
2024 > echo b > text
2025 > hg --encoding utf-8 commit -u '\u30C2' -m none
2025 > hg --encoding utf-8 commit -u '\u30C2' -m none
2026 > echo c > text
2026 > echo c > text
2027 > hg --encoding utf-8 commit -u none -m '\u30A2'
2027 > hg --encoding utf-8 commit -u none -m '\u30A2'
2028 > echo d > text
2028 > echo d > text
2029 > hg --encoding utf-8 commit -u none -m '\u30C2'
2029 > hg --encoding utf-8 commit -u none -m '\u30C2'
2030 > '''.encode('utf-8'))
2030 > '''.encode('utf-8'))
2031 > EOF
2031 > EOF
2032 $ sh < setup.sh
2032 $ sh < setup.sh
2033
2033
2034 test in problematic encoding
2034 test in problematic encoding
2035 $ $PYTHON > test.sh <<EOF
2035 $ $PYTHON > test.sh <<EOF
2036 > print(u'''
2036 > print(u'''
2037 > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
2037 > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
2038 > echo ====
2038 > echo ====
2039 > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
2039 > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
2040 > echo ====
2040 > echo ====
2041 > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
2041 > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
2042 > echo ====
2042 > echo ====
2043 > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
2043 > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
2044 > '''.encode('cp932'))
2044 > '''.encode('cp932'))
2045 > EOF
2045 > EOF
2046 $ sh < test.sh
2046 $ sh < test.sh
2047 0
2047 0
2048 ====
2048 ====
2049 1
2049 1
2050 ====
2050 ====
2051 2
2051 2
2052 0
2052 0
2053 ====
2053 ====
2054 3
2054 3
2055 1
2055 1
2056
2056
2057 $ cd ..
2057 $ cd ..
2058
2058
2059 test hg log on non-existent files and on directories
2059 test hg log on non-existent files and on directories
2060 $ hg init issue1340
2060 $ hg init issue1340
2061 $ cd issue1340
2061 $ cd issue1340
2062 $ mkdir d1; mkdir D2; mkdir D3.i; mkdir d4.hg; mkdir d5.d; mkdir .d6
2062 $ mkdir d1; mkdir D2; mkdir D3.i; mkdir d4.hg; mkdir d5.d; mkdir .d6
2063 $ echo 1 > d1/f1
2063 $ echo 1 > d1/f1
2064 $ echo 1 > D2/f1
2064 $ echo 1 > D2/f1
2065 $ echo 1 > D3.i/f1
2065 $ echo 1 > D3.i/f1
2066 $ echo 1 > d4.hg/f1
2066 $ echo 1 > d4.hg/f1
2067 $ echo 1 > d5.d/f1
2067 $ echo 1 > d5.d/f1
2068 $ echo 1 > .d6/f1
2068 $ echo 1 > .d6/f1
2069 $ hg -q add .
2069 $ hg -q add .
2070 $ hg commit -m "a bunch of weird directories"
2070 $ hg commit -m "a bunch of weird directories"
2071 $ hg log -l1 d1/f1 | grep changeset
2071 $ hg log -l1 d1/f1 | grep changeset
2072 changeset: 0:65624cd9070a
2072 changeset: 0:65624cd9070a
2073 $ hg log -l1 f1
2073 $ hg log -l1 f1
2074 $ hg log -l1 . | grep changeset
2074 $ hg log -l1 . | grep changeset
2075 changeset: 0:65624cd9070a
2075 changeset: 0:65624cd9070a
2076 $ hg log -l1 ./ | grep changeset
2076 $ hg log -l1 ./ | grep changeset
2077 changeset: 0:65624cd9070a
2077 changeset: 0:65624cd9070a
2078 $ hg log -l1 d1 | grep changeset
2078 $ hg log -l1 d1 | grep changeset
2079 changeset: 0:65624cd9070a
2079 changeset: 0:65624cd9070a
2080 $ hg log -l1 D2 | grep changeset
2080 $ hg log -l1 D2 | grep changeset
2081 changeset: 0:65624cd9070a
2081 changeset: 0:65624cd9070a
2082 $ hg log -l1 D2/f1 | grep changeset
2082 $ hg log -l1 D2/f1 | grep changeset
2083 changeset: 0:65624cd9070a
2083 changeset: 0:65624cd9070a
2084 $ hg log -l1 D3.i | grep changeset
2084 $ hg log -l1 D3.i | grep changeset
2085 changeset: 0:65624cd9070a
2085 changeset: 0:65624cd9070a
2086 $ hg log -l1 D3.i/f1 | grep changeset
2086 $ hg log -l1 D3.i/f1 | grep changeset
2087 changeset: 0:65624cd9070a
2087 changeset: 0:65624cd9070a
2088 $ hg log -l1 d4.hg | grep changeset
2088 $ hg log -l1 d4.hg | grep changeset
2089 changeset: 0:65624cd9070a
2089 changeset: 0:65624cd9070a
2090 $ hg log -l1 d4.hg/f1 | grep changeset
2090 $ hg log -l1 d4.hg/f1 | grep changeset
2091 changeset: 0:65624cd9070a
2091 changeset: 0:65624cd9070a
2092 $ hg log -l1 d5.d | grep changeset
2092 $ hg log -l1 d5.d | grep changeset
2093 changeset: 0:65624cd9070a
2093 changeset: 0:65624cd9070a
2094 $ hg log -l1 d5.d/f1 | grep changeset
2094 $ hg log -l1 d5.d/f1 | grep changeset
2095 changeset: 0:65624cd9070a
2095 changeset: 0:65624cd9070a
2096 $ hg log -l1 .d6 | grep changeset
2096 $ hg log -l1 .d6 | grep changeset
2097 changeset: 0:65624cd9070a
2097 changeset: 0:65624cd9070a
2098 $ hg log -l1 .d6/f1 | grep changeset
2098 $ hg log -l1 .d6/f1 | grep changeset
2099 changeset: 0:65624cd9070a
2099 changeset: 0:65624cd9070a
2100
2100
2101 issue3772: hg log -r :null showing revision 0 as well
2101 issue3772: hg log -r :null showing revision 0 as well
2102
2102
2103 $ hg log -r :null
2103 $ hg log -r :null
2104 changeset: 0:65624cd9070a
2104 changeset: 0:65624cd9070a
2105 tag: tip
2105 tag: tip
2106 user: test
2106 user: test
2107 date: Thu Jan 01 00:00:00 1970 +0000
2107 date: Thu Jan 01 00:00:00 1970 +0000
2108 summary: a bunch of weird directories
2108 summary: a bunch of weird directories
2109
2109
2110 changeset: -1:000000000000
2110 changeset: -1:000000000000
2111 user:
2111 user:
2112 date: Thu Jan 01 00:00:00 1970 +0000
2112 date: Thu Jan 01 00:00:00 1970 +0000
2113
2113
2114 $ hg log -r null:null
2114 $ hg log -r null:null
2115 changeset: -1:000000000000
2115 changeset: -1:000000000000
2116 user:
2116 user:
2117 date: Thu Jan 01 00:00:00 1970 +0000
2117 date: Thu Jan 01 00:00:00 1970 +0000
2118
2118
2119 working-directory revision requires special treatment
2119 working-directory revision requires special treatment
2120
2120
2121 clean:
2121 clean:
2122
2122
2123 $ hg log -r 'wdir()' --debug
2123 $ hg log -r 'wdir()' --debug
2124 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2124 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2125 phase: draft
2125 phase: draft
2126 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2126 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2127 parent: -1:0000000000000000000000000000000000000000
2127 parent: -1:0000000000000000000000000000000000000000
2128 user: test
2128 user: test
2129 date: [A-Za-z0-9:+ ]+ (re)
2129 date: [A-Za-z0-9:+ ]+ (re)
2130 extra: branch=default
2130 extra: branch=default
2131
2131
2132 $ hg log -r 'wdir()' -p --stat
2132 $ hg log -r 'wdir()' -p --stat
2133 changeset: 2147483647:ffffffffffff
2133 changeset: 2147483647:ffffffffffff
2134 parent: 0:65624cd9070a
2134 parent: 0:65624cd9070a
2135 user: test
2135 user: test
2136 date: [A-Za-z0-9:+ ]+ (re)
2136 date: [A-Za-z0-9:+ ]+ (re)
2137
2137
2138
2138
2139
2139
2140
2140
2141 dirty:
2141 dirty:
2142
2142
2143 $ echo 2 >> d1/f1
2143 $ echo 2 >> d1/f1
2144 $ echo 2 > d1/f2
2144 $ echo 2 > d1/f2
2145 $ hg add d1/f2
2145 $ hg add d1/f2
2146 $ hg remove .d6/f1
2146 $ hg remove .d6/f1
2147 $ hg status
2147 $ hg status
2148 M d1/f1
2148 M d1/f1
2149 A d1/f2
2149 A d1/f2
2150 R .d6/f1
2150 R .d6/f1
2151
2151
2152 $ hg log -r 'wdir()'
2152 $ hg log -r 'wdir()'
2153 changeset: 2147483647:ffffffffffff
2153 changeset: 2147483647:ffffffffffff
2154 parent: 0:65624cd9070a
2154 parent: 0:65624cd9070a
2155 user: test
2155 user: test
2156 date: [A-Za-z0-9:+ ]+ (re)
2156 date: [A-Za-z0-9:+ ]+ (re)
2157
2157
2158 $ hg log -r 'wdir()' -q
2158 $ hg log -r 'wdir()' -q
2159 2147483647:ffffffffffff
2159 2147483647:ffffffffffff
2160
2160
2161 $ hg log -r 'wdir()' --debug
2161 $ hg log -r 'wdir()' --debug
2162 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2162 changeset: 2147483647:ffffffffffffffffffffffffffffffffffffffff
2163 phase: draft
2163 phase: draft
2164 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2164 parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08
2165 parent: -1:0000000000000000000000000000000000000000
2165 parent: -1:0000000000000000000000000000000000000000
2166 user: test
2166 user: test
2167 date: [A-Za-z0-9:+ ]+ (re)
2167 date: [A-Za-z0-9:+ ]+ (re)
2168 files: d1/f1
2168 files: d1/f1
2169 files+: d1/f2
2169 files+: d1/f2
2170 files-: .d6/f1
2170 files-: .d6/f1
2171 extra: branch=default
2171 extra: branch=default
2172
2172
2173 $ hg log -r 'wdir()' -p --stat --git
2173 $ hg log -r 'wdir()' -p --stat --git
2174 changeset: 2147483647:ffffffffffff
2174 changeset: 2147483647:ffffffffffff
2175 parent: 0:65624cd9070a
2175 parent: 0:65624cd9070a
2176 user: test
2176 user: test
2177 date: [A-Za-z0-9:+ ]+ (re)
2177 date: [A-Za-z0-9:+ ]+ (re)
2178
2178
2179 .d6/f1 | 1 -
2179 .d6/f1 | 1 -
2180 d1/f1 | 1 +
2180 d1/f1 | 1 +
2181 d1/f2 | 1 +
2181 d1/f2 | 1 +
2182 3 files changed, 2 insertions(+), 1 deletions(-)
2182 3 files changed, 2 insertions(+), 1 deletions(-)
2183
2183
2184 diff --git a/.d6/f1 b/.d6/f1
2184 diff --git a/.d6/f1 b/.d6/f1
2185 deleted file mode 100644
2185 deleted file mode 100644
2186 --- a/.d6/f1
2186 --- a/.d6/f1
2187 +++ /dev/null
2187 +++ /dev/null
2188 @@ -1,1 +0,0 @@
2188 @@ -1,1 +0,0 @@
2189 -1
2189 -1
2190 diff --git a/d1/f1 b/d1/f1
2190 diff --git a/d1/f1 b/d1/f1
2191 --- a/d1/f1
2191 --- a/d1/f1
2192 +++ b/d1/f1
2192 +++ b/d1/f1
2193 @@ -1,1 +1,2 @@
2193 @@ -1,1 +1,2 @@
2194 1
2194 1
2195 +2
2195 +2
2196 diff --git a/d1/f2 b/d1/f2
2196 diff --git a/d1/f2 b/d1/f2
2197 new file mode 100644
2197 new file mode 100644
2198 --- /dev/null
2198 --- /dev/null
2199 +++ b/d1/f2
2199 +++ b/d1/f2
2200 @@ -0,0 +1,1 @@
2200 @@ -0,0 +1,1 @@
2201 +2
2201 +2
2202
2202
2203 $ hg log -r 'wdir()' -Tjson
2203 $ hg log -r 'wdir()' -Tjson
2204 [
2204 [
2205 {
2205 {
2206 "rev": null,
2206 "rev": null,
2207 "node": null,
2207 "node": null,
2208 "branch": "default",
2208 "branch": "default",
2209 "phase": "draft",
2209 "phase": "draft",
2210 "user": "test",
2210 "user": "test",
2211 "date": [*, 0], (glob)
2211 "date": [*, 0], (glob)
2212 "desc": "",
2212 "desc": "",
2213 "bookmarks": [],
2213 "bookmarks": [],
2214 "tags": [],
2214 "tags": [],
2215 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"]
2215 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"]
2216 }
2216 }
2217 ]
2217 ]
2218
2218
2219 $ hg log -r 'wdir()' -Tjson -q
2219 $ hg log -r 'wdir()' -Tjson -q
2220 [
2220 [
2221 {
2221 {
2222 "rev": null,
2222 "rev": null,
2223 "node": null
2223 "node": null
2224 }
2224 }
2225 ]
2225 ]
2226
2226
2227 $ hg log -r 'wdir()' -Tjson --debug
2227 $ hg log -r 'wdir()' -Tjson --debug
2228 [
2228 [
2229 {
2229 {
2230 "rev": null,
2230 "rev": null,
2231 "node": null,
2231 "node": null,
2232 "branch": "default",
2232 "branch": "default",
2233 "phase": "draft",
2233 "phase": "draft",
2234 "user": "test",
2234 "user": "test",
2235 "date": [*, 0], (glob)
2235 "date": [*, 0], (glob)
2236 "desc": "",
2236 "desc": "",
2237 "bookmarks": [],
2237 "bookmarks": [],
2238 "tags": [],
2238 "tags": [],
2239 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2239 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2240 "manifest": null,
2240 "manifest": null,
2241 "extra": {"branch": "default"},
2241 "extra": {"branch": "default"},
2242 "modified": ["d1/f1"],
2242 "modified": ["d1/f1"],
2243 "added": ["d1/f2"],
2243 "added": ["d1/f2"],
2244 "removed": [".d6/f1"]
2244 "removed": [".d6/f1"]
2245 }
2245 }
2246 ]
2246 ]
2247
2247
2248 $ hg revert -aqC
2248 $ hg revert -aqC
2249
2249
2250 Check that adding an arbitrary name shows up in log automatically
2250 Check that adding an arbitrary name shows up in log automatically
2251
2251
2252 $ cat > ../names.py <<EOF
2252 $ cat > ../names.py <<EOF
2253 > """A small extension to test adding arbitrary names to a repo"""
2253 > """A small extension to test adding arbitrary names to a repo"""
2254 > from __future__ import absolute_import
2254 > from __future__ import absolute_import
2255 > from mercurial import namespaces
2255 > from mercurial import namespaces
2256 >
2256 >
2257 > def reposetup(ui, repo):
2257 > def reposetup(ui, repo):
2258 > foo = {'foo': repo[0].node()}
2258 > foo = {'foo': repo[0].node()}
2259 > names = lambda r: foo.keys()
2259 > names = lambda r: foo.keys()
2260 > namemap = lambda r, name: foo.get(name)
2260 > namemap = lambda r, name: foo.get(name)
2261 > nodemap = lambda r, node: [name for name, n in foo.iteritems()
2261 > nodemap = lambda r, node: [name for name, n in foo.items()
2262 > if n == node]
2262 > if n == node]
2263 > ns = namespaces.namespace(
2263 > ns = namespaces.namespace(
2264 > "bars", templatename="bar", logname="barlog",
2264 > "bars", templatename="bar", logname="barlog",
2265 > colorname="barcolor", listnames=names, namemap=namemap,
2265 > colorname="barcolor", listnames=names, namemap=namemap,
2266 > nodemap=nodemap)
2266 > nodemap=nodemap)
2267 >
2267 >
2268 > repo.names.addnamespace(ns)
2268 > repo.names.addnamespace(ns)
2269 > EOF
2269 > EOF
2270
2270
2271 $ hg --config extensions.names=../names.py log -r 0
2271 $ hg --config extensions.names=../names.py log -r 0
2272 changeset: 0:65624cd9070a
2272 changeset: 0:65624cd9070a
2273 tag: tip
2273 tag: tip
2274 barlog: foo
2274 barlog: foo
2275 user: test
2275 user: test
2276 date: Thu Jan 01 00:00:00 1970 +0000
2276 date: Thu Jan 01 00:00:00 1970 +0000
2277 summary: a bunch of weird directories
2277 summary: a bunch of weird directories
2278
2278
2279 $ hg --config extensions.names=../names.py \
2279 $ hg --config extensions.names=../names.py \
2280 > --config extensions.color= --config color.log.barcolor=red \
2280 > --config extensions.color= --config color.log.barcolor=red \
2281 > --color=always log -r 0
2281 > --color=always log -r 0
2282 \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc)
2282 \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc)
2283 tag: tip
2283 tag: tip
2284 \x1b[0;31mbarlog: foo\x1b[0m (esc)
2284 \x1b[0;31mbarlog: foo\x1b[0m (esc)
2285 user: test
2285 user: test
2286 date: Thu Jan 01 00:00:00 1970 +0000
2286 date: Thu Jan 01 00:00:00 1970 +0000
2287 summary: a bunch of weird directories
2287 summary: a bunch of weird directories
2288
2288
2289 $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n'
2289 $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n'
2290 foo
2290 foo
2291
2291
2292 $ cd ..
2292 $ cd ..
2293
2293
2294 hg log -f dir across branches
2294 hg log -f dir across branches
2295
2295
2296 $ hg init acrossbranches
2296 $ hg init acrossbranches
2297 $ cd acrossbranches
2297 $ cd acrossbranches
2298 $ mkdir d
2298 $ mkdir d
2299 $ echo a > d/a && hg ci -Aqm a
2299 $ echo a > d/a && hg ci -Aqm a
2300 $ echo b > d/a && hg ci -Aqm b
2300 $ echo b > d/a && hg ci -Aqm b
2301 $ hg up -q 0
2301 $ hg up -q 0
2302 $ echo b > d/a && hg ci -Aqm c
2302 $ echo b > d/a && hg ci -Aqm c
2303 $ hg log -f d -T '{desc}' -G
2303 $ hg log -f d -T '{desc}' -G
2304 @ c
2304 @ c
2305 |
2305 |
2306 o a
2306 o a
2307
2307
2308 Ensure that largefiles doesn't interfere with following a normal file
2308 Ensure that largefiles doesn't interfere with following a normal file
2309 $ hg --config extensions.largefiles= log -f d -T '{desc}' -G
2309 $ hg --config extensions.largefiles= log -f d -T '{desc}' -G
2310 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
2310 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
2311 @ c
2311 @ c
2312 |
2312 |
2313 o a
2313 o a
2314
2314
2315 $ hg log -f d/a -T '{desc}' -G
2315 $ hg log -f d/a -T '{desc}' -G
2316 @ c
2316 @ c
2317 |
2317 |
2318 o a
2318 o a
2319
2319
2320 $ cd ..
2320 $ cd ..
2321
2321
2322 hg log -f with linkrev pointing to another branch
2322 hg log -f with linkrev pointing to another branch
2323 -------------------------------------------------
2323 -------------------------------------------------
2324
2324
2325 create history with a filerev whose linkrev points to another branch
2325 create history with a filerev whose linkrev points to another branch
2326
2326
2327 $ hg init branchedlinkrev
2327 $ hg init branchedlinkrev
2328 $ cd branchedlinkrev
2328 $ cd branchedlinkrev
2329 $ echo 1 > a
2329 $ echo 1 > a
2330 $ hg commit -Am 'content1'
2330 $ hg commit -Am 'content1'
2331 adding a
2331 adding a
2332 $ echo 2 > a
2332 $ echo 2 > a
2333 $ hg commit -m 'content2'
2333 $ hg commit -m 'content2'
2334 $ hg up --rev 'desc(content1)'
2334 $ hg up --rev 'desc(content1)'
2335 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2335 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2336 $ echo unrelated > unrelated
2336 $ echo unrelated > unrelated
2337 $ hg commit -Am 'unrelated'
2337 $ hg commit -Am 'unrelated'
2338 adding unrelated
2338 adding unrelated
2339 created new head
2339 created new head
2340 $ hg graft -r 'desc(content2)'
2340 $ hg graft -r 'desc(content2)'
2341 grafting 1:2294ae80ad84 "content2"
2341 grafting 1:2294ae80ad84 "content2"
2342 $ echo 3 > a
2342 $ echo 3 > a
2343 $ hg commit -m 'content3'
2343 $ hg commit -m 'content3'
2344 $ hg log -G
2344 $ hg log -G
2345 @ changeset: 4:50b9b36e9c5d
2345 @ changeset: 4:50b9b36e9c5d
2346 | tag: tip
2346 | tag: tip
2347 | user: test
2347 | user: test
2348 | date: Thu Jan 01 00:00:00 1970 +0000
2348 | date: Thu Jan 01 00:00:00 1970 +0000
2349 | summary: content3
2349 | summary: content3
2350 |
2350 |
2351 o changeset: 3:15b2327059e5
2351 o changeset: 3:15b2327059e5
2352 | user: test
2352 | user: test
2353 | date: Thu Jan 01 00:00:00 1970 +0000
2353 | date: Thu Jan 01 00:00:00 1970 +0000
2354 | summary: content2
2354 | summary: content2
2355 |
2355 |
2356 o changeset: 2:2029acd1168c
2356 o changeset: 2:2029acd1168c
2357 | parent: 0:ae0a3c9f9e95
2357 | parent: 0:ae0a3c9f9e95
2358 | user: test
2358 | user: test
2359 | date: Thu Jan 01 00:00:00 1970 +0000
2359 | date: Thu Jan 01 00:00:00 1970 +0000
2360 | summary: unrelated
2360 | summary: unrelated
2361 |
2361 |
2362 | o changeset: 1:2294ae80ad84
2362 | o changeset: 1:2294ae80ad84
2363 |/ user: test
2363 |/ user: test
2364 | date: Thu Jan 01 00:00:00 1970 +0000
2364 | date: Thu Jan 01 00:00:00 1970 +0000
2365 | summary: content2
2365 | summary: content2
2366 |
2366 |
2367 o changeset: 0:ae0a3c9f9e95
2367 o changeset: 0:ae0a3c9f9e95
2368 user: test
2368 user: test
2369 date: Thu Jan 01 00:00:00 1970 +0000
2369 date: Thu Jan 01 00:00:00 1970 +0000
2370 summary: content1
2370 summary: content1
2371
2371
2372
2372
2373 log -f on the file should list the graft result.
2373 log -f on the file should list the graft result.
2374
2374
2375 $ hg log -Gf a
2375 $ hg log -Gf a
2376 @ changeset: 4:50b9b36e9c5d
2376 @ changeset: 4:50b9b36e9c5d
2377 | tag: tip
2377 | tag: tip
2378 | user: test
2378 | user: test
2379 | date: Thu Jan 01 00:00:00 1970 +0000
2379 | date: Thu Jan 01 00:00:00 1970 +0000
2380 | summary: content3
2380 | summary: content3
2381 |
2381 |
2382 o changeset: 3:15b2327059e5
2382 o changeset: 3:15b2327059e5
2383 : user: test
2383 : user: test
2384 : date: Thu Jan 01 00:00:00 1970 +0000
2384 : date: Thu Jan 01 00:00:00 1970 +0000
2385 : summary: content2
2385 : summary: content2
2386 :
2386 :
2387 o changeset: 0:ae0a3c9f9e95
2387 o changeset: 0:ae0a3c9f9e95
2388 user: test
2388 user: test
2389 date: Thu Jan 01 00:00:00 1970 +0000
2389 date: Thu Jan 01 00:00:00 1970 +0000
2390 summary: content1
2390 summary: content1
2391
2391
2392
2392
2393 plain log lists the original version
2393 plain log lists the original version
2394 (XXX we should probably list both)
2394 (XXX we should probably list both)
2395
2395
2396 $ hg log -G a
2396 $ hg log -G a
2397 @ changeset: 4:50b9b36e9c5d
2397 @ changeset: 4:50b9b36e9c5d
2398 : tag: tip
2398 : tag: tip
2399 : user: test
2399 : user: test
2400 : date: Thu Jan 01 00:00:00 1970 +0000
2400 : date: Thu Jan 01 00:00:00 1970 +0000
2401 : summary: content3
2401 : summary: content3
2402 :
2402 :
2403 : o changeset: 1:2294ae80ad84
2403 : o changeset: 1:2294ae80ad84
2404 :/ user: test
2404 :/ user: test
2405 : date: Thu Jan 01 00:00:00 1970 +0000
2405 : date: Thu Jan 01 00:00:00 1970 +0000
2406 : summary: content2
2406 : summary: content2
2407 :
2407 :
2408 o changeset: 0:ae0a3c9f9e95
2408 o changeset: 0:ae0a3c9f9e95
2409 user: test
2409 user: test
2410 date: Thu Jan 01 00:00:00 1970 +0000
2410 date: Thu Jan 01 00:00:00 1970 +0000
2411 summary: content1
2411 summary: content1
2412
2412
2413
2413
2414 hg log -f from the grafted changeset
2414 hg log -f from the grafted changeset
2415 (The bootstrap should properly take the topology in account)
2415 (The bootstrap should properly take the topology in account)
2416
2416
2417 $ hg up 'desc(content3)^'
2417 $ hg up 'desc(content3)^'
2418 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2418 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2419 $ hg log -Gf a
2419 $ hg log -Gf a
2420 @ changeset: 3:15b2327059e5
2420 @ changeset: 3:15b2327059e5
2421 : user: test
2421 : user: test
2422 : date: Thu Jan 01 00:00:00 1970 +0000
2422 : date: Thu Jan 01 00:00:00 1970 +0000
2423 : summary: content2
2423 : summary: content2
2424 :
2424 :
2425 o changeset: 0:ae0a3c9f9e95
2425 o changeset: 0:ae0a3c9f9e95
2426 user: test
2426 user: test
2427 date: Thu Jan 01 00:00:00 1970 +0000
2427 date: Thu Jan 01 00:00:00 1970 +0000
2428 summary: content1
2428 summary: content1
2429
2429
2430
2430
2431 Test that we use the first non-hidden changeset in that case.
2431 Test that we use the first non-hidden changeset in that case.
2432
2432
2433 (hide the changeset)
2433 (hide the changeset)
2434
2434
2435 $ hg log -T '{node}\n' -r 1
2435 $ hg log -T '{node}\n' -r 1
2436 2294ae80ad8447bc78383182eeac50cb049df623
2436 2294ae80ad8447bc78383182eeac50cb049df623
2437 $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623
2437 $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623
2438 obsoleted 1 changesets
2438 obsoleted 1 changesets
2439 $ hg log -G
2439 $ hg log -G
2440 o changeset: 4:50b9b36e9c5d
2440 o changeset: 4:50b9b36e9c5d
2441 | tag: tip
2441 | tag: tip
2442 | user: test
2442 | user: test
2443 | date: Thu Jan 01 00:00:00 1970 +0000
2443 | date: Thu Jan 01 00:00:00 1970 +0000
2444 | summary: content3
2444 | summary: content3
2445 |
2445 |
2446 @ changeset: 3:15b2327059e5
2446 @ changeset: 3:15b2327059e5
2447 | user: test
2447 | user: test
2448 | date: Thu Jan 01 00:00:00 1970 +0000
2448 | date: Thu Jan 01 00:00:00 1970 +0000
2449 | summary: content2
2449 | summary: content2
2450 |
2450 |
2451 o changeset: 2:2029acd1168c
2451 o changeset: 2:2029acd1168c
2452 | parent: 0:ae0a3c9f9e95
2452 | parent: 0:ae0a3c9f9e95
2453 | user: test
2453 | user: test
2454 | date: Thu Jan 01 00:00:00 1970 +0000
2454 | date: Thu Jan 01 00:00:00 1970 +0000
2455 | summary: unrelated
2455 | summary: unrelated
2456 |
2456 |
2457 o changeset: 0:ae0a3c9f9e95
2457 o changeset: 0:ae0a3c9f9e95
2458 user: test
2458 user: test
2459 date: Thu Jan 01 00:00:00 1970 +0000
2459 date: Thu Jan 01 00:00:00 1970 +0000
2460 summary: content1
2460 summary: content1
2461
2461
2462
2462
2463 Check that log on the file does not drop the file revision.
2463 Check that log on the file does not drop the file revision.
2464
2464
2465 $ hg log -G a
2465 $ hg log -G a
2466 o changeset: 4:50b9b36e9c5d
2466 o changeset: 4:50b9b36e9c5d
2467 | tag: tip
2467 | tag: tip
2468 | user: test
2468 | user: test
2469 | date: Thu Jan 01 00:00:00 1970 +0000
2469 | date: Thu Jan 01 00:00:00 1970 +0000
2470 | summary: content3
2470 | summary: content3
2471 |
2471 |
2472 @ changeset: 3:15b2327059e5
2472 @ changeset: 3:15b2327059e5
2473 : user: test
2473 : user: test
2474 : date: Thu Jan 01 00:00:00 1970 +0000
2474 : date: Thu Jan 01 00:00:00 1970 +0000
2475 : summary: content2
2475 : summary: content2
2476 :
2476 :
2477 o changeset: 0:ae0a3c9f9e95
2477 o changeset: 0:ae0a3c9f9e95
2478 user: test
2478 user: test
2479 date: Thu Jan 01 00:00:00 1970 +0000
2479 date: Thu Jan 01 00:00:00 1970 +0000
2480 summary: content1
2480 summary: content1
2481
2481
2482
2482
2483 Even when a head revision is linkrev-shadowed.
2483 Even when a head revision is linkrev-shadowed.
2484
2484
2485 $ hg log -T '{node}\n' -r 4
2485 $ hg log -T '{node}\n' -r 4
2486 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2486 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2487 $ hg debugobsolete 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2487 $ hg debugobsolete 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2
2488 obsoleted 1 changesets
2488 obsoleted 1 changesets
2489 $ hg log -G a
2489 $ hg log -G a
2490 @ changeset: 3:15b2327059e5
2490 @ changeset: 3:15b2327059e5
2491 : tag: tip
2491 : tag: tip
2492 : user: test
2492 : user: test
2493 : date: Thu Jan 01 00:00:00 1970 +0000
2493 : date: Thu Jan 01 00:00:00 1970 +0000
2494 : summary: content2
2494 : summary: content2
2495 :
2495 :
2496 o changeset: 0:ae0a3c9f9e95
2496 o changeset: 0:ae0a3c9f9e95
2497 user: test
2497 user: test
2498 date: Thu Jan 01 00:00:00 1970 +0000
2498 date: Thu Jan 01 00:00:00 1970 +0000
2499 summary: content1
2499 summary: content1
2500
2500
2501
2501
2502 $ cd ..
2502 $ cd ..
2503
2503
2504 Even when the file revision is missing from some head:
2504 Even when the file revision is missing from some head:
2505
2505
2506 $ hg init issue4490
2506 $ hg init issue4490
2507 $ cd issue4490
2507 $ cd issue4490
2508 $ echo '[experimental]' >> .hg/hgrc
2508 $ echo '[experimental]' >> .hg/hgrc
2509 $ echo 'evolution.createmarkers=True' >> .hg/hgrc
2509 $ echo 'evolution.createmarkers=True' >> .hg/hgrc
2510 $ echo a > a
2510 $ echo a > a
2511 $ hg ci -Am0
2511 $ hg ci -Am0
2512 adding a
2512 adding a
2513 $ echo b > b
2513 $ echo b > b
2514 $ hg ci -Am1
2514 $ hg ci -Am1
2515 adding b
2515 adding b
2516 $ echo B > b
2516 $ echo B > b
2517 $ hg ci --amend -m 1
2517 $ hg ci --amend -m 1
2518 $ hg up 0
2518 $ hg up 0
2519 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2519 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2520 $ echo c > c
2520 $ echo c > c
2521 $ hg ci -Am2
2521 $ hg ci -Am2
2522 adding c
2522 adding c
2523 created new head
2523 created new head
2524 $ hg up 'head() and not .'
2524 $ hg up 'head() and not .'
2525 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
2525 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
2526 $ hg log -G
2526 $ hg log -G
2527 o changeset: 3:db815d6d32e6
2527 o changeset: 3:db815d6d32e6
2528 | tag: tip
2528 | tag: tip
2529 | parent: 0:f7b1eb17ad24
2529 | parent: 0:f7b1eb17ad24
2530 | user: test
2530 | user: test
2531 | date: Thu Jan 01 00:00:00 1970 +0000
2531 | date: Thu Jan 01 00:00:00 1970 +0000
2532 | summary: 2
2532 | summary: 2
2533 |
2533 |
2534 | @ changeset: 2:9bc8ce7f9356
2534 | @ changeset: 2:9bc8ce7f9356
2535 |/ parent: 0:f7b1eb17ad24
2535 |/ parent: 0:f7b1eb17ad24
2536 | user: test
2536 | user: test
2537 | date: Thu Jan 01 00:00:00 1970 +0000
2537 | date: Thu Jan 01 00:00:00 1970 +0000
2538 | summary: 1
2538 | summary: 1
2539 |
2539 |
2540 o changeset: 0:f7b1eb17ad24
2540 o changeset: 0:f7b1eb17ad24
2541 user: test
2541 user: test
2542 date: Thu Jan 01 00:00:00 1970 +0000
2542 date: Thu Jan 01 00:00:00 1970 +0000
2543 summary: 0
2543 summary: 0
2544
2544
2545 $ hg log -f -G b
2545 $ hg log -f -G b
2546 @ changeset: 2:9bc8ce7f9356
2546 @ changeset: 2:9bc8ce7f9356
2547 | parent: 0:f7b1eb17ad24
2547 | parent: 0:f7b1eb17ad24
2548 ~ user: test
2548 ~ user: test
2549 date: Thu Jan 01 00:00:00 1970 +0000
2549 date: Thu Jan 01 00:00:00 1970 +0000
2550 summary: 1
2550 summary: 1
2551
2551
2552 $ hg log -G b
2552 $ hg log -G b
2553 @ changeset: 2:9bc8ce7f9356
2553 @ changeset: 2:9bc8ce7f9356
2554 | parent: 0:f7b1eb17ad24
2554 | parent: 0:f7b1eb17ad24
2555 ~ user: test
2555 ~ user: test
2556 date: Thu Jan 01 00:00:00 1970 +0000
2556 date: Thu Jan 01 00:00:00 1970 +0000
2557 summary: 1
2557 summary: 1
2558
2558
2559 $ cd ..
2559 $ cd ..
2560
2560
2561 Check proper report when the manifest changes but not the file issue4499
2561 Check proper report when the manifest changes but not the file issue4499
2562 ------------------------------------------------------------------------
2562 ------------------------------------------------------------------------
2563
2563
2564 $ hg init issue4499
2564 $ hg init issue4499
2565 $ cd issue4499
2565 $ cd issue4499
2566 $ for f in A B C D F E G H I J K L M N O P Q R S T U; do
2566 $ for f in A B C D F E G H I J K L M N O P Q R S T U; do
2567 > echo 1 > $f;
2567 > echo 1 > $f;
2568 > hg add $f;
2568 > hg add $f;
2569 > done
2569 > done
2570 $ hg commit -m 'A1B1C1'
2570 $ hg commit -m 'A1B1C1'
2571 $ echo 2 > A
2571 $ echo 2 > A
2572 $ echo 2 > B
2572 $ echo 2 > B
2573 $ echo 2 > C
2573 $ echo 2 > C
2574 $ hg commit -m 'A2B2C2'
2574 $ hg commit -m 'A2B2C2'
2575 $ hg up 0
2575 $ hg up 0
2576 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
2576 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
2577 $ echo 3 > A
2577 $ echo 3 > A
2578 $ echo 2 > B
2578 $ echo 2 > B
2579 $ echo 2 > C
2579 $ echo 2 > C
2580 $ hg commit -m 'A3B2C2'
2580 $ hg commit -m 'A3B2C2'
2581 created new head
2581 created new head
2582
2582
2583 $ hg log -G
2583 $ hg log -G
2584 @ changeset: 2:fe5fc3d0eb17
2584 @ changeset: 2:fe5fc3d0eb17
2585 | tag: tip
2585 | tag: tip
2586 | parent: 0:abf4f0e38563
2586 | parent: 0:abf4f0e38563
2587 | user: test
2587 | user: test
2588 | date: Thu Jan 01 00:00:00 1970 +0000
2588 | date: Thu Jan 01 00:00:00 1970 +0000
2589 | summary: A3B2C2
2589 | summary: A3B2C2
2590 |
2590 |
2591 | o changeset: 1:07dcc6b312c0
2591 | o changeset: 1:07dcc6b312c0
2592 |/ user: test
2592 |/ user: test
2593 | date: Thu Jan 01 00:00:00 1970 +0000
2593 | date: Thu Jan 01 00:00:00 1970 +0000
2594 | summary: A2B2C2
2594 | summary: A2B2C2
2595 |
2595 |
2596 o changeset: 0:abf4f0e38563
2596 o changeset: 0:abf4f0e38563
2597 user: test
2597 user: test
2598 date: Thu Jan 01 00:00:00 1970 +0000
2598 date: Thu Jan 01 00:00:00 1970 +0000
2599 summary: A1B1C1
2599 summary: A1B1C1
2600
2600
2601
2601
2602 Log -f on B should reports current changesets
2602 Log -f on B should reports current changesets
2603
2603
2604 $ hg log -fG B
2604 $ hg log -fG B
2605 @ changeset: 2:fe5fc3d0eb17
2605 @ changeset: 2:fe5fc3d0eb17
2606 | tag: tip
2606 | tag: tip
2607 | parent: 0:abf4f0e38563
2607 | parent: 0:abf4f0e38563
2608 | user: test
2608 | user: test
2609 | date: Thu Jan 01 00:00:00 1970 +0000
2609 | date: Thu Jan 01 00:00:00 1970 +0000
2610 | summary: A3B2C2
2610 | summary: A3B2C2
2611 |
2611 |
2612 o changeset: 0:abf4f0e38563
2612 o changeset: 0:abf4f0e38563
2613 user: test
2613 user: test
2614 date: Thu Jan 01 00:00:00 1970 +0000
2614 date: Thu Jan 01 00:00:00 1970 +0000
2615 summary: A1B1C1
2615 summary: A1B1C1
2616
2616
2617 $ cd ..
2617 $ cd ..
@@ -1,489 +1,489 b''
1 from __future__ import absolute_import
1 from __future__ import absolute_import
2
2
3 import binascii
3 import binascii
4 import itertools
4 import itertools
5 import silenttestrunner
5 import silenttestrunner
6 import unittest
6 import unittest
7
7
8 from mercurial import (
8 from mercurial import (
9 manifest as manifestmod,
9 manifest as manifestmod,
10 match as matchmod,
10 match as matchmod,
11 )
11 )
12
12
13 EMTPY_MANIFEST = b''
13 EMTPY_MANIFEST = b''
14 EMTPY_MANIFEST_V2 = b'\0\n'
14 EMTPY_MANIFEST_V2 = b'\0\n'
15
15
16 HASH_1 = b'1' * 40
16 HASH_1 = b'1' * 40
17 BIN_HASH_1 = binascii.unhexlify(HASH_1)
17 BIN_HASH_1 = binascii.unhexlify(HASH_1)
18 HASH_2 = b'f' * 40
18 HASH_2 = b'f' * 40
19 BIN_HASH_2 = binascii.unhexlify(HASH_2)
19 BIN_HASH_2 = binascii.unhexlify(HASH_2)
20 HASH_3 = b'1234567890abcdef0987654321deadbeef0fcafe'
20 HASH_3 = b'1234567890abcdef0987654321deadbeef0fcafe'
21 BIN_HASH_3 = binascii.unhexlify(HASH_3)
21 BIN_HASH_3 = binascii.unhexlify(HASH_3)
22 A_SHORT_MANIFEST = (
22 A_SHORT_MANIFEST = (
23 b'bar/baz/qux.py\0%(hash2)s%(flag2)s\n'
23 b'bar/baz/qux.py\0%(hash2)s%(flag2)s\n'
24 b'foo\0%(hash1)s%(flag1)s\n'
24 b'foo\0%(hash1)s%(flag1)s\n'
25 ) % {b'hash1': HASH_1,
25 ) % {b'hash1': HASH_1,
26 b'flag1': b'',
26 b'flag1': b'',
27 b'hash2': HASH_2,
27 b'hash2': HASH_2,
28 b'flag2': b'l',
28 b'flag2': b'l',
29 }
29 }
30
30
31 # Same data as A_SHORT_MANIFEST
31 # Same data as A_SHORT_MANIFEST
32 A_SHORT_MANIFEST_V2 = (
32 A_SHORT_MANIFEST_V2 = (
33 b'\0\n'
33 b'\0\n'
34 b'\x00bar/baz/qux.py\0%(flag2)s\n%(hash2)s\n'
34 b'\x00bar/baz/qux.py\0%(flag2)s\n%(hash2)s\n'
35 b'\x00foo\0%(flag1)s\n%(hash1)s\n'
35 b'\x00foo\0%(flag1)s\n%(hash1)s\n'
36 ) % {b'hash1': BIN_HASH_1,
36 ) % {b'hash1': BIN_HASH_1,
37 b'flag1': b'',
37 b'flag1': b'',
38 b'hash2': BIN_HASH_2,
38 b'hash2': BIN_HASH_2,
39 b'flag2': b'l',
39 b'flag2': b'l',
40 }
40 }
41
41
42 # Same data as A_SHORT_MANIFEST
42 # Same data as A_SHORT_MANIFEST
43 A_METADATA_MANIFEST = (
43 A_METADATA_MANIFEST = (
44 b'\0foo\0bar\n'
44 b'\0foo\0bar\n'
45 b'\x00bar/baz/qux.py\0%(flag2)s\0foo\0bar\n%(hash2)s\n' # flag and metadata
45 b'\x00bar/baz/qux.py\0%(flag2)s\0foo\0bar\n%(hash2)s\n' # flag and metadata
46 b'\x00foo\0%(flag1)s\0foo\n%(hash1)s\n' # no flag, but metadata
46 b'\x00foo\0%(flag1)s\0foo\n%(hash1)s\n' # no flag, but metadata
47 ) % {b'hash1': BIN_HASH_1,
47 ) % {b'hash1': BIN_HASH_1,
48 b'flag1': b'',
48 b'flag1': b'',
49 b'hash2': BIN_HASH_2,
49 b'hash2': BIN_HASH_2,
50 b'flag2': b'l',
50 b'flag2': b'l',
51 }
51 }
52
52
53 A_STEM_COMPRESSED_MANIFEST = (
53 A_STEM_COMPRESSED_MANIFEST = (
54 b'\0\n'
54 b'\0\n'
55 b'\x00bar/baz/qux.py\0%(flag2)s\n%(hash2)s\n'
55 b'\x00bar/baz/qux.py\0%(flag2)s\n%(hash2)s\n'
56 b'\x04qux/foo.py\0%(flag1)s\n%(hash1)s\n' # simple case of 4 stem chars
56 b'\x04qux/foo.py\0%(flag1)s\n%(hash1)s\n' # simple case of 4 stem chars
57 b'\x0az.py\0%(flag1)s\n%(hash1)s\n' # tricky newline = 10 stem characters
57 b'\x0az.py\0%(flag1)s\n%(hash1)s\n' # tricky newline = 10 stem characters
58 b'\x00%(verylongdir)sx/x\0\n%(hash1)s\n'
58 b'\x00%(verylongdir)sx/x\0\n%(hash1)s\n'
59 b'\xffx/y\0\n%(hash2)s\n' # more than 255 stem chars
59 b'\xffx/y\0\n%(hash2)s\n' # more than 255 stem chars
60 ) % {b'hash1': BIN_HASH_1,
60 ) % {b'hash1': BIN_HASH_1,
61 b'flag1': b'',
61 b'flag1': b'',
62 b'hash2': BIN_HASH_2,
62 b'hash2': BIN_HASH_2,
63 b'flag2': b'l',
63 b'flag2': b'l',
64 b'verylongdir': 255 * b'x',
64 b'verylongdir': 255 * b'x',
65 }
65 }
66
66
67 A_DEEPER_MANIFEST = (
67 A_DEEPER_MANIFEST = (
68 b'a/b/c/bar.py\0%(hash3)s%(flag1)s\n'
68 b'a/b/c/bar.py\0%(hash3)s%(flag1)s\n'
69 b'a/b/c/bar.txt\0%(hash1)s%(flag1)s\n'
69 b'a/b/c/bar.txt\0%(hash1)s%(flag1)s\n'
70 b'a/b/c/foo.py\0%(hash3)s%(flag1)s\n'
70 b'a/b/c/foo.py\0%(hash3)s%(flag1)s\n'
71 b'a/b/c/foo.txt\0%(hash2)s%(flag2)s\n'
71 b'a/b/c/foo.txt\0%(hash2)s%(flag2)s\n'
72 b'a/b/d/baz.py\0%(hash3)s%(flag1)s\n'
72 b'a/b/d/baz.py\0%(hash3)s%(flag1)s\n'
73 b'a/b/d/qux.py\0%(hash1)s%(flag2)s\n'
73 b'a/b/d/qux.py\0%(hash1)s%(flag2)s\n'
74 b'a/b/d/ten.txt\0%(hash3)s%(flag2)s\n'
74 b'a/b/d/ten.txt\0%(hash3)s%(flag2)s\n'
75 b'a/b/dog.py\0%(hash3)s%(flag1)s\n'
75 b'a/b/dog.py\0%(hash3)s%(flag1)s\n'
76 b'a/b/fish.py\0%(hash2)s%(flag1)s\n'
76 b'a/b/fish.py\0%(hash2)s%(flag1)s\n'
77 b'a/c/london.py\0%(hash3)s%(flag2)s\n'
77 b'a/c/london.py\0%(hash3)s%(flag2)s\n'
78 b'a/c/paper.txt\0%(hash2)s%(flag2)s\n'
78 b'a/c/paper.txt\0%(hash2)s%(flag2)s\n'
79 b'a/c/paris.py\0%(hash2)s%(flag1)s\n'
79 b'a/c/paris.py\0%(hash2)s%(flag1)s\n'
80 b'a/d/apple.py\0%(hash3)s%(flag1)s\n'
80 b'a/d/apple.py\0%(hash3)s%(flag1)s\n'
81 b'a/d/pizza.py\0%(hash3)s%(flag2)s\n'
81 b'a/d/pizza.py\0%(hash3)s%(flag2)s\n'
82 b'a/green.py\0%(hash1)s%(flag2)s\n'
82 b'a/green.py\0%(hash1)s%(flag2)s\n'
83 b'a/purple.py\0%(hash2)s%(flag1)s\n'
83 b'a/purple.py\0%(hash2)s%(flag1)s\n'
84 b'app.py\0%(hash3)s%(flag1)s\n'
84 b'app.py\0%(hash3)s%(flag1)s\n'
85 b'readme.txt\0%(hash2)s%(flag1)s\n'
85 b'readme.txt\0%(hash2)s%(flag1)s\n'
86 ) % {b'hash1': HASH_1,
86 ) % {b'hash1': HASH_1,
87 b'flag1': b'',
87 b'flag1': b'',
88 b'hash2': HASH_2,
88 b'hash2': HASH_2,
89 b'flag2': b'l',
89 b'flag2': b'l',
90 b'hash3': HASH_3,
90 b'hash3': HASH_3,
91 }
91 }
92
92
93 HUGE_MANIFEST_ENTRIES = 200001
93 HUGE_MANIFEST_ENTRIES = 200001
94
94
95 izip = getattr(itertools, 'izip', zip)
95 izip = getattr(itertools, 'izip', zip)
96 if 'xrange' not in globals():
96 if 'xrange' not in globals():
97 xrange = range
97 xrange = range
98
98
99 A_HUGE_MANIFEST = b''.join(sorted(
99 A_HUGE_MANIFEST = b''.join(sorted(
100 b'file%d\0%s%s\n' % (i, h, f) for i, h, f in
100 b'file%d\0%s%s\n' % (i, h, f) for i, h, f in
101 izip(xrange(200001),
101 izip(xrange(200001),
102 itertools.cycle((HASH_1, HASH_2)),
102 itertools.cycle((HASH_1, HASH_2)),
103 itertools.cycle((b'', b'x', b'l')))))
103 itertools.cycle((b'', b'x', b'l')))))
104
104
105 class basemanifesttests(object):
105 class basemanifesttests(object):
106 def parsemanifest(self, text):
106 def parsemanifest(self, text):
107 raise NotImplementedError('parsemanifest not implemented by test case')
107 raise NotImplementedError('parsemanifest not implemented by test case')
108
108
109 def testEmptyManifest(self):
109 def testEmptyManifest(self):
110 m = self.parsemanifest(EMTPY_MANIFEST)
110 m = self.parsemanifest(EMTPY_MANIFEST)
111 self.assertEqual(0, len(m))
111 self.assertEqual(0, len(m))
112 self.assertEqual([], list(m))
112 self.assertEqual([], list(m))
113
113
114 def testEmptyManifestv2(self):
114 def testEmptyManifestv2(self):
115 m = self.parsemanifest(EMTPY_MANIFEST_V2)
115 m = self.parsemanifest(EMTPY_MANIFEST_V2)
116 self.assertEqual(0, len(m))
116 self.assertEqual(0, len(m))
117 self.assertEqual([], list(m))
117 self.assertEqual([], list(m))
118
118
119 def testManifest(self):
119 def testManifest(self):
120 m = self.parsemanifest(A_SHORT_MANIFEST)
120 m = self.parsemanifest(A_SHORT_MANIFEST)
121 self.assertEqual([b'bar/baz/qux.py', b'foo'], list(m))
121 self.assertEqual([b'bar/baz/qux.py', b'foo'], list(m))
122 self.assertEqual(BIN_HASH_2, m[b'bar/baz/qux.py'])
122 self.assertEqual(BIN_HASH_2, m[b'bar/baz/qux.py'])
123 self.assertEqual(b'l', m.flags(b'bar/baz/qux.py'))
123 self.assertEqual(b'l', m.flags(b'bar/baz/qux.py'))
124 self.assertEqual(BIN_HASH_1, m[b'foo'])
124 self.assertEqual(BIN_HASH_1, m[b'foo'])
125 self.assertEqual(b'', m.flags(b'foo'))
125 self.assertEqual(b'', m.flags(b'foo'))
126 with self.assertRaises(KeyError):
126 with self.assertRaises(KeyError):
127 m[b'wat']
127 m[b'wat']
128
128
129 def testParseManifestV2(self):
129 def testParseManifestV2(self):
130 m1 = self.parsemanifest(A_SHORT_MANIFEST)
130 m1 = self.parsemanifest(A_SHORT_MANIFEST)
131 m2 = self.parsemanifest(A_SHORT_MANIFEST_V2)
131 m2 = self.parsemanifest(A_SHORT_MANIFEST_V2)
132 # Should have same content as A_SHORT_MANIFEST
132 # Should have same content as A_SHORT_MANIFEST
133 self.assertEqual(m1.text(), m2.text())
133 self.assertEqual(m1.text(), m2.text())
134
134
135 def testParseManifestMetadata(self):
135 def testParseManifestMetadata(self):
136 # Metadata is for future-proofing and should be accepted but ignored
136 # Metadata is for future-proofing and should be accepted but ignored
137 m = self.parsemanifest(A_METADATA_MANIFEST)
137 m = self.parsemanifest(A_METADATA_MANIFEST)
138 self.assertEqual(A_SHORT_MANIFEST, m.text())
138 self.assertEqual(A_SHORT_MANIFEST, m.text())
139
139
140 def testParseManifestStemCompression(self):
140 def testParseManifestStemCompression(self):
141 m = self.parsemanifest(A_STEM_COMPRESSED_MANIFEST)
141 m = self.parsemanifest(A_STEM_COMPRESSED_MANIFEST)
142 self.assertIn(b'bar/baz/qux.py', m)
142 self.assertIn(b'bar/baz/qux.py', m)
143 self.assertIn(b'bar/qux/foo.py', m)
143 self.assertIn(b'bar/qux/foo.py', m)
144 self.assertIn(b'bar/qux/foz.py', m)
144 self.assertIn(b'bar/qux/foz.py', m)
145 self.assertIn(256 * b'x' + b'/x', m)
145 self.assertIn(256 * b'x' + b'/x', m)
146 self.assertIn(256 * b'x' + b'/y', m)
146 self.assertIn(256 * b'x' + b'/y', m)
147 self.assertEqual(A_STEM_COMPRESSED_MANIFEST, m.text(usemanifestv2=True))
147 self.assertEqual(A_STEM_COMPRESSED_MANIFEST, m.text(usemanifestv2=True))
148
148
149 def testTextV2(self):
149 def testTextV2(self):
150 m1 = self.parsemanifest(A_SHORT_MANIFEST)
150 m1 = self.parsemanifest(A_SHORT_MANIFEST)
151 v2text = m1.text(usemanifestv2=True)
151 v2text = m1.text(usemanifestv2=True)
152 self.assertEqual(A_SHORT_MANIFEST_V2, v2text)
152 self.assertEqual(A_SHORT_MANIFEST_V2, v2text)
153
153
154 def testSetItem(self):
154 def testSetItem(self):
155 want = BIN_HASH_1
155 want = BIN_HASH_1
156
156
157 m = self.parsemanifest(EMTPY_MANIFEST)
157 m = self.parsemanifest(EMTPY_MANIFEST)
158 m[b'a'] = want
158 m[b'a'] = want
159 self.assertIn(b'a', m)
159 self.assertIn(b'a', m)
160 self.assertEqual(want, m[b'a'])
160 self.assertEqual(want, m[b'a'])
161 self.assertEqual(b'a\0' + HASH_1 + b'\n', m.text())
161 self.assertEqual(b'a\0' + HASH_1 + b'\n', m.text())
162
162
163 m = self.parsemanifest(A_SHORT_MANIFEST)
163 m = self.parsemanifest(A_SHORT_MANIFEST)
164 m[b'a'] = want
164 m[b'a'] = want
165 self.assertEqual(want, m[b'a'])
165 self.assertEqual(want, m[b'a'])
166 self.assertEqual(b'a\0' + HASH_1 + b'\n' + A_SHORT_MANIFEST,
166 self.assertEqual(b'a\0' + HASH_1 + b'\n' + A_SHORT_MANIFEST,
167 m.text())
167 m.text())
168
168
169 def testSetFlag(self):
169 def testSetFlag(self):
170 want = b'x'
170 want = b'x'
171
171
172 m = self.parsemanifest(EMTPY_MANIFEST)
172 m = self.parsemanifest(EMTPY_MANIFEST)
173 # first add a file; a file-less flag makes no sense
173 # first add a file; a file-less flag makes no sense
174 m[b'a'] = BIN_HASH_1
174 m[b'a'] = BIN_HASH_1
175 m.setflag(b'a', want)
175 m.setflag(b'a', want)
176 self.assertEqual(want, m.flags(b'a'))
176 self.assertEqual(want, m.flags(b'a'))
177 self.assertEqual(b'a\0' + HASH_1 + want + b'\n', m.text())
177 self.assertEqual(b'a\0' + HASH_1 + want + b'\n', m.text())
178
178
179 m = self.parsemanifest(A_SHORT_MANIFEST)
179 m = self.parsemanifest(A_SHORT_MANIFEST)
180 # first add a file; a file-less flag makes no sense
180 # first add a file; a file-less flag makes no sense
181 m[b'a'] = BIN_HASH_1
181 m[b'a'] = BIN_HASH_1
182 m.setflag(b'a', want)
182 m.setflag(b'a', want)
183 self.assertEqual(want, m.flags(b'a'))
183 self.assertEqual(want, m.flags(b'a'))
184 self.assertEqual(b'a\0' + HASH_1 + want + b'\n' + A_SHORT_MANIFEST,
184 self.assertEqual(b'a\0' + HASH_1 + want + b'\n' + A_SHORT_MANIFEST,
185 m.text())
185 m.text())
186
186
187 def testCopy(self):
187 def testCopy(self):
188 m = self.parsemanifest(A_SHORT_MANIFEST)
188 m = self.parsemanifest(A_SHORT_MANIFEST)
189 m[b'a'] = BIN_HASH_1
189 m[b'a'] = BIN_HASH_1
190 m2 = m.copy()
190 m2 = m.copy()
191 del m
191 del m
192 del m2 # make sure we don't double free() anything
192 del m2 # make sure we don't double free() anything
193
193
194 def testCompaction(self):
194 def testCompaction(self):
195 unhex = binascii.unhexlify
195 unhex = binascii.unhexlify
196 h1, h2 = unhex(HASH_1), unhex(HASH_2)
196 h1, h2 = unhex(HASH_1), unhex(HASH_2)
197 m = self.parsemanifest(A_SHORT_MANIFEST)
197 m = self.parsemanifest(A_SHORT_MANIFEST)
198 m[b'alpha'] = h1
198 m[b'alpha'] = h1
199 m[b'beta'] = h2
199 m[b'beta'] = h2
200 del m[b'foo']
200 del m[b'foo']
201 want = b'alpha\0%s\nbar/baz/qux.py\0%sl\nbeta\0%s\n' % (
201 want = b'alpha\0%s\nbar/baz/qux.py\0%sl\nbeta\0%s\n' % (
202 HASH_1, HASH_2, HASH_2)
202 HASH_1, HASH_2, HASH_2)
203 self.assertEqual(want, m.text())
203 self.assertEqual(want, m.text())
204 self.assertEqual(3, len(m))
204 self.assertEqual(3, len(m))
205 self.assertEqual([b'alpha', b'bar/baz/qux.py', b'beta'], list(m))
205 self.assertEqual([b'alpha', b'bar/baz/qux.py', b'beta'], list(m))
206 self.assertEqual(h1, m[b'alpha'])
206 self.assertEqual(h1, m[b'alpha'])
207 self.assertEqual(h2, m[b'bar/baz/qux.py'])
207 self.assertEqual(h2, m[b'bar/baz/qux.py'])
208 self.assertEqual(h2, m[b'beta'])
208 self.assertEqual(h2, m[b'beta'])
209 self.assertEqual(b'', m.flags(b'alpha'))
209 self.assertEqual(b'', m.flags(b'alpha'))
210 self.assertEqual(b'l', m.flags(b'bar/baz/qux.py'))
210 self.assertEqual(b'l', m.flags(b'bar/baz/qux.py'))
211 self.assertEqual(b'', m.flags(b'beta'))
211 self.assertEqual(b'', m.flags(b'beta'))
212 with self.assertRaises(KeyError):
212 with self.assertRaises(KeyError):
213 m[b'foo']
213 m[b'foo']
214
214
215 def testSetGetNodeSuffix(self):
215 def testSetGetNodeSuffix(self):
216 clean = self.parsemanifest(A_SHORT_MANIFEST)
216 clean = self.parsemanifest(A_SHORT_MANIFEST)
217 m = self.parsemanifest(A_SHORT_MANIFEST)
217 m = self.parsemanifest(A_SHORT_MANIFEST)
218 h = m[b'foo']
218 h = m[b'foo']
219 f = m.flags(b'foo')
219 f = m.flags(b'foo')
220 want = h + b'a'
220 want = h + b'a'
221 # Merge code wants to set 21-byte fake hashes at times
221 # Merge code wants to set 21-byte fake hashes at times
222 m[b'foo'] = want
222 m[b'foo'] = want
223 self.assertEqual(want, m[b'foo'])
223 self.assertEqual(want, m[b'foo'])
224 self.assertEqual([(b'bar/baz/qux.py', BIN_HASH_2),
224 self.assertEqual([(b'bar/baz/qux.py', BIN_HASH_2),
225 (b'foo', BIN_HASH_1 + b'a')],
225 (b'foo', BIN_HASH_1 + b'a')],
226 list(m.iteritems()))
226 list(m.items()))
227 # Sometimes it even tries a 22-byte fake hash, but we can
227 # Sometimes it even tries a 22-byte fake hash, but we can
228 # return 21 and it'll work out
228 # return 21 and it'll work out
229 m[b'foo'] = want + b'+'
229 m[b'foo'] = want + b'+'
230 self.assertEqual(want, m[b'foo'])
230 self.assertEqual(want, m[b'foo'])
231 # make sure the suffix survives a copy
231 # make sure the suffix survives a copy
232 match = matchmod.match(b'', b'', [b're:foo'])
232 match = matchmod.match(b'', b'', [b're:foo'])
233 m2 = m.matches(match)
233 m2 = m.matches(match)
234 self.assertEqual(want, m2[b'foo'])
234 self.assertEqual(want, m2[b'foo'])
235 self.assertEqual(1, len(m2))
235 self.assertEqual(1, len(m2))
236 m2 = m.copy()
236 m2 = m.copy()
237 self.assertEqual(want, m2[b'foo'])
237 self.assertEqual(want, m2[b'foo'])
238 # suffix with iteration
238 # suffix with iteration
239 self.assertEqual([(b'bar/baz/qux.py', BIN_HASH_2),
239 self.assertEqual([(b'bar/baz/qux.py', BIN_HASH_2),
240 (b'foo', want)],
240 (b'foo', want)],
241 list(m.iteritems()))
241 list(m.items()))
242
242
243 # shows up in diff
243 # shows up in diff
244 self.assertEqual({b'foo': ((want, f), (h, b''))}, m.diff(clean))
244 self.assertEqual({b'foo': ((want, f), (h, b''))}, m.diff(clean))
245 self.assertEqual({b'foo': ((h, b''), (want, f))}, clean.diff(m))
245 self.assertEqual({b'foo': ((h, b''), (want, f))}, clean.diff(m))
246
246
247 def testMatchException(self):
247 def testMatchException(self):
248 m = self.parsemanifest(A_SHORT_MANIFEST)
248 m = self.parsemanifest(A_SHORT_MANIFEST)
249 match = matchmod.match(b'', b'', [b're:.*'])
249 match = matchmod.match(b'', b'', [b're:.*'])
250 def filt(path):
250 def filt(path):
251 if path == b'foo':
251 if path == b'foo':
252 assert False
252 assert False
253 return True
253 return True
254 match.matchfn = filt
254 match.matchfn = filt
255 with self.assertRaises(AssertionError):
255 with self.assertRaises(AssertionError):
256 m.matches(match)
256 m.matches(match)
257
257
258 def testRemoveItem(self):
258 def testRemoveItem(self):
259 m = self.parsemanifest(A_SHORT_MANIFEST)
259 m = self.parsemanifest(A_SHORT_MANIFEST)
260 del m[b'foo']
260 del m[b'foo']
261 with self.assertRaises(KeyError):
261 with self.assertRaises(KeyError):
262 m[b'foo']
262 m[b'foo']
263 self.assertEqual(1, len(m))
263 self.assertEqual(1, len(m))
264 self.assertEqual(1, len(list(m)))
264 self.assertEqual(1, len(list(m)))
265 # now restore and make sure everything works right
265 # now restore and make sure everything works right
266 m[b'foo'] = b'a' * 20
266 m[b'foo'] = b'a' * 20
267 self.assertEqual(2, len(m))
267 self.assertEqual(2, len(m))
268 self.assertEqual(2, len(list(m)))
268 self.assertEqual(2, len(list(m)))
269
269
270 def testManifestDiff(self):
270 def testManifestDiff(self):
271 MISSING = (None, b'')
271 MISSING = (None, b'')
272 addl = b'z-only-in-left\0' + HASH_1 + b'\n'
272 addl = b'z-only-in-left\0' + HASH_1 + b'\n'
273 addr = b'z-only-in-right\0' + HASH_2 + b'x\n'
273 addr = b'z-only-in-right\0' + HASH_2 + b'x\n'
274 left = self.parsemanifest(
274 left = self.parsemanifest(
275 A_SHORT_MANIFEST.replace(HASH_1, HASH_3 + b'x') + addl)
275 A_SHORT_MANIFEST.replace(HASH_1, HASH_3 + b'x') + addl)
276 right = self.parsemanifest(A_SHORT_MANIFEST + addr)
276 right = self.parsemanifest(A_SHORT_MANIFEST + addr)
277 want = {
277 want = {
278 b'foo': ((BIN_HASH_3, b'x'),
278 b'foo': ((BIN_HASH_3, b'x'),
279 (BIN_HASH_1, b'')),
279 (BIN_HASH_1, b'')),
280 b'z-only-in-left': ((BIN_HASH_1, b''), MISSING),
280 b'z-only-in-left': ((BIN_HASH_1, b''), MISSING),
281 b'z-only-in-right': (MISSING, (BIN_HASH_2, b'x')),
281 b'z-only-in-right': (MISSING, (BIN_HASH_2, b'x')),
282 }
282 }
283 self.assertEqual(want, left.diff(right))
283 self.assertEqual(want, left.diff(right))
284
284
285 want = {
285 want = {
286 b'bar/baz/qux.py': (MISSING, (BIN_HASH_2, b'l')),
286 b'bar/baz/qux.py': (MISSING, (BIN_HASH_2, b'l')),
287 b'foo': (MISSING, (BIN_HASH_3, b'x')),
287 b'foo': (MISSING, (BIN_HASH_3, b'x')),
288 b'z-only-in-left': (MISSING, (BIN_HASH_1, b'')),
288 b'z-only-in-left': (MISSING, (BIN_HASH_1, b'')),
289 }
289 }
290 self.assertEqual(want, self.parsemanifest(EMTPY_MANIFEST).diff(left))
290 self.assertEqual(want, self.parsemanifest(EMTPY_MANIFEST).diff(left))
291
291
292 want = {
292 want = {
293 b'bar/baz/qux.py': ((BIN_HASH_2, b'l'), MISSING),
293 b'bar/baz/qux.py': ((BIN_HASH_2, b'l'), MISSING),
294 b'foo': ((BIN_HASH_3, b'x'), MISSING),
294 b'foo': ((BIN_HASH_3, b'x'), MISSING),
295 b'z-only-in-left': ((BIN_HASH_1, b''), MISSING),
295 b'z-only-in-left': ((BIN_HASH_1, b''), MISSING),
296 }
296 }
297 self.assertEqual(want, left.diff(self.parsemanifest(EMTPY_MANIFEST)))
297 self.assertEqual(want, left.diff(self.parsemanifest(EMTPY_MANIFEST)))
298 copy = right.copy()
298 copy = right.copy()
299 del copy[b'z-only-in-right']
299 del copy[b'z-only-in-right']
300 del right[b'foo']
300 del right[b'foo']
301 want = {
301 want = {
302 b'foo': (MISSING, (BIN_HASH_1, b'')),
302 b'foo': (MISSING, (BIN_HASH_1, b'')),
303 b'z-only-in-right': ((BIN_HASH_2, b'x'), MISSING),
303 b'z-only-in-right': ((BIN_HASH_2, b'x'), MISSING),
304 }
304 }
305 self.assertEqual(want, right.diff(copy))
305 self.assertEqual(want, right.diff(copy))
306
306
307 short = self.parsemanifest(A_SHORT_MANIFEST)
307 short = self.parsemanifest(A_SHORT_MANIFEST)
308 pruned = short.copy()
308 pruned = short.copy()
309 del pruned[b'foo']
309 del pruned[b'foo']
310 want = {
310 want = {
311 b'foo': ((BIN_HASH_1, b''), MISSING),
311 b'foo': ((BIN_HASH_1, b''), MISSING),
312 }
312 }
313 self.assertEqual(want, short.diff(pruned))
313 self.assertEqual(want, short.diff(pruned))
314 want = {
314 want = {
315 b'foo': (MISSING, (BIN_HASH_1, b'')),
315 b'foo': (MISSING, (BIN_HASH_1, b'')),
316 }
316 }
317 self.assertEqual(want, pruned.diff(short))
317 self.assertEqual(want, pruned.diff(short))
318 want = {
318 want = {
319 b'bar/baz/qux.py': None,
319 b'bar/baz/qux.py': None,
320 b'foo': (MISSING, (BIN_HASH_1, b'')),
320 b'foo': (MISSING, (BIN_HASH_1, b'')),
321 }
321 }
322 self.assertEqual(want, pruned.diff(short, clean=True))
322 self.assertEqual(want, pruned.diff(short, clean=True))
323
323
324 def testReversedLines(self):
324 def testReversedLines(self):
325 backwards = b''.join(
325 backwards = b''.join(
326 l + b'\n' for l in reversed(A_SHORT_MANIFEST.split(b'\n')) if l)
326 l + b'\n' for l in reversed(A_SHORT_MANIFEST.split(b'\n')) if l)
327 try:
327 try:
328 self.parsemanifest(backwards)
328 self.parsemanifest(backwards)
329 self.fail('Should have raised ValueError')
329 self.fail('Should have raised ValueError')
330 except ValueError as v:
330 except ValueError as v:
331 self.assertIn('Manifest lines not in sorted order.', str(v))
331 self.assertIn('Manifest lines not in sorted order.', str(v))
332
332
333 def testNoTerminalNewline(self):
333 def testNoTerminalNewline(self):
334 try:
334 try:
335 self.parsemanifest(A_SHORT_MANIFEST + b'wat')
335 self.parsemanifest(A_SHORT_MANIFEST + b'wat')
336 self.fail('Should have raised ValueError')
336 self.fail('Should have raised ValueError')
337 except ValueError as v:
337 except ValueError as v:
338 self.assertIn('Manifest did not end in a newline.', str(v))
338 self.assertIn('Manifest did not end in a newline.', str(v))
339
339
340 def testNoNewLineAtAll(self):
340 def testNoNewLineAtAll(self):
341 try:
341 try:
342 self.parsemanifest(b'wat')
342 self.parsemanifest(b'wat')
343 self.fail('Should have raised ValueError')
343 self.fail('Should have raised ValueError')
344 except ValueError as v:
344 except ValueError as v:
345 self.assertIn('Manifest did not end in a newline.', str(v))
345 self.assertIn('Manifest did not end in a newline.', str(v))
346
346
347 def testHugeManifest(self):
347 def testHugeManifest(self):
348 m = self.parsemanifest(A_HUGE_MANIFEST)
348 m = self.parsemanifest(A_HUGE_MANIFEST)
349 self.assertEqual(HUGE_MANIFEST_ENTRIES, len(m))
349 self.assertEqual(HUGE_MANIFEST_ENTRIES, len(m))
350 self.assertEqual(len(m), len(list(m)))
350 self.assertEqual(len(m), len(list(m)))
351
351
352 def testMatchesMetadata(self):
352 def testMatchesMetadata(self):
353 '''Tests matches() for a few specific files to make sure that both
353 '''Tests matches() for a few specific files to make sure that both
354 the set of files as well as their flags and nodeids are correct in
354 the set of files as well as their flags and nodeids are correct in
355 the resulting manifest.'''
355 the resulting manifest.'''
356 m = self.parsemanifest(A_HUGE_MANIFEST)
356 m = self.parsemanifest(A_HUGE_MANIFEST)
357
357
358 match = matchmod.match(b'/', b'',
358 match = matchmod.match(b'/', b'',
359 [b'file1', b'file200', b'file300'], exact=True)
359 [b'file1', b'file200', b'file300'], exact=True)
360 m2 = m.matches(match)
360 m2 = m.matches(match)
361
361
362 w = (b'file1\0%sx\n'
362 w = (b'file1\0%sx\n'
363 b'file200\0%sl\n'
363 b'file200\0%sl\n'
364 b'file300\0%s\n') % (HASH_2, HASH_1, HASH_1)
364 b'file300\0%s\n') % (HASH_2, HASH_1, HASH_1)
365 self.assertEqual(w, m2.text())
365 self.assertEqual(w, m2.text())
366
366
367 def testMatchesNonexistentFile(self):
367 def testMatchesNonexistentFile(self):
368 '''Tests matches() for a small set of specific files, including one
368 '''Tests matches() for a small set of specific files, including one
369 nonexistent file to make sure in only matches against existing files.
369 nonexistent file to make sure in only matches against existing files.
370 '''
370 '''
371 m = self.parsemanifest(A_DEEPER_MANIFEST)
371 m = self.parsemanifest(A_DEEPER_MANIFEST)
372
372
373 match = matchmod.match(b'/', b'',
373 match = matchmod.match(b'/', b'',
374 [b'a/b/c/bar.txt', b'a/b/d/qux.py',
374 [b'a/b/c/bar.txt', b'a/b/d/qux.py',
375 b'readme.txt', b'nonexistent'],
375 b'readme.txt', b'nonexistent'],
376 exact=True)
376 exact=True)
377 m2 = m.matches(match)
377 m2 = m.matches(match)
378
378
379 self.assertEqual(
379 self.assertEqual(
380 [b'a/b/c/bar.txt', b'a/b/d/qux.py', b'readme.txt'],
380 [b'a/b/c/bar.txt', b'a/b/d/qux.py', b'readme.txt'],
381 m2.keys())
381 m2.keys())
382
382
383 def testMatchesNonexistentDirectory(self):
383 def testMatchesNonexistentDirectory(self):
384 '''Tests matches() for a relpath match on a directory that doesn't
384 '''Tests matches() for a relpath match on a directory that doesn't
385 actually exist.'''
385 actually exist.'''
386 m = self.parsemanifest(A_DEEPER_MANIFEST)
386 m = self.parsemanifest(A_DEEPER_MANIFEST)
387
387
388 match = matchmod.match(b'/', b'', [b'a/f'], default=b'relpath')
388 match = matchmod.match(b'/', b'', [b'a/f'], default=b'relpath')
389 m2 = m.matches(match)
389 m2 = m.matches(match)
390
390
391 self.assertEqual([], m2.keys())
391 self.assertEqual([], m2.keys())
392
392
393 def testMatchesExactLarge(self):
393 def testMatchesExactLarge(self):
394 '''Tests matches() for files matching a large list of exact files.
394 '''Tests matches() for files matching a large list of exact files.
395 '''
395 '''
396 m = self.parsemanifest(A_HUGE_MANIFEST)
396 m = self.parsemanifest(A_HUGE_MANIFEST)
397
397
398 flist = m.keys()[80:300]
398 flist = m.keys()[80:300]
399 match = matchmod.match(b'/', b'', flist, exact=True)
399 match = matchmod.match(b'/', b'', flist, exact=True)
400 m2 = m.matches(match)
400 m2 = m.matches(match)
401
401
402 self.assertEqual(flist, m2.keys())
402 self.assertEqual(flist, m2.keys())
403
403
404 def testMatchesFull(self):
404 def testMatchesFull(self):
405 '''Tests matches() for what should be a full match.'''
405 '''Tests matches() for what should be a full match.'''
406 m = self.parsemanifest(A_DEEPER_MANIFEST)
406 m = self.parsemanifest(A_DEEPER_MANIFEST)
407
407
408 match = matchmod.match(b'/', b'', [b''])
408 match = matchmod.match(b'/', b'', [b''])
409 m2 = m.matches(match)
409 m2 = m.matches(match)
410
410
411 self.assertEqual(m.keys(), m2.keys())
411 self.assertEqual(m.keys(), m2.keys())
412
412
413 def testMatchesDirectory(self):
413 def testMatchesDirectory(self):
414 '''Tests matches() on a relpath match on a directory, which should
414 '''Tests matches() on a relpath match on a directory, which should
415 match against all files within said directory.'''
415 match against all files within said directory.'''
416 m = self.parsemanifest(A_DEEPER_MANIFEST)
416 m = self.parsemanifest(A_DEEPER_MANIFEST)
417
417
418 match = matchmod.match(b'/', b'', [b'a/b'], default=b'relpath')
418 match = matchmod.match(b'/', b'', [b'a/b'], default=b'relpath')
419 m2 = m.matches(match)
419 m2 = m.matches(match)
420
420
421 self.assertEqual([
421 self.assertEqual([
422 b'a/b/c/bar.py', b'a/b/c/bar.txt', b'a/b/c/foo.py',
422 b'a/b/c/bar.py', b'a/b/c/bar.txt', b'a/b/c/foo.py',
423 b'a/b/c/foo.txt',
423 b'a/b/c/foo.txt',
424 b'a/b/d/baz.py', b'a/b/d/qux.py', b'a/b/d/ten.txt', b'a/b/dog.py',
424 b'a/b/d/baz.py', b'a/b/d/qux.py', b'a/b/d/ten.txt', b'a/b/dog.py',
425 b'a/b/fish.py'], m2.keys())
425 b'a/b/fish.py'], m2.keys())
426
426
427 def testMatchesExactPath(self):
427 def testMatchesExactPath(self):
428 '''Tests matches() on an exact match on a directory, which should
428 '''Tests matches() on an exact match on a directory, which should
429 result in an empty manifest because you can't perform an exact match
429 result in an empty manifest because you can't perform an exact match
430 against a directory.'''
430 against a directory.'''
431 m = self.parsemanifest(A_DEEPER_MANIFEST)
431 m = self.parsemanifest(A_DEEPER_MANIFEST)
432
432
433 match = matchmod.match(b'/', b'', [b'a/b'], exact=True)
433 match = matchmod.match(b'/', b'', [b'a/b'], exact=True)
434 m2 = m.matches(match)
434 m2 = m.matches(match)
435
435
436 self.assertEqual([], m2.keys())
436 self.assertEqual([], m2.keys())
437
437
438 def testMatchesCwd(self):
438 def testMatchesCwd(self):
439 '''Tests matches() on a relpath match with the current directory ('.')
439 '''Tests matches() on a relpath match with the current directory ('.')
440 when not in the root directory.'''
440 when not in the root directory.'''
441 m = self.parsemanifest(A_DEEPER_MANIFEST)
441 m = self.parsemanifest(A_DEEPER_MANIFEST)
442
442
443 match = matchmod.match(b'/', b'a/b', [b'.'], default=b'relpath')
443 match = matchmod.match(b'/', b'a/b', [b'.'], default=b'relpath')
444 m2 = m.matches(match)
444 m2 = m.matches(match)
445
445
446 self.assertEqual([
446 self.assertEqual([
447 b'a/b/c/bar.py', b'a/b/c/bar.txt', b'a/b/c/foo.py',
447 b'a/b/c/bar.py', b'a/b/c/bar.txt', b'a/b/c/foo.py',
448 b'a/b/c/foo.txt', b'a/b/d/baz.py', b'a/b/d/qux.py',
448 b'a/b/c/foo.txt', b'a/b/d/baz.py', b'a/b/d/qux.py',
449 b'a/b/d/ten.txt', b'a/b/dog.py', b'a/b/fish.py'], m2.keys())
449 b'a/b/d/ten.txt', b'a/b/dog.py', b'a/b/fish.py'], m2.keys())
450
450
451 def testMatchesWithPattern(self):
451 def testMatchesWithPattern(self):
452 '''Tests matches() for files matching a pattern that reside
452 '''Tests matches() for files matching a pattern that reside
453 deeper than the specified directory.'''
453 deeper than the specified directory.'''
454 m = self.parsemanifest(A_DEEPER_MANIFEST)
454 m = self.parsemanifest(A_DEEPER_MANIFEST)
455
455
456 match = matchmod.match(b'/', b'', [b'a/b/*/*.txt'])
456 match = matchmod.match(b'/', b'', [b'a/b/*/*.txt'])
457 m2 = m.matches(match)
457 m2 = m.matches(match)
458
458
459 self.assertEqual(
459 self.assertEqual(
460 [b'a/b/c/bar.txt', b'a/b/c/foo.txt', b'a/b/d/ten.txt'],
460 [b'a/b/c/bar.txt', b'a/b/c/foo.txt', b'a/b/d/ten.txt'],
461 m2.keys())
461 m2.keys())
462
462
463 class testmanifestdict(unittest.TestCase, basemanifesttests):
463 class testmanifestdict(unittest.TestCase, basemanifesttests):
464 def parsemanifest(self, text):
464 def parsemanifest(self, text):
465 return manifestmod.manifestdict(text)
465 return manifestmod.manifestdict(text)
466
466
467 class testtreemanifest(unittest.TestCase, basemanifesttests):
467 class testtreemanifest(unittest.TestCase, basemanifesttests):
468 def parsemanifest(self, text):
468 def parsemanifest(self, text):
469 return manifestmod.treemanifest(b'', text)
469 return manifestmod.treemanifest(b'', text)
470
470
471 def testWalkSubtrees(self):
471 def testWalkSubtrees(self):
472 m = self.parsemanifest(A_DEEPER_MANIFEST)
472 m = self.parsemanifest(A_DEEPER_MANIFEST)
473
473
474 dirs = [s._dir for s in m.walksubtrees()]
474 dirs = [s._dir for s in m.walksubtrees()]
475 self.assertEqual(
475 self.assertEqual(
476 sorted([
476 sorted([
477 b'', b'a/', b'a/c/', b'a/d/', b'a/b/', b'a/b/c/', b'a/b/d/']),
477 b'', b'a/', b'a/c/', b'a/d/', b'a/b/', b'a/b/c/', b'a/b/d/']),
478 sorted(dirs)
478 sorted(dirs)
479 )
479 )
480
480
481 match = matchmod.match(b'/', b'', [b'path:a/b/'])
481 match = matchmod.match(b'/', b'', [b'path:a/b/'])
482 dirs = [s._dir for s in m.walksubtrees(matcher=match)]
482 dirs = [s._dir for s in m.walksubtrees(matcher=match)]
483 self.assertEqual(
483 self.assertEqual(
484 sorted([b'a/b/', b'a/b/c/', b'a/b/d/']),
484 sorted([b'a/b/', b'a/b/c/', b'a/b/d/']),
485 sorted(dirs)
485 sorted(dirs)
486 )
486 )
487
487
488 if __name__ == '__main__':
488 if __name__ == '__main__':
489 silenttestrunner.main(__name__)
489 silenttestrunner.main(__name__)
@@ -1,24 +1,24 b''
1 from __future__ import absolute_import
1 from __future__ import absolute_import
2 from __future__ import print_function
2 from __future__ import print_function
3
3
4 import unittest
4 import unittest
5
5
6 from mercurial import (
6 from mercurial import (
7 mdiff,
7 mdiff,
8 )
8 )
9
9
10 class splitnewlinesTests(unittest.TestCase):
10 class splitnewlinesTests(unittest.TestCase):
11
11
12 def test_splitnewlines(self):
12 def test_splitnewlines(self):
13 cases = {'a\nb\nc\n': ['a\n', 'b\n', 'c\n'],
13 cases = {'a\nb\nc\n': ['a\n', 'b\n', 'c\n'],
14 'a\nb\nc': ['a\n', 'b\n', 'c'],
14 'a\nb\nc': ['a\n', 'b\n', 'c'],
15 'a\nb\nc\n\n': ['a\n', 'b\n', 'c\n', '\n'],
15 'a\nb\nc\n\n': ['a\n', 'b\n', 'c\n', '\n'],
16 '': [],
16 '': [],
17 'abcabc': ['abcabc'],
17 'abcabc': ['abcabc'],
18 }
18 }
19 for inp, want in cases.iteritems():
19 for inp, want in cases.items():
20 self.assertEqual(mdiff.splitnewlines(inp), want)
20 self.assertEqual(mdiff.splitnewlines(inp), want)
21
21
22 if __name__ == '__main__':
22 if __name__ == '__main__':
23 import silenttestrunner
23 import silenttestrunner
24 silenttestrunner.main(__name__)
24 silenttestrunner.main(__name__)
@@ -1,209 +1,209 b''
1 # This is a randomized test that generates different pathnames every
1 # This is a randomized test that generates different pathnames every
2 # time it is invoked, and tests the encoding of those pathnames.
2 # time it is invoked, and tests the encoding of those pathnames.
3 #
3 #
4 # It uses a simple probabilistic model to generate valid pathnames
4 # It uses a simple probabilistic model to generate valid pathnames
5 # that have proven likely to expose bugs and divergent behavior in
5 # that have proven likely to expose bugs and divergent behavior in
6 # different encoding implementations.
6 # different encoding implementations.
7
7
8 from __future__ import absolute_import, print_function
8 from __future__ import absolute_import, print_function
9
9
10 import binascii
10 import binascii
11 import collections
11 import collections
12 import itertools
12 import itertools
13 import math
13 import math
14 import os
14 import os
15 import random
15 import random
16 import sys
16 import sys
17 import time
17 import time
18 from mercurial import (
18 from mercurial import (
19 store,
19 store,
20 )
20 )
21
21
22 try:
22 try:
23 xrange
23 xrange
24 except NameError:
24 except NameError:
25 xrange = range
25 xrange = range
26
26
27 validchars = set(map(chr, range(0, 256)))
27 validchars = set(map(chr, range(0, 256)))
28 alphanum = range(ord('A'), ord('Z'))
28 alphanum = range(ord('A'), ord('Z'))
29
29
30 for c in '\0/':
30 for c in '\0/':
31 validchars.remove(c)
31 validchars.remove(c)
32
32
33 winreserved = ('aux con prn nul'.split() +
33 winreserved = ('aux con prn nul'.split() +
34 ['com%d' % i for i in xrange(1, 10)] +
34 ['com%d' % i for i in xrange(1, 10)] +
35 ['lpt%d' % i for i in xrange(1, 10)])
35 ['lpt%d' % i for i in xrange(1, 10)])
36
36
37 def casecombinations(names):
37 def casecombinations(names):
38 '''Build all case-diddled combinations of names.'''
38 '''Build all case-diddled combinations of names.'''
39
39
40 combos = set()
40 combos = set()
41
41
42 for r in names:
42 for r in names:
43 for i in xrange(len(r) + 1):
43 for i in xrange(len(r) + 1):
44 for c in itertools.combinations(xrange(len(r)), i):
44 for c in itertools.combinations(xrange(len(r)), i):
45 d = r
45 d = r
46 for j in c:
46 for j in c:
47 d = ''.join((d[:j], d[j].upper(), d[j + 1:]))
47 d = ''.join((d[:j], d[j].upper(), d[j + 1:]))
48 combos.add(d)
48 combos.add(d)
49 return sorted(combos)
49 return sorted(combos)
50
50
51 def buildprobtable(fp, cmd='hg manifest tip'):
51 def buildprobtable(fp, cmd='hg manifest tip'):
52 '''Construct and print a table of probabilities for path name
52 '''Construct and print a table of probabilities for path name
53 components. The numbers are percentages.'''
53 components. The numbers are percentages.'''
54
54
55 counts = collections.defaultdict(lambda: 0)
55 counts = collections.defaultdict(lambda: 0)
56 for line in os.popen(cmd).read().splitlines():
56 for line in os.popen(cmd).read().splitlines():
57 if line[-2:] in ('.i', '.d'):
57 if line[-2:] in ('.i', '.d'):
58 line = line[:-2]
58 line = line[:-2]
59 if line.startswith('data/'):
59 if line.startswith('data/'):
60 line = line[5:]
60 line = line[5:]
61 for c in line:
61 for c in line:
62 counts[c] += 1
62 counts[c] += 1
63 for c in '\r/\n':
63 for c in '\r/\n':
64 counts.pop(c, None)
64 counts.pop(c, None)
65 t = sum(counts.itervalues()) / 100.0
65 t = sum(counts.itervalues()) / 100.0
66 fp.write('probtable = (')
66 fp.write('probtable = (')
67 for i, (k, v) in enumerate(sorted(counts.iteritems(), key=lambda x: x[1],
67 for i, (k, v) in enumerate(sorted(counts.items(), key=lambda x: x[1],
68 reverse=True)):
68 reverse=True)):
69 if (i % 5) == 0:
69 if (i % 5) == 0:
70 fp.write('\n ')
70 fp.write('\n ')
71 vt = v / t
71 vt = v / t
72 if vt < 0.0005:
72 if vt < 0.0005:
73 break
73 break
74 fp.write('(%r, %.03f), ' % (k, vt))
74 fp.write('(%r, %.03f), ' % (k, vt))
75 fp.write('\n )\n')
75 fp.write('\n )\n')
76
76
77 # A table of character frequencies (as percentages), gleaned by
77 # A table of character frequencies (as percentages), gleaned by
78 # looking at filelog names from a real-world, very large repo.
78 # looking at filelog names from a real-world, very large repo.
79
79
80 probtable = (
80 probtable = (
81 ('t', 9.828), ('e', 9.042), ('s', 8.011), ('a', 6.801), ('i', 6.618),
81 ('t', 9.828), ('e', 9.042), ('s', 8.011), ('a', 6.801), ('i', 6.618),
82 ('g', 5.053), ('r', 5.030), ('o', 4.887), ('p', 4.363), ('n', 4.258),
82 ('g', 5.053), ('r', 5.030), ('o', 4.887), ('p', 4.363), ('n', 4.258),
83 ('l', 3.830), ('h', 3.693), ('_', 3.659), ('.', 3.377), ('m', 3.194),
83 ('l', 3.830), ('h', 3.693), ('_', 3.659), ('.', 3.377), ('m', 3.194),
84 ('u', 2.364), ('d', 2.296), ('c', 2.163), ('b', 1.739), ('f', 1.625),
84 ('u', 2.364), ('d', 2.296), ('c', 2.163), ('b', 1.739), ('f', 1.625),
85 ('6', 0.666), ('j', 0.610), ('y', 0.554), ('x', 0.487), ('w', 0.477),
85 ('6', 0.666), ('j', 0.610), ('y', 0.554), ('x', 0.487), ('w', 0.477),
86 ('k', 0.476), ('v', 0.473), ('3', 0.336), ('1', 0.335), ('2', 0.326),
86 ('k', 0.476), ('v', 0.473), ('3', 0.336), ('1', 0.335), ('2', 0.326),
87 ('4', 0.310), ('5', 0.305), ('9', 0.302), ('8', 0.300), ('7', 0.299),
87 ('4', 0.310), ('5', 0.305), ('9', 0.302), ('8', 0.300), ('7', 0.299),
88 ('q', 0.298), ('0', 0.250), ('z', 0.223), ('-', 0.118), ('C', 0.095),
88 ('q', 0.298), ('0', 0.250), ('z', 0.223), ('-', 0.118), ('C', 0.095),
89 ('T', 0.087), ('F', 0.085), ('B', 0.077), ('S', 0.076), ('P', 0.076),
89 ('T', 0.087), ('F', 0.085), ('B', 0.077), ('S', 0.076), ('P', 0.076),
90 ('L', 0.059), ('A', 0.058), ('N', 0.051), ('D', 0.049), ('M', 0.046),
90 ('L', 0.059), ('A', 0.058), ('N', 0.051), ('D', 0.049), ('M', 0.046),
91 ('E', 0.039), ('I', 0.035), ('R', 0.035), ('G', 0.028), ('U', 0.026),
91 ('E', 0.039), ('I', 0.035), ('R', 0.035), ('G', 0.028), ('U', 0.026),
92 ('W', 0.025), ('O', 0.017), ('V', 0.015), ('H', 0.013), ('Q', 0.011),
92 ('W', 0.025), ('O', 0.017), ('V', 0.015), ('H', 0.013), ('Q', 0.011),
93 ('J', 0.007), ('K', 0.005), ('+', 0.004), ('X', 0.003), ('Y', 0.001),
93 ('J', 0.007), ('K', 0.005), ('+', 0.004), ('X', 0.003), ('Y', 0.001),
94 )
94 )
95
95
96 for c, _ in probtable:
96 for c, _ in probtable:
97 validchars.remove(c)
97 validchars.remove(c)
98 validchars = list(validchars)
98 validchars = list(validchars)
99
99
100 def pickfrom(rng, table):
100 def pickfrom(rng, table):
101 c = 0
101 c = 0
102 r = rng.random() * sum(i[1] for i in table)
102 r = rng.random() * sum(i[1] for i in table)
103 for i, p in table:
103 for i, p in table:
104 c += p
104 c += p
105 if c >= r:
105 if c >= r:
106 return i
106 return i
107
107
108 reservedcombos = casecombinations(winreserved)
108 reservedcombos = casecombinations(winreserved)
109
109
110 # The first component of a name following a slash.
110 # The first component of a name following a slash.
111
111
112 firsttable = (
112 firsttable = (
113 (lambda rng: pickfrom(rng, probtable), 90),
113 (lambda rng: pickfrom(rng, probtable), 90),
114 (lambda rng: rng.choice(validchars), 5),
114 (lambda rng: rng.choice(validchars), 5),
115 (lambda rng: rng.choice(reservedcombos), 5),
115 (lambda rng: rng.choice(reservedcombos), 5),
116 )
116 )
117
117
118 # Components of a name following the first.
118 # Components of a name following the first.
119
119
120 resttable = firsttable[:-1]
120 resttable = firsttable[:-1]
121
121
122 # Special suffixes.
122 # Special suffixes.
123
123
124 internalsuffixcombos = casecombinations('.hg .i .d'.split())
124 internalsuffixcombos = casecombinations('.hg .i .d'.split())
125
125
126 # The last component of a path, before a slash or at the end of a name.
126 # The last component of a path, before a slash or at the end of a name.
127
127
128 lasttable = resttable + (
128 lasttable = resttable + (
129 (lambda rng: '', 95),
129 (lambda rng: '', 95),
130 (lambda rng: rng.choice(internalsuffixcombos), 5),
130 (lambda rng: rng.choice(internalsuffixcombos), 5),
131 )
131 )
132
132
133 def makepart(rng, k):
133 def makepart(rng, k):
134 '''Construct a part of a pathname, without slashes.'''
134 '''Construct a part of a pathname, without slashes.'''
135
135
136 p = pickfrom(rng, firsttable)(rng)
136 p = pickfrom(rng, firsttable)(rng)
137 l = len(p)
137 l = len(p)
138 ps = [p]
138 ps = [p]
139 maxl = rng.randint(1, k)
139 maxl = rng.randint(1, k)
140 while l < maxl:
140 while l < maxl:
141 p = pickfrom(rng, resttable)(rng)
141 p = pickfrom(rng, resttable)(rng)
142 l += len(p)
142 l += len(p)
143 ps.append(p)
143 ps.append(p)
144 ps.append(pickfrom(rng, lasttable)(rng))
144 ps.append(pickfrom(rng, lasttable)(rng))
145 return ''.join(ps)
145 return ''.join(ps)
146
146
147 def makepath(rng, j, k):
147 def makepath(rng, j, k):
148 '''Construct a complete pathname.'''
148 '''Construct a complete pathname.'''
149
149
150 return ('data/' + '/'.join(makepart(rng, k) for _ in xrange(j)) +
150 return ('data/' + '/'.join(makepart(rng, k) for _ in xrange(j)) +
151 rng.choice(['.d', '.i']))
151 rng.choice(['.d', '.i']))
152
152
153 def genpath(rng, count):
153 def genpath(rng, count):
154 '''Generate random pathnames with gradually increasing lengths.'''
154 '''Generate random pathnames with gradually increasing lengths.'''
155
155
156 mink, maxk = 1, 4096
156 mink, maxk = 1, 4096
157 def steps():
157 def steps():
158 for i in xrange(count):
158 for i in xrange(count):
159 yield mink + int(round(math.sqrt((maxk - mink) * float(i) / count)))
159 yield mink + int(round(math.sqrt((maxk - mink) * float(i) / count)))
160 for k in steps():
160 for k in steps():
161 x = rng.randint(1, k)
161 x = rng.randint(1, k)
162 y = rng.randint(1, k)
162 y = rng.randint(1, k)
163 yield makepath(rng, x, y)
163 yield makepath(rng, x, y)
164
164
165 def runtests(rng, seed, count):
165 def runtests(rng, seed, count):
166 nerrs = 0
166 nerrs = 0
167 for p in genpath(rng, count):
167 for p in genpath(rng, count):
168 h = store._pathencode(p) # uses C implementation, if available
168 h = store._pathencode(p) # uses C implementation, if available
169 r = store._hybridencode(p, True) # reference implementation in Python
169 r = store._hybridencode(p, True) # reference implementation in Python
170 if h != r:
170 if h != r:
171 if nerrs == 0:
171 if nerrs == 0:
172 print('seed:', hex(seed)[:-1], file=sys.stderr)
172 print('seed:', hex(seed)[:-1], file=sys.stderr)
173 print("\np: '%s'" % p.encode("string_escape"), file=sys.stderr)
173 print("\np: '%s'" % p.encode("string_escape"), file=sys.stderr)
174 print("h: '%s'" % h.encode("string_escape"), file=sys.stderr)
174 print("h: '%s'" % h.encode("string_escape"), file=sys.stderr)
175 print("r: '%s'" % r.encode("string_escape"), file=sys.stderr)
175 print("r: '%s'" % r.encode("string_escape"), file=sys.stderr)
176 nerrs += 1
176 nerrs += 1
177 return nerrs
177 return nerrs
178
178
179 def main():
179 def main():
180 import getopt
180 import getopt
181
181
182 # Empirically observed to take about a second to run
182 # Empirically observed to take about a second to run
183 count = 100
183 count = 100
184 seed = None
184 seed = None
185 opts, args = getopt.getopt(sys.argv[1:], 'c:s:',
185 opts, args = getopt.getopt(sys.argv[1:], 'c:s:',
186 ['build', 'count=', 'seed='])
186 ['build', 'count=', 'seed='])
187 for o, a in opts:
187 for o, a in opts:
188 if o in ('-c', '--count'):
188 if o in ('-c', '--count'):
189 count = int(a)
189 count = int(a)
190 elif o in ('-s', '--seed'):
190 elif o in ('-s', '--seed'):
191 seed = int(a, base=0) # accepts base 10 or 16 strings
191 seed = int(a, base=0) # accepts base 10 or 16 strings
192 elif o == '--build':
192 elif o == '--build':
193 buildprobtable(sys.stdout,
193 buildprobtable(sys.stdout,
194 'find .hg/store/data -type f && '
194 'find .hg/store/data -type f && '
195 'cat .hg/store/fncache 2>/dev/null')
195 'cat .hg/store/fncache 2>/dev/null')
196 sys.exit(0)
196 sys.exit(0)
197
197
198 if seed is None:
198 if seed is None:
199 try:
199 try:
200 seed = int(binascii.hexlify(os.urandom(16)), 16)
200 seed = int(binascii.hexlify(os.urandom(16)), 16)
201 except AttributeError:
201 except AttributeError:
202 seed = int(time.time() * 1000)
202 seed = int(time.time() * 1000)
203
203
204 rng = random.Random(seed)
204 rng = random.Random(seed)
205 if runtests(rng, seed, count):
205 if runtests(rng, seed, count):
206 sys.exit(1)
206 sys.exit(1)
207
207
208 if __name__ == '__main__':
208 if __name__ == '__main__':
209 main()
209 main()
@@ -1,60 +1,60 b''
1
1
2 $ cat > engine.py << EOF
2 $ cat > engine.py << EOF
3 >
3 >
4 > from mercurial import templater
4 > from mercurial import templater
5 >
5 >
6 > class mytemplater(object):
6 > class mytemplater(object):
7 > def __init__(self, loader, filters, defaults, resources, aliases):
7 > def __init__(self, loader, filters, defaults, resources, aliases):
8 > self.loader = loader
8 > self.loader = loader
9 > self._defaults = defaults
9 > self._defaults = defaults
10 > self._resources = resources
10 > self._resources = resources
11 >
11 >
12 > def process(self, t, map):
12 > def process(self, t, map):
13 > tmpl = self.loader(t)
13 > tmpl = self.loader(t)
14 > props = self._defaults.copy()
14 > props = self._defaults.copy()
15 > props.update(map)
15 > props.update(map)
16 > for k, v in props.iteritems():
16 > for k, v in props.items():
17 > if k in ('templ', 'ctx', 'repo', 'revcache', 'cache', 'troubles'):
17 > if k in ('templ', 'ctx', 'repo', 'revcache', 'cache', 'troubles'):
18 > continue
18 > continue
19 > if hasattr(v, '__call__'):
19 > if hasattr(v, '__call__'):
20 > props = self._resources.copy()
20 > props = self._resources.copy()
21 > props.update(map)
21 > props.update(map)
22 > v = v(**props)
22 > v = v(**props)
23 > v = templater.stringify(v)
23 > v = templater.stringify(v)
24 > tmpl = tmpl.replace('{{%s}}' % k, v)
24 > tmpl = tmpl.replace('{{%s}}' % k, v)
25 > yield tmpl
25 > yield tmpl
26 >
26 >
27 > templater.engines['my'] = mytemplater
27 > templater.engines['my'] = mytemplater
28 > EOF
28 > EOF
29 $ hg init test
29 $ hg init test
30 $ echo '[extensions]' > test/.hg/hgrc
30 $ echo '[extensions]' > test/.hg/hgrc
31 $ echo "engine = `pwd`/engine.py" >> test/.hg/hgrc
31 $ echo "engine = `pwd`/engine.py" >> test/.hg/hgrc
32 $ cd test
32 $ cd test
33 $ cat > mymap << EOF
33 $ cat > mymap << EOF
34 > changeset = my:changeset.txt
34 > changeset = my:changeset.txt
35 > EOF
35 > EOF
36 $ cat > changeset.txt << EOF
36 $ cat > changeset.txt << EOF
37 > {{rev}} {{node}} {{author}}
37 > {{rev}} {{node}} {{author}}
38 > EOF
38 > EOF
39 $ hg ci -Ama
39 $ hg ci -Ama
40 adding changeset.txt
40 adding changeset.txt
41 adding mymap
41 adding mymap
42 $ hg log --style=./mymap
42 $ hg log --style=./mymap
43 0 97e5f848f0936960273bbf75be6388cd0350a32b test
43 0 97e5f848f0936960273bbf75be6388cd0350a32b test
44
44
45 $ cat > changeset.txt << EOF
45 $ cat > changeset.txt << EOF
46 > {{p1rev}} {{p1node}} {{p2rev}} {{p2node}}
46 > {{p1rev}} {{p1node}} {{p2rev}} {{p2node}}
47 > EOF
47 > EOF
48 $ hg ci -Ama
48 $ hg ci -Ama
49 $ hg log --style=./mymap
49 $ hg log --style=./mymap
50 0 97e5f848f0936960273bbf75be6388cd0350a32b -1 0000000000000000000000000000000000000000
50 0 97e5f848f0936960273bbf75be6388cd0350a32b -1 0000000000000000000000000000000000000000
51 -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000
51 -1 0000000000000000000000000000000000000000 -1 0000000000000000000000000000000000000000
52
52
53 invalid engine type:
53 invalid engine type:
54
54
55 $ echo 'changeset = unknown:changeset.txt' > unknownenginemap
55 $ echo 'changeset = unknown:changeset.txt' > unknownenginemap
56 $ hg log --style=./unknownenginemap
56 $ hg log --style=./unknownenginemap
57 abort: invalid template engine: unknown
57 abort: invalid template engine: unknown
58 [255]
58 [255]
59
59
60 $ cd ..
60 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now