##// END OF EJS Templates
largefiles: use "outgoinghooks" to avoid redundant outgoing check...
FUJIWARA Katsunori -
r21052:cde32cb5 default
parent child Browse files
Show More
@@ -1005,23 +1005,19 def getoutgoinglfiles(ui, repo, dest=Non
1005 lfutil.getlfilestoupload(repo, o, lambda fn, lfhash: toupload.add(fn))
1005 lfutil.getlfilestoupload(repo, o, lambda fn, lfhash: toupload.add(fn))
1006 return sorted(toupload)
1006 return sorted(toupload)
1007
1007
1008 def overrideoutgoing(orig, ui, repo, dest=None, **opts):
1008 def outgoinghook(ui, repo, other, opts, missing):
1009 result = orig(ui, repo, dest, **opts)
1010
1011 if opts.pop('large', None):
1009 if opts.pop('large', None):
1012 toupload = getoutgoinglfiles(ui, repo, dest, **opts)
1010 toupload = set()
1013 if toupload is None:
1011 lfutil.getlfilestoupload(repo, missing,
1014 ui.status(_('largefiles: No remote repo\n'))
1012 lambda fn, lfhash: toupload.add(fn))
1015 elif not toupload:
1013 if not toupload:
1016 ui.status(_('largefiles: no files to upload\n'))
1014 ui.status(_('largefiles: no files to upload\n'))
1017 else:
1015 else:
1018 ui.status(_('largefiles to upload:\n'))
1016 ui.status(_('largefiles to upload:\n'))
1019 for file in toupload:
1017 for file in sorted(toupload):
1020 ui.status(lfutil.splitstandin(file) + '\n')
1018 ui.status(lfutil.splitstandin(file) + '\n')
1021 ui.status('\n')
1019 ui.status('\n')
1022
1020
1023 return result
1024
1025 def summaryremotehook(ui, repo, opts, changes):
1021 def summaryremotehook(ui, repo, opts, changes):
1026 largeopt = opts.get('large', False)
1022 largeopt = opts.get('large', False)
1027 if changes is None:
1023 if changes is None:
@@ -65,10 +65,11 def uisetup(ui):
65 debugstateopt = [('', 'large', None, _('display largefiles dirstate'))]
65 debugstateopt = [('', 'large', None, _('display largefiles dirstate'))]
66 entry[1].extend(debugstateopt)
66 entry[1].extend(debugstateopt)
67
67
68 entry = extensions.wrapcommand(commands.table, 'outgoing',
68 outgoing = lambda orgfunc, *arg, **kwargs: orgfunc(*arg, **kwargs)
69 overrides.overrideoutgoing)
69 entry = extensions.wrapcommand(commands.table, 'outgoing', outgoing)
70 outgoingopt = [('', 'large', None, _('display outgoing largefiles'))]
70 outgoingopt = [('', 'large', None, _('display outgoing largefiles'))]
71 entry[1].extend(outgoingopt)
71 entry[1].extend(outgoingopt)
72 cmdutil.outgoinghooks.add('largefiles', overrides.outgoinghook)
72 entry = extensions.wrapcommand(commands.table, 'summary',
73 entry = extensions.wrapcommand(commands.table, 'summary',
73 overrides.overridesummary)
74 overrides.overridesummary)
74 summaryopt = [('', 'large', None, _('display outgoing largefiles'))]
75 summaryopt = [('', 'large', None, _('display outgoing largefiles'))]
@@ -703,7 +703,6 Test that outgoing --large works (with r
703 date: Thu Jan 01 00:00:00 1970 +0000
703 date: Thu Jan 01 00:00:00 1970 +0000
704 summary: this used to not notice the rm
704 summary: this used to not notice the rm
705
705
706 searching for changes
707 largefiles to upload:
706 largefiles to upload:
708 foo
707 foo
709 large
708 large
@@ -2154,10 +2153,15 check messages when there is no files to
2154 comparing with $TESTTMP/issue3651/src (glob)
2153 comparing with $TESTTMP/issue3651/src (glob)
2155 searching for changes
2154 searching for changes
2156 no changes found
2155 no changes found
2157 searching for changes
2158 largefiles: no files to upload
2156 largefiles: no files to upload
2159 [1]
2157 [1]
2160
2158
2159 $ hg -R clone2 outgoing --large --graph --template "{rev}"
2160 comparing with $TESTTMP/issue3651/src (glob)
2161 searching for changes
2162 no changes found
2163 largefiles: no files to upload
2164
2161 check messages when there are files to upload:
2165 check messages when there are files to upload:
2162
2166
2163 $ echo b > clone2/b
2167 $ echo b > clone2/b
@@ -2181,7 +2185,14 check messages when there are files to u
2181 date: Thu Jan 01 00:00:00 1970 +0000
2185 date: Thu Jan 01 00:00:00 1970 +0000
2182 summary: #1
2186 summary: #1
2183
2187
2188 largefiles to upload:
2189 b
2190
2191 $ hg -R clone2 outgoing --large --graph --template "{rev}"
2192 comparing with $TESTTMP/issue3651/src
2184 searching for changes
2193 searching for changes
2194 @ 1
2195
2185 largefiles to upload:
2196 largefiles to upload:
2186 b
2197 b
2187
2198
General Comments 0
You need to be logged in to leave comments. Login now