Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 29367:4e6e280e238f
doc: describe detail about checkambig optional argument
This is followup for patches below, which add checkambig argument to
existing function.
- 731ced087a4b
- 76f1ea360c7e
- ce2d81aafbae
- a109bf7e0dc2
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 13 Jun 2016 05:11:56 +0900 |
parents | 0d83ad967bf8 |
children | 36fbd72c2f39 |
comparison
equal
deleted
inserted
replaced
29366:d269e7db2f55 | 29367:4e6e280e238f |
---|---|
377 | 377 |
378 def readlock(self, path): | 378 def readlock(self, path): |
379 return util.readlock(self.join(path)) | 379 return util.readlock(self.join(path)) |
380 | 380 |
381 def rename(self, src, dst, checkambig=False): | 381 def rename(self, src, dst, checkambig=False): |
382 """Rename from src to dst | |
383 | |
384 checkambig argument is used with util.filestat, and is useful | |
385 only if destination file is guarded by any lock | |
386 (e.g. repo.lock or repo.wlock). | |
387 """ | |
382 dstpath = self.join(dst) | 388 dstpath = self.join(dst) |
383 oldstat = checkambig and util.filestat(dstpath) | 389 oldstat = checkambig and util.filestat(dstpath) |
384 if oldstat and oldstat.stat: | 390 if oldstat and oldstat.stat: |
385 ret = util.rename(self.join(src), dstpath) | 391 ret = util.rename(self.join(src), dstpath) |
386 newstat = util.filestat(dstpath) | 392 newstat = util.filestat(dstpath) |
531 active duration and are therefore free of race conditions between | 537 active duration and are therefore free of race conditions between |
532 closing a file on a background thread and reopening it. (If the | 538 closing a file on a background thread and reopening it. (If the |
533 file were opened multiple times, there could be unflushed data | 539 file were opened multiple times, there could be unflushed data |
534 because the original file handle hasn't been flushed/closed yet.) | 540 because the original file handle hasn't been flushed/closed yet.) |
535 | 541 |
536 ``checkambig`` is passed to atomictempfile (valid only for writing). | 542 ``checkambig`` argument is passed to atomictemplfile (valid |
543 only for writing), and is useful only if target file is | |
544 guarded by any lock (e.g. repo.lock or repo.wlock). | |
537 ''' | 545 ''' |
538 if self._audit: | 546 if self._audit: |
539 r = util.checkosfilename(path) | 547 r = util.checkosfilename(path) |
540 if r: | 548 if r: |
541 raise error.Abort("%s: %r" % (r, path)) | 549 raise error.Abort("%s: %r" % (r, path)) |