-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make ignored_files support re #33
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
该 PR 的修改破坏了存量部署的配置后向兼容性,请调整实现方式
除此之外,该实现未对文件/文件夹的嵌套关系进行处理,可能会造成意料外的非完整数据备份,这也是需要考虑的
第二点可以具体举例说说嘛?什么情况下无法用正则表达式匹配? |
建议自行阅读相关代码实现
该观点我未曾提出过 |
第一点可以考虑将原始的ignored_files保留,新增一个配置项ignored_files_re(考虑到*在re中是有特殊含义的),不过新增的配置项能否自动添加到用户config.json中呢? |
自己看一下相关代码是怎么使用这个函数的吧 理解清楚修改的代码的用处功能,是交 PR 前必须的操作呀,不能连相关改动的代码是干什么的都不知道,就随便改下交 PR |
我现在仔细看了一下__scan_files,好像改动前后没有逻辑上没有什么差别呀,能指出来吗 |
Added 'ignored_files_regex' to support regex patterns.
你的第一个问题现在解决了,麻烦看一下 |
'session.lock', | ||
ignored_files: List[str] = [] | ||
ignored_files_regex: List[str] = [ | ||
'server/session.lock', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
错误配置的默认值
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是等效的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不等效。多了解下相关逻辑吧,这里有 4 个不同种类错误,不清楚就别改了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 正则表达式里未转义
.
- 路径分隔符硬编码为 posix 下的实现,不兼容 windows
- 假定了 MCDR 配置的服务端路径为
server
session.lock
的路径错误。其应当位于存档文件夹中
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
正则表达式里未转义
.
路径分隔符硬编码为 posix 下的实现,不兼容 windows
假定了 MCDR 配置的服务端路径为
server
session.lock
的路径错误。其应当位于存档文件夹中
好的
A list of file names to be ignored during backup. It contains `session.lock` by default | ||
to solve the backup failure problem caused by `session.lock` being occupied by the server in Windows | ||
The list of filenames to ignore during backup, does not support regex matching. | ||
It is recommended to use `ignored_files_regex` to support more accurate and specific matching methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignored_files_regex
不是 ignored_files
的完全替代
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignored_files_regex
不是ignored_files
的完全替代
那么将描述修改为“更强大的匹配”?
@@ -44,4 +45,7 @@ def is_file_ignore(self, full_path: Path) -> bool: | |||
return True | |||
if name == item: | |||
return True | |||
for item in self.ignored_files_regex: | |||
if re.match(item, str(full_path)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议用 Path.as_posix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
改动前后没有差别,复用了仅支持文件排除的 |
我之后自己实现吧 |
你原本的代码的逻辑就是同时用ignored_files来对所有的文件夹和文件名进行匹配啊,并不是“仅支持文件排除” |
No description provided.