Skip to content
Snippets Groups Projects
Commit 3636583c authored by Kevin Bullock's avatar Kevin Bullock
Browse files

verify: update to use makeprogress()

parent 9a6683d0
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,8 @@
from dulwich import diff_tree
from dulwich.objects import Commit, S_IFGITLINK
import compat
def verify(ui, repo, hgctx):
'''verify that a Mercurial rev matches the corresponding Git rev
......@@ -53,16 +55,15 @@
hgfiles.discard('.hgsub')
gitfiles = set()
i = 0
for gitfile, dummy in diff_tree.walk_trees(handler.git.object_store,
gitcommit.tree, None):
if gitfile.mode == dirkind:
continue
# TODO deal with submodules
if (gitfile.mode == S_IFGITLINK or gitfile.path == '.hgsubstate' or
gitfile.path == '.hgsub'):
continue
ui.progress('verify', i, total=len(hgfiles))
i += 1
gitfiles.add(gitfile.path)
with compat.makeprogress(ui, 'verify', total=len(hgfiles)) as progress:
for gitfile, dummy in diff_tree.walk_trees(handler.git.object_store,
gitcommit.tree, None):
if gitfile.mode == dirkind:
continue
# TODO deal with submodules
if (gitfile.mode == S_IFGITLINK or gitfile.path == '.hgsubstate' or
gitfile.path == '.hgsub'):
continue
progress.increment()
gitfiles.add(gitfile.path)
......@@ -68,7 +69,7 @@
try:
fctx = hgctx[gitfile.path]
except error.LookupError:
# we'll deal with this at the end
continue
try:
fctx = hgctx[gitfile.path]
except error.LookupError:
# we'll deal with this at the end
continue
......@@ -74,15 +75,13 @@
hgflags = fctx.flags()
gitflags = handler.convert_git_int_mode(gitfile.mode)
if hgflags != gitflags:
ui.write(_("file has different flags: %s (hg '%s', git '%s')\n") %
(gitfile.path, hgflags, gitflags))
failed = True
if fctx.data() != handler.git[gitfile.sha].data:
ui.write(_('difference in: %s\n') % gitfile.path)
failed = True
ui.progress('verify', None, total=len(hgfiles))
hgflags = fctx.flags()
gitflags = handler.convert_git_int_mode(gitfile.mode)
if hgflags != gitflags:
ui.write(_("file has different flags: %s (hg '%s', git '%s')\n") %
(gitfile.path, hgflags, gitflags))
failed = True
if fctx.data() != handler.git[gitfile.sha].data:
ui.write(_('difference in: %s\n') % gitfile.path)
failed = True
if hgfiles != gitfiles:
failed = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment