summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/__init__.py4
-rw-r--r--subcmds/abandon.py4
-rw-r--r--subcmds/branches.py2
-rw-r--r--subcmds/checkout.py2
-rw-r--r--subcmds/diffmanifests.py24
-rw-r--r--subcmds/help.py2
-rw-r--r--subcmds/info.py2
-rw-r--r--subcmds/init.py2
-rw-r--r--subcmds/list.py2
-rw-r--r--subcmds/prune.py4
-rw-r--r--subcmds/start.py2
-rw-r--r--subcmds/sync.py2
-rw-r--r--subcmds/version.py35
13 files changed, 32 insertions, 55 deletions
diff --git a/subcmds/__init__.py b/subcmds/__init__.py
index 965ad0bb..83ec8470 100644
--- a/subcmds/__init__.py
+++ b/subcmds/__init__.py
@@ -37,9 +37,7 @@ for py in os.listdir(my_dir):
37 try: 37 try:
38 cmd = getattr(mod, clsn) 38 cmd = getattr(mod, clsn)
39 except AttributeError: 39 except AttributeError:
40 raise SyntaxError( 40 raise SyntaxError(f"{__name__}/{py} does not define class {clsn}")
41 "%s/%s does not define class %s" % (__name__, py, clsn)
42 )
43 41
44 name = name.replace("_", "-") 42 name = name.replace("_", "-")
45 cmd.NAME = name 43 cmd.NAME = name
diff --git a/subcmds/abandon.py b/subcmds/abandon.py
index f6c0c66c..e280d69e 100644
--- a/subcmds/abandon.py
+++ b/subcmds/abandon.py
@@ -117,7 +117,7 @@ It is equivalent to "git branch -D <branchname>".
117 all_projects, 117 all_projects,
118 callback=_ProcessResults, 118 callback=_ProcessResults,
119 output=Progress( 119 output=Progress(
120 "Abandon %s" % (nb,), len(all_projects), quiet=opt.quiet 120 f"Abandon {nb}", len(all_projects), quiet=opt.quiet
121 ), 121 ),
122 ) 122 )
123 123
@@ -152,4 +152,4 @@ It is equivalent to "git branch -D <branchname>".
152 _RelPath(p) for p in success[br] 152 _RelPath(p) for p in success[br]
153 ) 153 )
154 ) 154 )
155 print("%s%s| %s\n" % (br, " " * (width - len(br)), result)) 155 print(f"{br}{' ' * (width - len(br))}| {result}\n")
diff --git a/subcmds/branches.py b/subcmds/branches.py
index d9a190be..59b5cb28 100644
--- a/subcmds/branches.py
+++ b/subcmds/branches.py
@@ -174,7 +174,7 @@ is shown, then the branch appears in all projects.
174 if _RelPath(p) not in have: 174 if _RelPath(p) not in have:
175 paths.append(_RelPath(p)) 175 paths.append(_RelPath(p))
176 176
177 s = " %s %s" % (in_type, ", ".join(paths)) 177 s = f" {in_type} {', '.join(paths)}"
178 if not i.IsSplitCurrent and (width + 7 + len(s) < 80): 178 if not i.IsSplitCurrent and (width + 7 + len(s) < 80):
179 fmt = out.current if i.IsCurrent else fmt 179 fmt = out.current if i.IsCurrent else fmt
180 fmt(s) 180 fmt(s)
diff --git a/subcmds/checkout.py b/subcmds/checkout.py
index ea48263e..379bfa18 100644
--- a/subcmds/checkout.py
+++ b/subcmds/checkout.py
@@ -96,7 +96,7 @@ The command is equivalent to:
96 all_projects, 96 all_projects,
97 callback=_ProcessResults, 97 callback=_ProcessResults,
98 output=Progress( 98 output=Progress(
99 "Checkout %s" % (nb,), len(all_projects), quiet=opt.quiet 99 f"Checkout {nb}", len(all_projects), quiet=opt.quiet
100 ), 100 ),
101 ) 101 )
102 102
diff --git a/subcmds/diffmanifests.py b/subcmds/diffmanifests.py
index b446dbd8..88b697b6 100644
--- a/subcmds/diffmanifests.py
+++ b/subcmds/diffmanifests.py
@@ -87,25 +87,17 @@ synced and their revisions won't be found.
87 def _printRawDiff(self, diff, pretty_format=None, local=False): 87 def _printRawDiff(self, diff, pretty_format=None, local=False):
88 _RelPath = lambda p: p.RelPath(local=local) 88 _RelPath = lambda p: p.RelPath(local=local)
89 for project in diff["added"]: 89 for project in diff["added"]:
90 self.printText( 90 self.printText(f"A {_RelPath(project)} {project.revisionExpr}")
91 "A %s %s" % (_RelPath(project), project.revisionExpr)
92 )
93 self.out.nl() 91 self.out.nl()
94 92
95 for project in diff["removed"]: 93 for project in diff["removed"]:
96 self.printText( 94 self.printText(f"R {_RelPath(project)} {project.revisionExpr}")
97 "R %s %s" % (_RelPath(project), project.revisionExpr)
98 )
99 self.out.nl() 95 self.out.nl()
100 96
101 for project, otherProject in diff["changed"]: 97 for project, otherProject in diff["changed"]:
102 self.printText( 98 self.printText(
103 "C %s %s %s" 99 f"C {_RelPath(project)} {project.revisionExpr} "
104 % ( 100 f"{otherProject.revisionExpr}"
105 _RelPath(project),
106 project.revisionExpr,
107 otherProject.revisionExpr,
108 )
109 ) 101 )
110 self.out.nl() 102 self.out.nl()
111 self._printLogs( 103 self._printLogs(
@@ -118,12 +110,8 @@ synced and their revisions won't be found.
118 110
119 for project, otherProject in diff["unreachable"]: 111 for project, otherProject in diff["unreachable"]:
120 self.printText( 112 self.printText(
121 "U %s %s %s" 113 f"U {_RelPath(project)} {project.revisionExpr} "
122 % ( 114 f"{otherProject.revisionExpr}"
123 _RelPath(project),
124 project.revisionExpr,
125 otherProject.revisionExpr,
126 )
127 ) 115 )
128 self.out.nl() 116 self.out.nl()
129 117
diff --git a/subcmds/help.py b/subcmds/help.py
index a839131b..80040711 100644
--- a/subcmds/help.py
+++ b/subcmds/help.py
@@ -150,7 +150,7 @@ Displays detailed usage information about a command.
150 def _PrintAllCommandHelp(self): 150 def _PrintAllCommandHelp(self):
151 for name in sorted(all_commands): 151 for name in sorted(all_commands):
152 cmd = all_commands[name](manifest=self.manifest) 152 cmd = all_commands[name](manifest=self.manifest)
153 self._PrintCommandHelp(cmd, header_prefix="[%s] " % (name,)) 153 self._PrintCommandHelp(cmd, header_prefix=f"[{name}] ")
154 154
155 def _Options(self, p): 155 def _Options(self, p):
156 p.add_option( 156 p.add_option(
diff --git a/subcmds/info.py b/subcmds/info.py
index c24682c7..f637600e 100644
--- a/subcmds/info.py
+++ b/subcmds/info.py
@@ -248,7 +248,7 @@ class Info(PagedCommand):
248 248
249 for commit in commits: 249 for commit in commits:
250 split = commit.split() 250 split = commit.split()
251 self.text("{0:38}{1} ".format("", "-")) 251 self.text(f"{'':38}{'-'} ")
252 self.sha(split[0] + " ") 252 self.sha(split[0] + " ")
253 self.text(" ".join(split[1:])) 253 self.text(" ".join(split[1:]))
254 self.out.nl() 254 self.out.nl()
diff --git a/subcmds/init.py b/subcmds/init.py
index 9ac42d8e..44517877 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -215,7 +215,7 @@ to update the working directory files.
215 215
216 if not opt.quiet: 216 if not opt.quiet:
217 print() 217 print()
218 print("Your identity is: %s <%s>" % (name, email)) 218 print(f"Your identity is: {name} <{email}>")
219 print("is this correct [y/N]? ", end="", flush=True) 219 print("is this correct [y/N]? ", end="", flush=True)
220 a = sys.stdin.readline().strip().lower() 220 a = sys.stdin.readline().strip().lower()
221 if a in ("yes", "y", "t", "true"): 221 if a in ("yes", "y", "t", "true"):
diff --git a/subcmds/list.py b/subcmds/list.py
index fba6a4dc..4338e1c9 100644
--- a/subcmds/list.py
+++ b/subcmds/list.py
@@ -131,7 +131,7 @@ This is similar to running: repo forall -c 'echo "$REPO_PATH : $REPO_PROJECT"'.
131 elif opt.path_only and not opt.name_only: 131 elif opt.path_only and not opt.name_only:
132 lines.append("%s" % (_getpath(project))) 132 lines.append("%s" % (_getpath(project)))
133 else: 133 else:
134 lines.append("%s : %s" % (_getpath(project), project.name)) 134 lines.append(f"{_getpath(project)} : {project.name}")
135 135
136 if lines: 136 if lines:
137 lines.sort() 137 lines.sort()
diff --git a/subcmds/prune.py b/subcmds/prune.py
index f18471f3..f99082a4 100644
--- a/subcmds/prune.py
+++ b/subcmds/prune.py
@@ -83,9 +83,7 @@ class Prune(PagedCommand):
83 ) 83 )
84 84
85 if not branch.base_exists: 85 if not branch.base_exists:
86 print( 86 print(f"(ignoring: tracking branch is gone: {branch.base})")
87 "(ignoring: tracking branch is gone: %s)" % (branch.base,)
88 )
89 else: 87 else:
90 commits = branch.commits 88 commits = branch.commits
91 date = branch.date 89 date = branch.date
diff --git a/subcmds/start.py b/subcmds/start.py
index fd177f9e..56008f42 100644
--- a/subcmds/start.py
+++ b/subcmds/start.py
@@ -130,7 +130,7 @@ revision specified in the manifest.
130 all_projects, 130 all_projects,
131 callback=_ProcessResults, 131 callback=_ProcessResults,
132 output=Progress( 132 output=Progress(
133 "Starting %s" % (nb,), len(all_projects), quiet=opt.quiet 133 f"Starting {nb}", len(all_projects), quiet=opt.quiet
134 ), 134 ),
135 ) 135 )
136 136
diff --git a/subcmds/sync.py b/subcmds/sync.py
index a0a0be9a..02c1d3ae 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -1394,7 +1394,7 @@ later is required to fix a server side protocol bug.
1394 1394
1395 if username and password: 1395 if username and password:
1396 manifest_server = manifest_server.replace( 1396 manifest_server = manifest_server.replace(
1397 "://", "://%s:%s@" % (username, password), 1 1397 "://", f"://{username}:{password}@", 1
1398 ) 1398 )
1399 1399
1400 transport = PersistentTransport(manifest_server) 1400 transport = PersistentTransport(manifest_server)
diff --git a/subcmds/version.py b/subcmds/version.py
index 71a03608..5c817f17 100644
--- a/subcmds/version.py
+++ b/subcmds/version.py
@@ -42,35 +42,28 @@ class Version(Command, MirrorSafeCommand):
42 # These might not be the same. Report them both. 42 # These might not be the same. Report them both.
43 src_ver = RepoSourceVersion() 43 src_ver = RepoSourceVersion()
44 rp_ver = rp.bare_git.describe(HEAD) 44 rp_ver = rp.bare_git.describe(HEAD)
45 print("repo version %s" % rp_ver) 45 print(f"repo version {rp_ver}")
46 print(" (from %s)" % rem.url) 46 print(f" (from {rem.url})")
47 print(" (tracking %s)" % branch.merge) 47 print(f" (tracking {branch.merge})")
48 print(" (%s)" % rp.bare_git.log("-1", "--format=%cD", HEAD)) 48 print(f" ({rp.bare_git.log('-1', '--format=%cD', HEAD)})")
49 49
50 if self.wrapper_path is not None: 50 if self.wrapper_path is not None:
51 print("repo launcher version %s" % self.wrapper_version) 51 print(f"repo launcher version {self.wrapper_version}")
52 print(" (from %s)" % self.wrapper_path) 52 print(f" (from {self.wrapper_path})")
53 53
54 if src_ver != rp_ver: 54 if src_ver != rp_ver:
55 print(" (currently at %s)" % src_ver) 55 print(f" (currently at {src_ver})")
56 56
57 print("repo User-Agent %s" % user_agent.repo) 57 print(f"repo User-Agent {user_agent.repo}")
58 print("git %s" % git.version_tuple().full) 58 print(f"git {git.version_tuple().full}")
59 print("git User-Agent %s" % user_agent.git) 59 print(f"git User-Agent {user_agent.git}")
60 print("Python %s" % sys.version) 60 print(f"Python {sys.version}")
61 uname = platform.uname() 61 uname = platform.uname()
62 if sys.version_info.major < 3: 62 if sys.version_info.major < 3:
63 # Python 3 returns a named tuple, but Python 2 is simpler. 63 # Python 3 returns a named tuple, but Python 2 is simpler.
64 print(uname) 64 print(uname)
65 else: 65 else:
66 print( 66 print(f"OS {uname.system} {uname.release} ({uname.version})")
67 "OS %s %s (%s)" % (uname.system, uname.release, uname.version) 67 processor = uname.processor if uname.processor else "unknown"
68 ) 68 print(f"CPU {uname.machine} ({processor})")
69 print(
70 "CPU %s (%s)"
71 % (
72 uname.machine,
73 uname.processor if uname.processor else "unknown",
74 )
75 )
76 print("Bug reports:", Wrapper().BUG_URL) 69 print("Bug reports:", Wrapper().BUG_URL)