filter-repo: add text removal (or replacement) via file of expressions
Make it easy for users to search and replace text throughout the repository history. Instead of inventing some new syntax, reuse the same syntax used by BFG repo filter's --replace-text option, namely, a file with one expression per line of the form [regex:|glob:|literal:]$MATCH_EXPR[==>$REPLACEMENT_EXPR] Where "$MATCH_EXPR" is by default considered to be literal text, but could be a regex or a glob if the appropriate prefix is used. Also, $REPLACEMENT_EXPR defaults to '***REMOVED***' if not specified. If you want a literal '==>' to be part of your $MATCH_EXPR, then you must also manually specify a replacement expression instead of taking the default. Some examples: sup3rs3kr3t (replaces 'sup3rs3kr3t' with '***REMOVED***') HeWhoShallNotBeNamed==>Voldemort (replaces 'HeWhoShallNotBeNamed' with 'Voldemort') very==> (replaces 'very' with the empty string) regex:(\d{2})/(\d{2})/(\d{4})==>\2/\1/\3 (replaces '05/17/2012' with '17/05/2012', and vice-versa) The format for regex is as from re.sub(<pattern>, <repl>, <string>) from https://docs.python.org/2/library/re.html The <string> comes from file contents of the repo, and you specify the <pattern> and <repl>. glob:Copy*t==>Cartel (replaces 'Copyright' or 'Copyleft' or 'Copy my st' with 'Cartel') Signed-off-by: Elijah Newren <newren@gmail.com>pull/13/head
parent
4ee915e4dd
commit
73e91edecc
@ -0,0 +1,78 @@
|
||||
feature done
|
||||
blob
|
||||
mark :1
|
||||
data 8
|
||||
initial
|
||||
|
||||
reset refs/heads/B
|
||||
commit refs/heads/B
|
||||
mark :2
|
||||
author Little O. Me <me@little.net> 1535228562 -0700
|
||||
committer Little O. Me <me@little.net> 1535228562 -0700
|
||||
data 8
|
||||
Initial
|
||||
M 100644 :1 filename
|
||||
M 100644 :1 ten
|
||||
M 100644 :1 twenty
|
||||
|
||||
blob
|
||||
mark :3
|
||||
data 28
|
||||
twenty-modified-by-gremlins
|
||||
|
||||
commit refs/heads/B
|
||||
mark :4
|
||||
author Little 'ol Me <me@laptop.(none)> 1535229544 -0700
|
||||
committer Little 'ol Me <me@laptop.(none)> 1535229544 -0700
|
||||
data 11
|
||||
add twenty
|
||||
from :2
|
||||
M 100644 :3 twenty
|
||||
|
||||
blob
|
||||
mark :5
|
||||
data 25
|
||||
ten-modified-by-gremlins
|
||||
|
||||
commit refs/heads/A
|
||||
mark :6
|
||||
author Little O. Me <me@machine52.little.net> 1535229523 -0700
|
||||
committer Little O. Me <me@machine52.little.net> 1535229523 -0700
|
||||
data 8
|
||||
add ten
|
||||
from :2
|
||||
M 100644 :5 ten
|
||||
|
||||
commit refs/heads/master
|
||||
mark :7
|
||||
author Lit.e Me <me@fire.com> 1535229559 -0700
|
||||
committer Lit.e Me <me@fire.com> 1535229580 -0700
|
||||
data 24
|
||||
Merge branch 'A' into B
|
||||
from :4
|
||||
merge :6
|
||||
M 100644 :5 ten
|
||||
|
||||
blob
|
||||
mark :8
|
||||
data 6
|
||||
final
|
||||
|
||||
commit refs/heads/master
|
||||
mark :9
|
||||
author Little Me <me@bigcompany.com> 1535229601 -0700
|
||||
committer Little Me <me@bigcompany.com> 1535229601 -0700
|
||||
data 9
|
||||
whatever
|
||||
from :7
|
||||
M 100644 :8 filename
|
||||
M 100644 :8 ten
|
||||
M 100644 :8 twenty
|
||||
|
||||
tag v1.0
|
||||
from :9
|
||||
tagger Little John <second@merry.men> 1535229618 -0700
|
||||
data 5
|
||||
v1.0
|
||||
|
||||
done
|
@ -0,0 +1 @@
|
||||
mod==>modified-by-gremlins
|
Loading…
Reference in New Issue