largefiles: add a 'debuglfput' command to put largefile into the store
authorBoris Feld <boris.feld@octobus.net>
Thu, 21 Dec 2017 13:53:26 +0100
changeset 35563 4aa6ed598323
parent 35562 6580cf751418
child 35564 cf841f2b5a72
largefiles: add a 'debuglfput' command to put largefile into the store We add a new debug command able to add arbitrary new files into the largefile store. This will be useful for debugging, testing and other unholy usecase.
hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py	Fri Dec 15 09:30:16 2017 +0100
+++ b/hgext/largefiles/lfcommands.py	Thu Dec 21 13:53:26 2017 +0100
@@ -593,3 +593,12 @@
         (cached, missing) = cachelfiles(ui, repo, rev)
         numcached += len(cached)
     ui.status(_("%d largefiles cached\n") % numcached)
+
+@command('debuglfput',
+    [] + cmdutil.remoteopts,
+    _('FILE'))
+def debuglfput(ui, repo, filepath, **kwargs):
+    hash = lfutil.hashfile(filepath)
+    storefactory.openstore(repo).put(filepath, hash)
+    ui.write('%s\n' % hash)
+    return 0