Show More
@@ -351,12 +351,10 b' class convert_mercurial:' | |||||
351 | return [ hg.hex(x) for x in h ] |
|
351 | return [ hg.hex(x) for x in h ] | |
352 |
|
352 | |||
353 | def putfile(self, f, e, data): |
|
353 | def putfile(self, f, e, data): | |
354 |
self.repo.w |
|
354 | self.repo.wwrite(f, data, e and 'x' or '') | |
355 | if self.repo.dirstate.state(f) == '?': |
|
355 | if self.repo.dirstate.state(f) == '?': | |
356 | self.repo.dirstate.update([f], "a") |
|
356 | self.repo.dirstate.update([f], "a") | |
357 |
|
357 | |||
358 | util.set_exec(self.repo.wjoin(f), e) |
|
|||
359 |
|
||||
360 | def delfile(self, f): |
|
358 | def delfile(self, f): | |
361 | try: |
|
359 | try: | |
362 | os.unlink(self.repo.wjoin(f)) |
|
360 | os.unlink(self.repo.wjoin(f)) |
@@ -505,9 +505,19 b' class localrepository(repo.repository):' | |||||
505 | data = self.wopener(filename, 'r').read() |
|
505 | data = self.wopener(filename, 'r').read() | |
506 | return self._filter("encode", filename, data) |
|
506 | return self._filter("encode", filename, data) | |
507 |
|
507 | |||
508 | def wwrite(self, filename, data): |
|
508 | def wwrite(self, filename, data, flags): | |
509 | data = self._filter("decode", filename, data) |
|
509 | data = self._filter("decode", filename, data) | |
510 | return self.wopener(filename, 'w').write(data) |
|
510 | if "l" in flags: | |
|
511 | os.unlink(self.wjoin(filename)) | |||
|
512 | os.symlink(data, self.wjoin(filename)) | |||
|
513 | else: | |||
|
514 | try: | |||
|
515 | if self._link(filename): | |||
|
516 | os.unlink(self.wjoin(filename)) | |||
|
517 | except OSError: | |||
|
518 | pass | |||
|
519 | self.wopener(filename, 'w').write(data) | |||
|
520 | util.set_exec(self.wjoin(filename), "x" in flags) | |||
511 |
|
521 | |||
512 | def wwritedata(self, filename, data): |
|
522 | def wwritedata(self, filename, data): | |
513 | return self._filter("decode", filename, data) |
|
523 | return self._filter("decode", filename, data) | |
@@ -971,8 +981,7 b' class localrepository(repo.repository):' | |||||
971 | self.ui.warn("%s not removed!\n" % f) |
|
981 | self.ui.warn("%s not removed!\n" % f) | |
972 | else: |
|
982 | else: | |
973 | t = self.file(f).read(m[f]) |
|
983 | t = self.file(f).read(m[f]) | |
974 | self.wwrite(f, t) |
|
984 | self.wwrite(f, t, m.flags(f)) | |
975 | util.set_exec(self.wjoin(f), m.execf(f)) |
|
|||
976 | self.dirstate.update([f], "n") |
|
985 | self.dirstate.update([f], "n") | |
977 |
|
986 | |||
978 | def copy(self, source, dest, wlock=None): |
|
987 | def copy(self, source, dest, wlock=None): |
@@ -346,7 +346,7 b' def applyupdates(repo, action, wctx, mct' | |||||
346 | merged += 1 |
|
346 | merged += 1 | |
347 | if f != fd: |
|
347 | if f != fd: | |
348 | repo.ui.debug(_("copying %s to %s\n") % (f, fd)) |
|
348 | repo.ui.debug(_("copying %s to %s\n") % (f, fd)) | |
349 | repo.wwrite(fd, repo.wread(f)) |
|
349 | repo.wwrite(fd, repo.wread(f), flag and 'x' or '') | |
350 | if move: |
|
350 | if move: | |
351 | repo.ui.debug(_("removing %s\n") % f) |
|
351 | repo.ui.debug(_("removing %s\n") % f) | |
352 | os.unlink(repo.wjoin(f)) |
|
352 | os.unlink(repo.wjoin(f)) | |
@@ -355,22 +355,19 b' def applyupdates(repo, action, wctx, mct' | |||||
355 | flag = a[2] |
|
355 | flag = a[2] | |
356 | repo.ui.note(_("getting %s\n") % f) |
|
356 | repo.ui.note(_("getting %s\n") % f) | |
357 | t = mctx.filectx(f).data() |
|
357 | t = mctx.filectx(f).data() | |
358 | repo.wwrite(f, t) |
|
358 | repo.wwrite(f, t, flag and 'x' or '') | |
359 | util.set_exec(repo.wjoin(f), flag) |
|
|||
360 | updated += 1 |
|
359 | updated += 1 | |
361 | elif m == "d": # directory rename |
|
360 | elif m == "d": # directory rename | |
362 | f2, fd, flag = a[2:] |
|
361 | f2, fd, flag = a[2:] | |
363 | if f: |
|
362 | if f: | |
364 | repo.ui.note(_("moving %s to %s\n") % (f, fd)) |
|
363 | repo.ui.note(_("moving %s to %s\n") % (f, fd)) | |
365 | t = wctx.filectx(f).data() |
|
364 | t = wctx.filectx(f).data() | |
366 | repo.wwrite(fd, t) |
|
365 | repo.wwrite(fd, t, flag and 'x' or '') | |
367 | util.set_exec(repo.wjoin(fd), flag) |
|
|||
368 | util.unlink(repo.wjoin(f)) |
|
366 | util.unlink(repo.wjoin(f)) | |
369 | if f2: |
|
367 | if f2: | |
370 | repo.ui.note(_("getting %s to %s\n") % (f2, fd)) |
|
368 | repo.ui.note(_("getting %s to %s\n") % (f2, fd)) | |
371 | t = mctx.filectx(f2).data() |
|
369 | t = mctx.filectx(f2).data() | |
372 | repo.wwrite(fd, t) |
|
370 | repo.wwrite(fd, t, flag and 'x' or '') | |
373 | util.set_exec(repo.wjoin(fd), flag) |
|
|||
374 | updated += 1 |
|
371 | updated += 1 | |
375 | elif m == "e": # exec |
|
372 | elif m == "e": # exec | |
376 | flag = a[2] |
|
373 | flag = a[2] |
@@ -377,8 +377,9 b' def updatedir(ui, repo, patches, wlock=N' | |||||
377 | dst = os.path.join(repo.root, gp.path) |
|
377 | dst = os.path.join(repo.root, gp.path) | |
378 | # patch won't create empty files |
|
378 | # patch won't create empty files | |
379 | if ctype == 'ADD' and not os.path.exists(dst): |
|
379 | if ctype == 'ADD' and not os.path.exists(dst): | |
380 | repo.wwrite(gp.path, '') |
|
380 | repo.wwrite(gp.path, '', x and 'x' or '') | |
381 |
|
|
381 | else: | |
|
382 | util.set_exec(dst, x) | |||
382 | cmdutil.addremove(repo, cfiles, wlock=wlock) |
|
383 | cmdutil.addremove(repo, cfiles, wlock=wlock) | |
383 | files = patches.keys() |
|
384 | files = patches.keys() | |
384 | files.extend([r for r in removes if r not in files]) |
|
385 | files.extend([r for r in removes if r not in files]) |
General Comments 0
You need to be logged in to leave comments.
Login now