##// END OF EJS Templates
tests: alias ui as uimod in test-revlog-ancestry/test-ui-verbosity
Yuya Nishihara -
r28842:d466facc default
parent child Browse files
Show More
@@ -1,88 +1,88 b''
1 1 from __future__ import absolute_import, print_function
2 2 import os
3 3 from mercurial import (
4 4 hg,
5 5 merge,
6 ui,
6 ui as uimod,
7 7 )
8 8
9 u = ui.ui()
9 u = uimod.ui()
10 10
11 11 repo = hg.repository(u, 'test1', create=1)
12 12 os.chdir('test1')
13 13
14 14 def commit(text, time):
15 15 repo.commit(text=text, date="%d 0" % time)
16 16
17 17 def addcommit(name, time):
18 18 f = open(name, 'w')
19 19 f.write('%s\n' % name)
20 20 f.close()
21 21 repo[None].add([name])
22 22 commit(name, time)
23 23
24 24 def update(rev):
25 25 merge.update(repo, rev, False, True)
26 26
27 27 def merge_(rev):
28 28 merge.update(repo, rev, True, False)
29 29
30 30 if __name__ == '__main__':
31 31 addcommit("A", 0)
32 32 addcommit("B", 1)
33 33
34 34 update(0)
35 35 addcommit("C", 2)
36 36
37 37 merge_(1)
38 38 commit("D", 3)
39 39
40 40 update(2)
41 41 addcommit("E", 4)
42 42 addcommit("F", 5)
43 43
44 44 update(3)
45 45 addcommit("G", 6)
46 46
47 47 merge_(5)
48 48 commit("H", 7)
49 49
50 50 update(5)
51 51 addcommit("I", 8)
52 52
53 53 # Ancestors
54 54 print('Ancestors of 5')
55 55 for r in repo.changelog.ancestors([5]):
56 56 print(r, end=' ')
57 57
58 58 print('\nAncestors of 6 and 5')
59 59 for r in repo.changelog.ancestors([6, 5]):
60 60 print(r, end=' ')
61 61
62 62 print('\nAncestors of 5 and 4')
63 63 for r in repo.changelog.ancestors([5, 4]):
64 64 print(r, end=' ')
65 65
66 66 print('\nAncestors of 7, stop at 6')
67 67 for r in repo.changelog.ancestors([7], 6):
68 68 print(r, end=' ')
69 69
70 70 print('\nAncestors of 7, including revs')
71 71 for r in repo.changelog.ancestors([7], inclusive=True):
72 72 print(r, end=' ')
73 73
74 74 print('\nAncestors of 7, 5 and 3, including revs')
75 75 for r in repo.changelog.ancestors([7, 5, 3], inclusive=True):
76 76 print(r, end=' ')
77 77
78 78 # Descendants
79 79 print('\n\nDescendants of 5')
80 80 for r in repo.changelog.descendants([5]):
81 81 print(r, end=' ')
82 82
83 83 print('\nDescendants of 5 and 3')
84 84 for r in repo.changelog.descendants([5, 3]):
85 85 print(r, end=' ')
86 86
87 87 print('\nDescendants of 5 and 4')
88 88 print(*repo.changelog.descendants([5, 4]), sep=' ')
@@ -1,49 +1,51 b''
1 1 from __future__ import absolute_import, print_function
2 2
3 3 import os
4 from mercurial import ui
4 from mercurial import (
5 ui as uimod,
6 )
5 7
6 8 hgrc = os.environ['HGRCPATH']
7 9 f = open(hgrc)
8 10 basehgrc = f.read()
9 11 f.close()
10 12
11 13 print(' hgrc settings command line options final result ')
12 14 print(' quiet verbo debug quiet verbo debug quiet verbo debug')
13 15
14 16 for i in xrange(64):
15 17 hgrc_quiet = bool(i & 1<<0)
16 18 hgrc_verbose = bool(i & 1<<1)
17 19 hgrc_debug = bool(i & 1<<2)
18 20 cmd_quiet = bool(i & 1<<3)
19 21 cmd_verbose = bool(i & 1<<4)
20 22 cmd_debug = bool(i & 1<<5)
21 23
22 24 f = open(hgrc, 'w')
23 25 f.write(basehgrc)
24 26 f.write('\n[ui]\n')
25 27 if hgrc_quiet:
26 28 f.write('quiet = True\n')
27 29 if hgrc_verbose:
28 30 f.write('verbose = True\n')
29 31 if hgrc_debug:
30 32 f.write('debug = True\n')
31 33 f.close()
32 34
33 u = ui.ui()
35 u = uimod.ui()
34 36 if cmd_quiet or cmd_debug or cmd_verbose:
35 37 u.setconfig('ui', 'quiet', str(bool(cmd_quiet)))
36 38 u.setconfig('ui', 'verbose', str(bool(cmd_verbose)))
37 39 u.setconfig('ui', 'debug', str(bool(cmd_debug)))
38 40
39 41 check = ''
40 42 if u.debugflag:
41 43 if not u.verbose or u.quiet:
42 44 check = ' *'
43 45 elif u.verbose and u.quiet:
44 46 check = ' +'
45 47
46 48 print(('%2d %5s %5s %5s %5s %5s %5s -> %5s %5s %5s%s'
47 49 % (i, hgrc_quiet, hgrc_verbose, hgrc_debug,
48 50 cmd_quiet, cmd_verbose, cmd_debug,
49 51 u.quiet, u.verbose, u.debugflag, check)))
General Comments 0
You need to be logged in to leave comments. Login now