Show More
@@ -137,8 +137,11 b' def reposetup(ui, repo):' | |||
|
137 | 137 | # Create a copy of match that matches standins instead |
|
138 | 138 | # of largefiles. |
|
139 | 139 | def tostandin(file): |
|
140 | if inctx(lfutil.standin(file), ctx2): | |
|
141 |
|
|
|
140 | if working: | |
|
141 | sf = lfutil.standin(file) | |
|
142 | dirstate = repo.dirstate | |
|
143 | if sf in dirstate or sf in dirstate.dirs(): | |
|
144 | return sf | |
|
142 | 145 | return file |
|
143 | 146 | |
|
144 | 147 | # Create a function that we can use to override what is |
@@ -167,8 +170,12 b' def reposetup(ui, repo):' | |||
|
167 | 170 | origignore = lfdirstate._ignore |
|
168 | 171 | lfdirstate._ignore = _ignoreoverride |
|
169 | 172 | |
|
170 | match._files = [f for f in match._files if f in | |
|
171 |
|
|
|
173 | def sfindirstate(f): | |
|
174 | sf = lfutil.standin(f) | |
|
175 | dirstate = repo.dirstate | |
|
176 | return sf in dirstate or sf in dirstate.dirs() | |
|
177 | match._files = [f for f in match._files | |
|
178 | if sfindirstate(f)] | |
|
172 | 179 | # Don't waste time getting the ignored and unknown |
|
173 | 180 | # files again; we already have them |
|
174 | 181 | s = lfdirstate.status(match, [], False, |
@@ -557,15 +557,18 b' def restorestatus(repo):' | |||
|
557 | 557 | |
|
558 | 558 | def abort(repo, originalwd, target, state): |
|
559 | 559 | 'Restore the repository to its original state' |
|
560 | descendants = repo.changelog.descendants | |
|
561 | ispublic = lambda r: repo._phaserev[r] == phases.public | |
|
562 | if filter(ispublic, descendants(target)): | |
|
560 | dstates = [s for s in state.values() if s != nullrev] | |
|
561 | if [d for d in dstates if not repo[d].mutable()]: | |
|
563 | 562 | repo.ui.warn(_("warning: immutable rebased changeset detected, " |
|
564 | 563 | "can't abort\n")) |
|
565 | 564 | return -1 |
|
566 | elif set(descendants(target)) - set(state.values()): | |
|
565 | ||
|
566 | descendants = set() | |
|
567 | if dstates: | |
|
568 | descendants = set(repo.changelog.descendants(*dstates)) | |
|
569 | if descendants - set(dstates): | |
|
567 | 570 | repo.ui.warn(_("warning: new changesets detected on target branch, " |
|
568 |
|
|
|
571 | "can't abort\n")) | |
|
569 | 572 | return -1 |
|
570 | 573 | else: |
|
571 | 574 | # Strip from the first rebased revision |
@@ -285,6 +285,16 b' def copy(ui, repo, pats, opts, rename=Fa' | |||
|
285 | 285 | |
|
286 | 286 | # check for overwrites |
|
287 | 287 | exists = os.path.lexists(target) |
|
288 | samefile = False | |
|
289 | if exists and abssrc != abstarget: | |
|
290 | if (repo.dirstate.normalize(abssrc) == | |
|
291 | repo.dirstate.normalize(abstarget)): | |
|
292 | if not rename: | |
|
293 | ui.warn(_("%s: can't copy - same file\n") % reltarget) | |
|
294 | return | |
|
295 | exists = False | |
|
296 | samefile = True | |
|
297 | ||
|
288 | 298 | if not after and exists or after and state in 'mn': |
|
289 | 299 | if not opts['force']: |
|
290 | 300 | ui.warn(_('%s: not overwriting - file exists\n') % |
@@ -307,7 +317,12 b' def copy(ui, repo, pats, opts, rename=Fa' | |||
|
307 | 317 | targetdir = os.path.dirname(target) or '.' |
|
308 | 318 | if not os.path.isdir(targetdir): |
|
309 | 319 | os.makedirs(targetdir) |
|
310 |
|
|
|
320 | if samefile: | |
|
321 | tmp = target + "~hgrename" | |
|
322 | os.rename(src, tmp) | |
|
323 | os.rename(tmp, target) | |
|
324 | else: | |
|
325 | util.copyfile(src, target) | |
|
311 | 326 | srcexists = True |
|
312 | 327 | except IOError, inst: |
|
313 | 328 | if inst.errno == errno.ENOENT: |
@@ -330,7 +345,7 b' def copy(ui, repo, pats, opts, rename=Fa' | |||
|
330 | 345 | scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget, |
|
331 | 346 | dryrun=dryrun, cwd=cwd) |
|
332 | 347 | if rename and not dryrun: |
|
333 | if not after and srcexists: | |
|
348 | if not after and srcexists and not samefile: | |
|
334 | 349 | util.unlinkpath(repo.wjoin(abssrc)) |
|
335 | 350 | wctx.forget([abssrc]) |
|
336 | 351 |
@@ -68,6 +68,8 b' Commit preserved largefile contents.' | |||
|
68 | 68 | Remove both largefiles and normal files. |
|
69 | 69 | |
|
70 | 70 | $ hg remove normal1 large1 |
|
71 | $ hg status large1 | |
|
72 | R large1 | |
|
71 | 73 | $ hg commit -m "remove files" |
|
72 | 74 | Invoking status precommit hook |
|
73 | 75 | R large1 |
@@ -249,6 +251,13 b' Corner cases for adding largefiles.' | |||
|
249 | 251 | A sub2/large6 |
|
250 | 252 | A sub2/large7 |
|
251 | 253 | |
|
254 | Test "hg status" with combination of 'file pattern' and 'directory | |
|
255 | pattern' for largefiles: | |
|
256 | ||
|
257 | $ hg status sub2/large6 sub2 | |
|
258 | A sub2/large6 | |
|
259 | A sub2/large7 | |
|
260 | ||
|
252 | 261 | Config settings (pattern **.dat, minsize 2 MB) are respected. |
|
253 | 262 | |
|
254 | 263 | $ echo testdata > test.dat |
General Comments 0
You need to be logged in to leave comments.
Login now