forked from conan-io/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplace_analytics_code.py
More file actions
26 lines (21 loc) · 866 Bytes
/
replace_analytics_code.py
File metadata and controls
26 lines (21 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import subprocess
lines = subprocess.check_output(['git', 'branch', "-a"]).decode().split("\n")
branches = []
for line in lines:
line = line.strip()
if line.startswith("remotes/origin/release/"):
branches.append(line.split("remotes/origin/")[1])
old_code = "UA-68594724-3"
old_code_2 = "GTM-53TFLK7"
new_code = "GTM-WK44ZFM"
if __name__ == "__main__":
for br in branches:
os.system("git checkout {}".format(br))
command = "find ./ -type f | grep -v .git | xargs sed -i 's/{}/{}/g'\\;".format(old_code, new_code)
print(command)
os.system(command)
os.system("find ./ -type f | grep -v .git | xargs sed -i 's/{}/{}/g'\\;".format(old_code_2, new_code))
os.system("git add .")
os.system("git commit -m \"Replaced old GA code\"")
os.system("git push origin {}".format(br))