##// END OF EJS Templates
censor: make various path forms available like other Mercurial commands...
FUJIWARA Katsunori -
r25806:5e18f6e3 default
parent child Browse files
Show More
@@ -47,6 +47,12 b" def censor(ui, repo, path, rev='', tombs"
47 if not rev:
47 if not rev:
48 raise util.Abort(_('must specify revision to censor'))
48 raise util.Abort(_('must specify revision to censor'))
49
49
50 wctx = repo[None]
51
52 m = scmutil.match(wctx, (path,))
53 if m.anypats() or len(m.files()) != 1:
54 raise util.Abort(_('can only specify an explicit filename'))
55 path = m.files()[0]
50 flog = repo.file(path)
56 flog = repo.file(path)
51 if not len(flog):
57 if not len(flog):
52 raise util.Abort(_('cannot censor file with no history'))
58 raise util.Abort(_('cannot censor file with no history'))
@@ -70,7 +76,6 b" def censor(ui, repo, path, rev='', tombs"
70 raise util.Abort(_('cannot censor file in heads (%s)') % headlist,
76 raise util.Abort(_('cannot censor file in heads (%s)') % headlist,
71 hint=_('clean/delete and commit first'))
77 hint=_('clean/delete and commit first'))
72
78
73 wctx = repo[None]
74 wp = wctx.parents()
79 wp = wctx.parents()
75 if ctx.node() in [p.node() for p in wp]:
80 if ctx.node() in [p.node() for p in wp]:
76 raise util.Abort(_('cannot censor working directory'),
81 raise util.Abort(_('cannot censor working directory'),
@@ -72,7 +72,10 b' Try to censor revision with too large of'
72
72
73 Censor revision with 2 offenses
73 Censor revision with 2 offenses
74
74
75 $ hg censor -r $C2 -t "remove password" target
75 (this also tests file pattern matching: path relative to cwd case)
76
77 $ mkdir -p foo/bar/baz
78 $ hg --cwd foo/bar/baz censor -r $C2 -t "remove password" ../../../target
76 $ hg cat -r $H1 target
79 $ hg cat -r $H1 target
77 Tainted file is now sanitized
80 Tainted file is now sanitized
78 $ hg cat -r $H2 target
81 $ hg cat -r $H2 target
@@ -89,7 +92,9 b' Censor revision with 2 offenses'
89
92
90 Censor revision with 1 offense
93 Censor revision with 1 offense
91
94
92 $ hg censor -r $C1 target
95 (this also tests file pattern matching: with 'path:' scheme)
96
97 $ hg --cwd foo/bar/baz censor -r $C1 path:target
93 $ hg cat -r $H1 target
98 $ hg cat -r $H1 target
94 Tainted file is now sanitized
99 Tainted file is now sanitized
95 $ hg cat -r $H2 target
100 $ hg cat -r $H2 target
General Comments 0
You need to be logged in to leave comments. Login now