Patchwork [2,of,5] largefiles: replace use of walkchangerevs() with simple revset query

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 13, 2020, 10:24 a.m.
Message ID <acbf9e91f2f55202fe35.1599992652@mimosa>
Download mbox | patch
Permalink /patch/47150/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 13, 2020, 10:24 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1599986599 -32400
#      Sun Sep 13 17:43:19 2020 +0900
# Node ID acbf9e91f2f55202fe35f6a814cdf36744f966b9
# Parent  ff5371cc36edbe4bce8f0bb8514763ced1c8da6e
largefiles: replace use of walkchangerevs() with simple revset query

Since it does nothing in prepare(), what we're doing is just walking
revisions matching ".hglf" in reverse order.

Patch

diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py
+++ b/hgext/largefiles/lfcommands.py
@@ -486,15 +486,11 @@  def cachelfiles(ui, repo, node, filelist
 
 
 def downloadlfiles(ui, repo):
-    match = scmutil.match(repo[None], [repo.wjoin(lfutil.shortname)], {})
-
-    def prepare(ctx, fns):
-        pass
-
+    tonode = repo.changelog.node
     totalsuccess = 0
     totalmissing = 0
-    for ctx in cmdutil.walkchangerevs(repo, match, {b'rev': None}, prepare):
-        success, missing = cachelfiles(ui, repo, ctx.node())
+    for rev in repo.revs(b'reverse(file(%s))', b'path:' + lfutil.shortname):
+        success, missing = cachelfiles(ui, repo, tonode(rev))
         totalsuccess += len(success)
         totalmissing += len(missing)
     ui.status(_(b"%d additional largefiles cached\n") % totalsuccess)