diff --git a/hgext/relink.py b/hgext/relink.py index 412a6e749f8d4cb483d3ec93edddfb88c805da9d_aGdleHQvcmVsaW5rLnB5..9011036ba79dfb1db741ca7fc7627fecce4e179f_aGdleHQvcmVsaW5rLnB5 100644 --- a/hgext/relink.py +++ b/hgext/relink.py @@ -48,7 +48,7 @@ try: remotelock = src.lock() try: - candidates = sorted(collect(src.store.path, ui)) + candidates = sorted(collect(src, ui)) targets = prune(candidates, src.store.path, repo.store.path, ui) do_relink(src.store.path, repo.store.path, targets, ui) finally: @@ -59,6 +59,18 @@ def collect(src, ui): seplen = len(os.path.sep) candidates = [] + live = len(src['tip'].manifest()) + # Your average repository has some files which were deleted before + # the tip revision. We account for that by assuming that there are + # 3 tracked files for every 2 live files as of the tip version of + # the repository. + # + # mozilla-central as of 2010-06-10 had a ratio of just over 7:5. + total = live * 3 // 2 + src = src.store.path + pos = 0 + ui.status(_("tip has %d files, estimated total number of files: %s\n") + % (live, total)) for dirpath, dirnames, filenames in os.walk(src): relpath = dirpath[len(src) + seplen:] for filename in filenames: @@ -67,4 +79,5 @@ st = os.stat(os.path.join(dirpath, filename)) if not stat.S_ISREG(st.st_mode): continue + pos += 1 candidates.append((os.path.join(relpath, filename), st)) @@ -70,2 +83,3 @@ candidates.append((os.path.join(relpath, filename), st)) + ui.progress(_('collecting'), pos, filename, _('files'), total) @@ -71,4 +85,5 @@ + ui.progress(_('collecting'), None) ui.status(_('collected %d candidate storage files\n') % len(candidates)) return candidates diff --git a/tests/test-relink.out b/tests/test-relink.out index 412a6e749f8d4cb483d3ec93edddfb88c805da9d_dGVzdHMvdGVzdC1yZWxpbmsub3V0..9011036ba79dfb1db741ca7fc7627fecce4e179f_dGVzdHMvdGVzdC1yZWxpbmsub3V0 100644 --- a/tests/test-relink.out +++ b/tests/test-relink.out @@ -12,6 +12,12 @@ created new head % relink relinking .hg/store +tip has 2 files, estimated total number of files: 3 +collecting: 00changelog.i 1/3 files (33.33%) +collecting: 00manifest.i 2/3 files (66.67%) +collecting: dummy.i 3/3 files (100.00%) +collecting: b.i 4/3 files (133.33%) +collecting: a.i 5/3 files (166.67%) collected 5 candidate storage files not linkable: 00changelog.i not linkable: 00manifest.i