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