narrow: hoist a variable to a higher level to avoid use-before-init warning
In practice, this shouldn't generate an IOError, so there wouldn't have been a
problem. But PyCharm didn't know that.
--- a/hgext/narrow/narrowcommands.py Sun Aug 20 17:04:17 2023 -0400
+++ b/hgext/narrow/narrowcommands.py Sun Aug 20 17:05:52 2023 -0400
@@ -527,8 +527,8 @@
# import rules from a file
newrules = opts.get('import_rules')
if newrules:
+ filepath = os.path.join(encoding.getcwd(), newrules)
try:
- filepath = os.path.join(encoding.getcwd(), newrules)
fdata = util.readfile(filepath)
except IOError as inst:
raise error.StorageError(