Show More
@@ -85,7 +85,7 def restorematchandpatsfn(): | |||||
85 | scmutil.matchandpats = getattr(scmutil.matchandpats, 'oldmatchandpats', |
|
85 | scmutil.matchandpats = getattr(scmutil.matchandpats, 'oldmatchandpats', | |
86 | scmutil.matchandpats) |
|
86 | scmutil.matchandpats) | |
87 |
|
87 | |||
88 | def addlargefiles(ui, repo, matcher, **opts): |
|
88 | def addlargefiles(ui, repo, isaddremove, matcher, **opts): | |
89 | large = opts.pop('large', None) |
|
89 | large = opts.pop('large', None) | |
90 | lfsize = lfutil.getminsize( |
|
90 | lfsize = lfutil.getminsize( | |
91 | ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None)) |
|
91 | ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None)) | |
@@ -106,11 +106,17 def addlargefiles(ui, repo, matcher, **o | |||||
106 | nfile = f in wctx |
|
106 | nfile = f in wctx | |
107 | exists = lfile or nfile |
|
107 | exists = lfile or nfile | |
108 |
|
108 | |||
|
109 | # addremove in core gets fancy with the name, add doesn't | |||
|
110 | if isaddremove: | |||
|
111 | name = m.uipath(f) | |||
|
112 | else: | |||
|
113 | name = m.rel(f) | |||
|
114 | ||||
109 | # Don't warn the user when they attempt to add a normal tracked file. |
|
115 | # Don't warn the user when they attempt to add a normal tracked file. | |
110 | # The normal add code will do that for us. |
|
116 | # The normal add code will do that for us. | |
111 | if exact and exists: |
|
117 | if exact and exists: | |
112 | if lfile: |
|
118 | if lfile: | |
113 |
ui.warn(_('%s already a largefile\n') % |
|
119 | ui.warn(_('%s already a largefile\n') % name) | |
114 | continue |
|
120 | continue | |
115 |
|
121 | |||
116 | if (exact or not exists) and not lfutil.isstandin(f): |
|
122 | if (exact or not exists) and not lfutil.isstandin(f): | |
@@ -124,7 +130,7 def addlargefiles(ui, repo, matcher, **o | |||||
124 | if large or abovemin or (lfmatcher and lfmatcher(f)): |
|
130 | if large or abovemin or (lfmatcher and lfmatcher(f)): | |
125 | lfnames.append(f) |
|
131 | lfnames.append(f) | |
126 | if ui.verbose or not exact: |
|
132 | if ui.verbose or not exact: | |
127 |
ui.status(_('adding %s as a largefile\n') % m |
|
133 | ui.status(_('adding %s as a largefile\n') % name) | |
128 |
|
134 | |||
129 | bad = [] |
|
135 | bad = [] | |
130 |
|
136 | |||
@@ -241,7 +247,7 def overrideadd(orig, ui, repo, *pats, * | |||||
241 | raise util.Abort(_('--normal cannot be used with --large')) |
|
247 | raise util.Abort(_('--normal cannot be used with --large')) | |
242 | return orig(ui, repo, *pats, **opts) |
|
248 | return orig(ui, repo, *pats, **opts) | |
243 | matcher = scmutil.match(repo[None], pats, opts) |
|
249 | matcher = scmutil.match(repo[None], pats, opts) | |
244 | bad = addlargefiles(ui, repo, matcher, **opts) |
|
250 | bad = addlargefiles(ui, repo, False, matcher, **opts) | |
245 | installnormalfilesmatchfn(repo[None].manifest()) |
|
251 | installnormalfilesmatchfn(repo[None].manifest()) | |
246 | result = orig(ui, repo, *pats, **opts) |
|
252 | result = orig(ui, repo, *pats, **opts) | |
247 | restorematchfn() |
|
253 | restorematchfn() | |
@@ -1124,7 +1130,7 def scmutiladdremove(orig, repo, matcher | |||||
1124 | removelargefiles(repo.ui, repo, True, m, **opts) |
|
1130 | removelargefiles(repo.ui, repo, True, m, **opts) | |
1125 | # Call into the normal add code, and any files that *should* be added as |
|
1131 | # Call into the normal add code, and any files that *should* be added as | |
1126 | # largefiles will be |
|
1132 | # largefiles will be | |
1127 | addlargefiles(repo.ui, repo, matcher, **opts) |
|
1133 | addlargefiles(repo.ui, repo, True, matcher, **opts) | |
1128 | # Now that we've handled largefiles, hand off to the original addremove |
|
1134 | # Now that we've handled largefiles, hand off to the original addremove | |
1129 | # function to take care of the rest. Make sure it doesn't do anything with |
|
1135 | # function to take care of the rest. Make sure it doesn't do anything with | |
1130 | # largefiles by passing a matcher that will ignore them. |
|
1136 | # largefiles by passing a matcher that will ignore them. |
@@ -291,7 +291,7 Add a normal file to the subrepo, then t | |||||
291 | ? subrepo/renamed-large.txt |
|
291 | ? subrepo/renamed-large.txt | |
292 |
|
292 | |||
293 | $ hg -R statusmatch addremove --dry-run -S |
|
293 | $ hg -R statusmatch addremove --dry-run -S | |
294 |
adding |
|
294 | adding large.dat as a largefile | |
295 | removing subrepo/large.txt |
|
295 | removing subrepo/large.txt | |
296 | adding subrepo/normal.txt |
|
296 | adding subrepo/normal.txt | |
297 | adding subrepo/renamed-large.txt |
|
297 | adding subrepo/renamed-large.txt |
@@ -493,7 +493,7 Test addremove with -R | |||||
493 | $ cd .. |
|
493 | $ cd .. | |
494 | $ hg -R a -v addremove |
|
494 | $ hg -R a -v addremove | |
495 | removing sub/large4 |
|
495 | removing sub/large4 | |
496 |
adding |
|
496 | adding testaddremove.dat as a largefile | |
497 | removing normal3 |
|
497 | removing normal3 | |
498 | adding normaladdremove |
|
498 | adding normaladdremove | |
499 | $ cd a |
|
499 | $ cd a | |
@@ -1731,7 +1731,7 coexist. | |||||
1731 | $ rm sub2/large7 |
|
1731 | $ rm sub2/large7 | |
1732 | $ echo "largeasnormal" > sub2/large7 |
|
1732 | $ echo "largeasnormal" > sub2/large7 | |
1733 | $ hg add sub2/large7 |
|
1733 | $ hg add sub2/large7 | |
1734 | sub2/large7 already a largefile |
|
1734 | sub2/large7 already a largefile (glob) | |
1735 |
|
1735 | |||
1736 | Test that transplanting a largefile change works correctly. |
|
1736 | Test that transplanting a largefile change works correctly. | |
1737 |
|
1737 |
General Comments 0
You need to be logged in to leave comments.
Login now