These are cases where we need to use str, therefore we add r'' prefix.
- skip-blame because just r'' prefixes
indygreg |
hg-reviewers |
These are cases where we need to use str, therefore we add r'' prefix.
Lint Skipped |
Unit Tests Skipped |
repo._bookmarks.applychanges(repo, tr, changes) | repo._bookmarks.applychanges(repo, tr, changes) | ||||
def _findcommonincoming(orig, *args, **kwargs): | def _findcommonincoming(orig, *args, **kwargs): | ||||
common, inc, remoteheads = orig(*args, **kwargs) | common, inc, remoteheads = orig(*args, **kwargs) | ||||
return common, True, remoteheads | return common, True, remoteheads | ||||
def _push(orig, ui, repo, dest=None, *args, **opts): | def _push(orig, ui, repo, dest=None, *args, **opts): | ||||
bookmark = opts.get('bookmark') | bookmark = opts.get(r'bookmark') | ||||
# we only support pushing one infinitepush bookmark at once | # we only support pushing one infinitepush bookmark at once | ||||
if len(bookmark) == 1: | if len(bookmark) == 1: | ||||
bookmark = bookmark[0] | bookmark = bookmark[0] | ||||
else: | else: | ||||
bookmark = '' | bookmark = '' | ||||
oldphasemove = None | oldphasemove = None | ||||
overrides = {(experimental, configbookmark): bookmark} | overrides = {(experimental, configbookmark): bookmark} | ||||
with ui.configoverride(overrides, 'infinitepush'): | with ui.configoverride(overrides, 'infinitepush'): | ||||
scratchpush = opts.get('bundle_store') | scratchpush = opts.get('bundle_store') | ||||
if _scratchbranchmatcher(bookmark): | if _scratchbranchmatcher(bookmark): | ||||
scratchpush = True | scratchpush = True | ||||
# bundle2 can be sent back after push (for example, bundle2 | # bundle2 can be sent back after push (for example, bundle2 | ||||
# containing `pushkey` part to update bookmarks) | # containing `pushkey` part to update bookmarks) | ||||
ui.setconfig(experimental, 'bundle2.pushback', True) | ui.setconfig(experimental, 'bundle2.pushback', True) | ||||
if scratchpush: | if scratchpush: | ||||
# this is an infinitepush, we don't want the bookmark to be applied | # this is an infinitepush, we don't want the bookmark to be applied | ||||
# rather that should be stored in the bundlestore | # rather that should be stored in the bundlestore | ||||
opts['bookmark'] = [] | opts[r'bookmark'] = [] | ||||
ui.setconfig(experimental, configscratchpush, True) | ui.setconfig(experimental, configscratchpush, True) | ||||
oldphasemove = extensions.wrapfunction(exchange, | oldphasemove = extensions.wrapfunction(exchange, | ||||
'_localphasemove', | '_localphasemove', | ||||
_phasemove) | _phasemove) | ||||
# Copy-paste from `push` command | # Copy-paste from `push` command | ||||
path = ui.paths.getpath(dest, default=('default-push', 'default')) | path = ui.paths.getpath(dest, default=('default-push', 'default')) | ||||
if not path: | if not path: | ||||
raise error.Abort(_('default repository not configured!'), | raise error.Abort(_('default repository not configured!'), | ||||
if bundlepart: | if bundlepart: | ||||
bundler.addpart(bundlepart) | bundler.addpart(bundlepart) | ||||
# storing the bundle in the bundlestore | # storing the bundle in the bundlestore | ||||
buf = util.chunkbuffer(bundler.getchunks()) | buf = util.chunkbuffer(bundler.getchunks()) | ||||
fd, bundlefile = tempfile.mkstemp() | fd, bundlefile = tempfile.mkstemp() | ||||
try: | try: | ||||
try: | try: | ||||
fp = os.fdopen(fd, 'wb') | fp = os.fdopen(fd, r'wb') | ||||
fp.write(buf.read()) | fp.write(buf.read()) | ||||
finally: | finally: | ||||
fp.close() | fp.close() | ||||
storebundle(op, {}, bundlefile) | storebundle(op, {}, bundlefile) | ||||
finally: | finally: | ||||
try: | try: | ||||
os.unlink(bundlefile) | os.unlink(bundlefile) | ||||
except Exception: | except Exception: | ||||
bundler.addpart(bundlepart) | bundler.addpart(bundlepart) | ||||
# If commits were sent, store them | # If commits were sent, store them | ||||
if cgparams: | if cgparams: | ||||
buf = util.chunkbuffer(bundler.getchunks()) | buf = util.chunkbuffer(bundler.getchunks()) | ||||
fd, bundlefile = tempfile.mkstemp() | fd, bundlefile = tempfile.mkstemp() | ||||
try: | try: | ||||
try: | try: | ||||
fp = os.fdopen(fd, 'wb') | fp = os.fdopen(fd, r'wb') | ||||
fp.write(buf.read()) | fp.write(buf.read()) | ||||
finally: | finally: | ||||
fp.close() | fp.close() | ||||
storebundle(op, cgparams, bundlefile) | storebundle(op, cgparams, bundlefile) | ||||
finally: | finally: | ||||
try: | try: | ||||
os.unlink(bundlefile) | os.unlink(bundlefile) | ||||
except Exception: | except Exception: | ||||
cgpart = bundle2.bundlepart('changegroup', data=part.read()) | cgpart = bundle2.bundlepart('changegroup', data=part.read()) | ||||
cgpart.addparam('version', cgversion) | cgpart.addparam('version', cgversion) | ||||
bundler.addpart(cgpart) | bundler.addpart(cgpart) | ||||
buf = util.chunkbuffer(bundler.getchunks()) | buf = util.chunkbuffer(bundler.getchunks()) | ||||
fd, bundlefile = tempfile.mkstemp() | fd, bundlefile = tempfile.mkstemp() | ||||
try: | try: | ||||
try: | try: | ||||
fp = os.fdopen(fd, 'wb') | fp = os.fdopen(fd, r'wb') | ||||
fp.write(buf.read()) | fp.write(buf.read()) | ||||
finally: | finally: | ||||
fp.close() | fp.close() | ||||
storebundle(op, part.params, bundlefile) | storebundle(op, part.params, bundlefile) | ||||
finally: | finally: | ||||
try: | try: | ||||
os.unlink(bundlefile) | os.unlink(bundlefile) | ||||
except OSError as e: | except OSError as e: |
if not revision: | if not revision: | ||||
return total | return total | ||||
self._fetch(source, revision) | self._fetch(source, revision) | ||||
# Parse git's native archive command. | # Parse git's native archive command. | ||||
# This should be much faster than manually traversing the trees | # This should be much faster than manually traversing the trees | ||||
# and objects with many subprocess calls. | # and objects with many subprocess calls. | ||||
tarstream = self._gitcommand(['archive', revision], stream=True) | tarstream = self._gitcommand(['archive', revision], stream=True) | ||||
tar = tarfile.open(fileobj=tarstream, mode='r|') | tar = tarfile.open(fileobj=tarstream, mode=r'r|') | ||||
relpath = subrelpath(self) | relpath = subrelpath(self) | ||||
self.ui.progress(_('archiving (%s)') % relpath, 0, unit=_('files')) | self.ui.progress(_('archiving (%s)') % relpath, 0, unit=_('files')) | ||||
for i, info in enumerate(tar): | for i, info in enumerate(tar): | ||||
if info.isdir(): | if info.isdir(): | ||||
continue | continue | ||||
if match and not match(info.name): | if match and not match(info.name): | ||||
continue | continue | ||||
if info.issym(): | if info.issym(): |