##// END OF EJS Templates
vcs: turned some of the commands to be context_uid based. Those selected...
marcink -
r746:56295f10 default
parent child Browse files
Show More
@@ -39,7 +39,7 b' from dulwich.repo import Repo as Dulwich'
39 from dulwich.server import update_server_info
39 from dulwich.server import update_server_info
40
40
41 from vcsserver import exceptions, settings, subprocessio
41 from vcsserver import exceptions, settings, subprocessio
42 from vcsserver.utils import safe_str
42 from vcsserver.utils import safe_str, safe_int
43 from vcsserver.base import RepoFactory, obfuscate_qs
43 from vcsserver.base import RepoFactory, obfuscate_qs
44 from vcsserver.hgcompat import (
44 from vcsserver.hgcompat import (
45 hg_url as url_parser, httpbasicauthhandler, httpdigestauthhandler)
45 hg_url as url_parser, httpbasicauthhandler, httpdigestauthhandler)
@@ -128,6 +128,7 b' class GitFactory(RepoFactory):'
128
128
129
129
130 class GitRemote(object):
130 class GitRemote(object):
131 EMPTY_COMMIT = '0' * 40
131
132
132 def __init__(self, factory):
133 def __init__(self, factory):
133 self._factory = factory
134 self._factory = factory
@@ -190,15 +191,6 b' class GitRemote(object):'
190 return True
191 return True
191
192
192 @reraise_safe_exceptions
193 @reraise_safe_exceptions
193 def add_object(self, wire, content):
194 repo_init = self._factory.repo_libgit2(wire)
195 with repo_init as repo:
196 blob = objects.Blob()
197 blob.set_raw_string(content)
198 repo.object_store.add_object(blob)
199 return blob.id
200
201 @reraise_safe_exceptions
202 def assert_correct_path(self, wire):
194 def assert_correct_path(self, wire):
203 cache_on, context_uid, repo_id = self._cache_on(wire)
195 cache_on, context_uid, repo_id = self._cache_on(wire)
204 @self.region.conditional_cache_on_arguments(condition=cache_on)
196 @self.region.conditional_cache_on_arguments(condition=cache_on)
@@ -234,14 +226,14 b' class GitRemote(object):'
234 def blob_raw_length(self, wire, sha):
226 def blob_raw_length(self, wire, sha):
235 cache_on, context_uid, repo_id = self._cache_on(wire)
227 cache_on, context_uid, repo_id = self._cache_on(wire)
236 @self.region.conditional_cache_on_arguments(condition=cache_on)
228 @self.region.conditional_cache_on_arguments(condition=cache_on)
237 def _blob_raw_length(_context_uid, _repo_id, _sha):
229 def _blob_raw_length(_repo_id, _sha):
238
230
239 repo_init = self._factory.repo_libgit2(wire)
231 repo_init = self._factory.repo_libgit2(wire)
240 with repo_init as repo:
232 with repo_init as repo:
241 blob = repo[sha]
233 blob = repo[sha]
242 return blob.size
234 return blob.size
243
235
244 return _blob_raw_length(context_uid, repo_id, sha)
236 return _blob_raw_length(repo_id, sha)
245
237
246 def _parse_lfs_pointer(self, raw_content):
238 def _parse_lfs_pointer(self, raw_content):
247
239
@@ -261,20 +253,20 b' class GitRemote(object):'
261 return {}
253 return {}
262
254
263 @reraise_safe_exceptions
255 @reraise_safe_exceptions
264 def is_large_file(self, wire, sha):
256 def is_large_file(self, wire, commit_id):
265
257
266 cache_on, context_uid, repo_id = self._cache_on(wire)
258 cache_on, context_uid, repo_id = self._cache_on(wire)
267 @self.region.conditional_cache_on_arguments(condition=cache_on)
259 @self.region.conditional_cache_on_arguments(condition=cache_on)
268 def _is_large_file(_context_uid, _repo_id, _sha):
260 def _is_large_file(_repo_id, _sha):
269 repo_init = self._factory.repo_libgit2(wire)
261 repo_init = self._factory.repo_libgit2(wire)
270 with repo_init as repo:
262 with repo_init as repo:
271 blob = repo[sha]
263 blob = repo[commit_id]
272 if blob.is_binary:
264 if blob.is_binary:
273 return {}
265 return {}
274
266
275 return self._parse_lfs_pointer(blob.data)
267 return self._parse_lfs_pointer(blob.data)
276
268
277 return _is_large_file(context_uid, repo_id, sha)
269 return _is_large_file(repo_id, commit_id)
278
270
279 @reraise_safe_exceptions
271 @reraise_safe_exceptions
280 def in_largefiles_store(self, wire, oid):
272 def in_largefiles_store(self, wire, oid):
@@ -310,7 +302,7 b' class GitRemote(object):'
310 def bulk_request(self, wire, rev, pre_load):
302 def bulk_request(self, wire, rev, pre_load):
311 cache_on, context_uid, repo_id = self._cache_on(wire)
303 cache_on, context_uid, repo_id = self._cache_on(wire)
312 @self.region.conditional_cache_on_arguments(condition=cache_on)
304 @self.region.conditional_cache_on_arguments(condition=cache_on)
313 def _bulk_request(_context_uid, _repo_id, _rev, _pre_load):
305 def _bulk_request(_repo_id, _rev, _pre_load):
314 result = {}
306 result = {}
315 for attr in pre_load:
307 for attr in pre_load:
316 try:
308 try:
@@ -322,7 +314,7 b' class GitRemote(object):'
322 "Unknown bulk attribute: %s" % attr)
314 "Unknown bulk attribute: %s" % attr)
323 return result
315 return result
324
316
325 return _bulk_request(context_uid, repo_id, rev, sorted(pre_load))
317 return _bulk_request(repo_id, rev, sorted(pre_load))
326
318
327 def _build_opener(self, url):
319 def _build_opener(self, url):
328 handlers = []
320 handlers = []
@@ -437,6 +429,15 b' class GitRemote(object):'
437
429
438 return _commit_branches(context_uid, repo_id, commit_id)
430 return _commit_branches(context_uid, repo_id, commit_id)
439
431
432 @reraise_safe_exceptions
433 def add_object(self, wire, content):
434 repo_init = self._factory.repo_libgit2(wire)
435 with repo_init as repo:
436 blob = objects.Blob()
437 blob.set_raw_string(content)
438 repo.object_store.add_object(blob)
439 return blob.id
440
440 # TODO: this is quite complex, check if that can be simplified
441 # TODO: this is quite complex, check if that can be simplified
441 @reraise_safe_exceptions
442 @reraise_safe_exceptions
442 def commit(self, wire, commit_data, branch, commit_tree, updated, removed):
443 def commit(self, wire, commit_data, branch, commit_tree, updated, removed):
@@ -783,40 +784,70 b' class GitRemote(object):'
783 return _revision(context_uid, repo_id, rev)
784 return _revision(context_uid, repo_id, rev)
784
785
785 @reraise_safe_exceptions
786 @reraise_safe_exceptions
786 def date(self, wire, rev):
787 def date(self, wire, commit_id):
787 repo_init = self._factory.repo_libgit2(wire)
788 cache_on, context_uid, repo_id = self._cache_on(wire)
788 with repo_init as repo:
789 @self.region.conditional_cache_on_arguments(condition=cache_on)
789 commit = repo[rev]
790 def _date(_repo_id, _commit_id):
790 # TODO(marcink): check dulwich difference of offset vs timezone
791 repo_init = self._factory.repo_libgit2(wire)
791 return [commit.commit_time, commit.commit_time_offset]
792 with repo_init as repo:
793 commit = repo[commit_id]
794 # TODO(marcink): check dulwich difference of offset vs timezone
795 return [commit.commit_time, commit.commit_time_offset]
796 return _date(repo_id, commit_id)
797
798 @reraise_safe_exceptions
799 def author(self, wire, commit_id):
800 cache_on, context_uid, repo_id = self._cache_on(wire)
801 @self.region.conditional_cache_on_arguments(condition=cache_on)
802 def _author(_repo_id, _commit_id):
803 repo_init = self._factory.repo_libgit2(wire)
804 with repo_init as repo:
805 commit = repo[commit_id]
806 if commit.author.email:
807 return u"{} <{}>".format(commit.author.name, commit.author.email)
808
809 return u"{}".format(commit.author.raw_name)
810 return _author(repo_id, commit_id)
792
811
793 @reraise_safe_exceptions
812 @reraise_safe_exceptions
794 def author(self, wire, rev):
813 def message(self, wire, commit_id):
795 repo_init = self._factory.repo_libgit2(wire)
814 cache_on, context_uid, repo_id = self._cache_on(wire)
796 with repo_init as repo:
815 @self.region.conditional_cache_on_arguments(condition=cache_on)
797 commit = repo[rev]
816 def _message(_repo_id, _commit_id):
798 if commit.author.email:
817 repo_init = self._factory.repo_libgit2(wire)
799 return u"{} <{}>".format(commit.author.name, commit.author.email)
818 with repo_init as repo:
800
819 commit = repo[commit_id]
801 return u"{}".format(commit.author.raw_name)
820 return commit.message
821 return _message(repo_id, commit_id)
802
822
803 @reraise_safe_exceptions
823 @reraise_safe_exceptions
804 def message(self, wire, rev):
824 def parents(self, wire, commit_id):
805 repo_init = self._factory.repo_libgit2(wire)
825 cache_on, context_uid, repo_id = self._cache_on(wire)
806 with repo_init as repo:
826 @self.region.conditional_cache_on_arguments(condition=cache_on)
807 commit = repo[rev]
827 def _parents(_repo_id, _commit_id):
808 return commit.message
828 repo_init = self._factory.repo_libgit2(wire)
829 with repo_init as repo:
830 commit = repo[commit_id]
831 return [x.hex for x in commit.parent_ids]
832 return _parents(repo_id, commit_id)
809
833
810 @reraise_safe_exceptions
834 @reraise_safe_exceptions
811 def parents(self, wire, rev):
835 def children(self, wire, commit_id):
812 cache_on, context_uid, repo_id = self._cache_on(wire)
836 cache_on, context_uid, repo_id = self._cache_on(wire)
813 @self.region.conditional_cache_on_arguments(condition=cache_on)
837 @self.region.conditional_cache_on_arguments(condition=cache_on)
814 def _parents(_context_uid, _repo_id, _rev):
838 def _children(_repo_id, _commit_id):
815 repo_init = self._factory.repo_libgit2(wire)
839 output, __ = self.run_git_command(
816 with repo_init as repo:
840 wire, ['rev-list', '--all', '--children'])
817 commit = repo[rev]
841
818 return [x.hex for x in commit.parent_ids]
842 child_ids = []
819 return _parents(context_uid, repo_id, rev)
843 pat = re.compile(r'^%s' % commit_id)
844 for l in output.splitlines():
845 if pat.match(l):
846 found_ids = l.split(' ')[1:]
847 child_ids.extend(found_ids)
848
849 return child_ids
850 return _children(repo_id, commit_id)
820
851
821 @reraise_safe_exceptions
852 @reraise_safe_exceptions
822 def set_refs(self, wire, key, value):
853 def set_refs(self, wire, key, value):
@@ -878,10 +909,9 b' class GitRemote(object):'
878
909
879 @reraise_safe_exceptions
910 @reraise_safe_exceptions
880 def tree_items(self, wire, tree_id):
911 def tree_items(self, wire, tree_id):
881
882 cache_on, context_uid, repo_id = self._cache_on(wire)
912 cache_on, context_uid, repo_id = self._cache_on(wire)
883 @self.region.conditional_cache_on_arguments(condition=cache_on)
913 @self.region.conditional_cache_on_arguments(condition=cache_on)
884 def _tree_items(_context_uid, _repo_id, _tree_id):
914 def _tree_items(_repo_id, _tree_id):
885
915
886 repo_init = self._factory.repo_libgit2(wire)
916 repo_init = self._factory.repo_libgit2(wire)
887 with repo_init as repo:
917 with repo_init as repo:
@@ -902,7 +932,75 b' class GitRemote(object):'
902
932
903 result.append((item.name, item_mode, item_sha, item_type))
933 result.append((item.name, item_mode, item_sha, item_type))
904 return result
934 return result
905 return _tree_items(context_uid, repo_id, tree_id)
935 return _tree_items(repo_id, tree_id)
936
937 @reraise_safe_exceptions
938 def diff(self, wire, commit_id_1, commit_id_2, file_filter, opt_ignorews, context):
939
940 flags = [
941 '-U%s' % context, '--full-index', '--binary', '-p',
942 '-M', '--abbrev=40']
943
944 if opt_ignorews:
945 flags.append('-w')
946
947 if commit_id_1 == self.EMPTY_COMMIT:
948 cmd = ['show'] + flags + [commit_id_2]
949 else:
950 cmd = ['diff'] + flags + [commit_id_1, commit_id_2]
951
952 if file_filter:
953 cmd.extend(['--', file_filter])
954
955 diff, __ = self.run_git_command(wire, cmd)
956 # If we used 'show' command, strip first few lines (until actual diff
957 # starts)
958 if commit_id_1 == self.EMPTY_COMMIT:
959 lines = diff.splitlines()
960 x = 0
961 for line in lines:
962 if line.startswith('diff'):
963 break
964 x += 1
965 # Append new line just like 'diff' command do
966 diff = '\n'.join(lines[x:]) + '\n'
967 return diff
968
969 @reraise_safe_exceptions
970 def node_history(self, wire, commit_id, path, limit):
971 cache_on, context_uid, repo_id = self._cache_on(wire)
972 @self.region.conditional_cache_on_arguments(condition=cache_on)
973 def _node_history(_context_uid, _repo_id, _commit_id, _path, _limit):
974 # optimize for n==1, rev-list is much faster for that use-case
975 if limit == 1:
976 cmd = ['rev-list', '-1', commit_id, '--', path]
977 else:
978 cmd = ['log']
979 if limit:
980 cmd.extend(['-n', str(safe_int(limit, 0))])
981 cmd.extend(['--pretty=format: %H', '-s', commit_id, '--', path])
982
983 output, __ = self.run_git_command(wire, cmd)
984 commit_ids = re.findall(r'[0-9a-fA-F]{40}', output)
985
986 return [x for x in commit_ids]
987 return _node_history(context_uid, repo_id, commit_id, path, limit)
988
989 @reraise_safe_exceptions
990 def node_annotate(self, wire, commit_id, path):
991
992 cmd = ['blame', '-l', '--root', '-r', commit_id, '--', path]
993 # -l ==> outputs long shas (and we need all 40 characters)
994 # --root ==> doesn't put '^' character for boundaries
995 # -r commit_id ==> blames for the given commit
996 output, __ = self.run_git_command(wire, cmd)
997
998 result = []
999 for i, blame_line in enumerate(output.split('\n')[:-1]):
1000 line_no = i + 1
1001 commit_id, line = re.split(r' ', blame_line, 1)
1002 result.append((line_no, commit_id, line))
1003 return result
906
1004
907 @reraise_safe_exceptions
1005 @reraise_safe_exceptions
908 def update_server_info(self, wire):
1006 def update_server_info(self, wire):
@@ -241,99 +241,41 b' class HgRemote(object):'
241 return _branches(context_uid, repo_id, normal, closed)
241 return _branches(context_uid, repo_id, normal, closed)
242
242
243 @reraise_safe_exceptions
243 @reraise_safe_exceptions
244 def bulk_request(self, wire, rev, pre_load):
244 def bulk_request(self, wire, commit_id, pre_load):
245 cache_on, context_uid, repo_id = self._cache_on(wire)
245 cache_on, context_uid, repo_id = self._cache_on(wire)
246 @self.region.conditional_cache_on_arguments(condition=cache_on)
246 @self.region.conditional_cache_on_arguments(condition=cache_on)
247 def _bulk_request(_context_uid, _repo_id, _rev, _pre_load):
247 def _bulk_request(_repo_id, _commit_id, _pre_load):
248 result = {}
248 result = {}
249 for attr in pre_load:
249 for attr in pre_load:
250 try:
250 try:
251 method = self._bulk_methods[attr]
251 method = self._bulk_methods[attr]
252 result[attr] = method(wire, rev)
252 result[attr] = method(wire, commit_id)
253 except KeyError as e:
253 except KeyError as e:
254 raise exceptions.VcsException(e)(
254 raise exceptions.VcsException(e)(
255 'Unknown bulk attribute: "%s"' % attr)
255 'Unknown bulk attribute: "%s"' % attr)
256 return result
256 return result
257
257
258 return _bulk_request(context_uid, repo_id, rev, sorted(pre_load))
258 return _bulk_request(repo_id, commit_id, sorted(pre_load))
259
260 @reraise_safe_exceptions
261 def clone(self, wire, source, dest, update_after_clone=False, hooks=True):
262 baseui = self._factory._create_config(wire["config"], hooks=hooks)
263 clone(baseui, source, dest, noupdate=not update_after_clone)
264
259
265 @reraise_safe_exceptions
260 @reraise_safe_exceptions
266 def commitctx(self, wire, message, parents, commit_time, commit_timezone,
261 def ctx_branch(self, wire, commit_id):
267 user, files, extra, removed, updated):
262 cache_on, context_uid, repo_id = self._cache_on(wire)
268
263 @self.region.conditional_cache_on_arguments(condition=cache_on)
269 repo = self._factory.repo(wire)
264 def _ctx_branch(_repo_id, _commit_id):
270 baseui = self._factory._create_config(wire['config'])
265 repo = self._factory.repo(wire)
271 publishing = baseui.configbool('phases', 'publish')
266 ctx = self._get_ctx(repo, commit_id)
272 if publishing:
267 return ctx.branch()
273 new_commit = 'public'
268 return _ctx_branch(repo_id, commit_id)
274 else:
275 new_commit = 'draft'
276
277 def _filectxfn(_repo, ctx, path):
278 """
279 Marks given path as added/changed/removed in a given _repo. This is
280 for internal mercurial commit function.
281 """
282
283 # check if this path is removed
284 if path in removed:
285 # returning None is a way to mark node for removal
286 return None
287
288 # check if this path is added
289 for node in updated:
290 if node['path'] == path:
291 return memfilectx(
292 _repo,
293 changectx=ctx,
294 path=node['path'],
295 data=node['content'],
296 islink=False,
297 isexec=bool(node['mode'] & stat.S_IXUSR),
298 copysource=False)
299
300 raise exceptions.AbortException()(
301 "Given path haven't been marked as added, "
302 "changed or removed (%s)" % path)
303
304 with repo.ui.configoverride({('phases', 'new-commit'): new_commit}):
305
306 commit_ctx = memctx(
307 repo=repo,
308 parents=parents,
309 text=message,
310 files=files,
311 filectxfn=_filectxfn,
312 user=user,
313 date=(commit_time, commit_timezone),
314 extra=extra)
315
316 n = repo.commitctx(commit_ctx)
317 new_id = hex(n)
318
319 return new_id
320
269
321 @reraise_safe_exceptions
270 @reraise_safe_exceptions
322 def ctx_branch(self, wire, revision):
271 def ctx_date(self, wire, commit_id):
323
324 cache_on, context_uid, repo_id = self._cache_on(wire)
272 cache_on, context_uid, repo_id = self._cache_on(wire)
325 @self.region.conditional_cache_on_arguments(condition=cache_on)
273 @self.region.conditional_cache_on_arguments(condition=cache_on)
326 def _ctx_branch(_context_uid, _repo_id, _revision):
274 def _ctx_date(_repo_id, _commit_id):
327 repo = self._factory.repo(wire)
275 repo = self._factory.repo(wire)
328 ctx = self._get_ctx(repo, revision)
276 ctx = self._get_ctx(repo, commit_id)
329 return ctx.branch()
277 return ctx.date()
330 return _ctx_branch(context_uid, repo_id, revision)
278 return _ctx_date(repo_id, commit_id)
331
332 @reraise_safe_exceptions
333 def ctx_date(self, wire, revision):
334 repo = self._factory.repo(wire)
335 ctx = self._get_ctx(repo, revision)
336 return ctx.date()
337
279
338 @reraise_safe_exceptions
280 @reraise_safe_exceptions
339 def ctx_description(self, wire, revision):
281 def ctx_description(self, wire, revision):
@@ -342,16 +284,15 b' class HgRemote(object):'
342 return ctx.description()
284 return ctx.description()
343
285
344 @reraise_safe_exceptions
286 @reraise_safe_exceptions
345 def ctx_files(self, wire, revision):
287 def ctx_files(self, wire, commit_id):
346
347 cache_on, context_uid, repo_id = self._cache_on(wire)
288 cache_on, context_uid, repo_id = self._cache_on(wire)
348 @self.region.conditional_cache_on_arguments(condition=cache_on)
289 @self.region.conditional_cache_on_arguments(condition=cache_on)
349 def _ctx_files(_context_uid, _repo_id, _revision):
290 def _ctx_files(_repo_id, _commit_id):
350 repo = self._factory.repo(wire)
291 repo = self._factory.repo(wire)
351 ctx = self._get_ctx(repo, revision)
292 ctx = self._get_ctx(repo, commit_id)
352 return ctx.files()
293 return ctx.files()
353
294
354 return _ctx_files(context_uid, repo_id, revision)
295 return _ctx_files(repo_id, commit_id)
355
296
356 @reraise_safe_exceptions
297 @reraise_safe_exceptions
357 def ctx_list(self, path, revision):
298 def ctx_list(self, path, revision):
@@ -360,59 +301,59 b' class HgRemote(object):'
360 return list(ctx)
301 return list(ctx)
361
302
362 @reraise_safe_exceptions
303 @reraise_safe_exceptions
363 def ctx_parents(self, wire, revision):
304 def ctx_parents(self, wire, commit_id):
364 cache_on, context_uid, repo_id = self._cache_on(wire)
305 cache_on, context_uid, repo_id = self._cache_on(wire)
365 @self.region.conditional_cache_on_arguments(condition=cache_on)
306 @self.region.conditional_cache_on_arguments(condition=cache_on)
366 def _ctx_parents(_context_uid, _repo_id, _revision):
307 def _ctx_parents(_repo_id, _commit_id):
367 repo = self._factory.repo(wire)
308 repo = self._factory.repo(wire)
368 ctx = self._get_ctx(repo, revision)
309 ctx = self._get_ctx(repo, commit_id)
369 return [parent.rev() for parent in ctx.parents()
310 return [parent.rev() for parent in ctx.parents()
370 if not (parent.hidden() or parent.obsolete())]
311 if not (parent.hidden() or parent.obsolete())]
371
312
372 return _ctx_parents(context_uid, repo_id, revision)
313 return _ctx_parents(repo_id, commit_id)
373
314
374 @reraise_safe_exceptions
315 @reraise_safe_exceptions
375 def ctx_children(self, wire, revision):
316 def ctx_children(self, wire, commit_id):
376 cache_on, context_uid, repo_id = self._cache_on(wire)
317 cache_on, context_uid, repo_id = self._cache_on(wire)
377 @self.region.conditional_cache_on_arguments(condition=cache_on)
318 @self.region.conditional_cache_on_arguments(condition=cache_on)
378 def _ctx_children(_context_uid, _repo_id, _revision):
319 def _ctx_children(_repo_id, _commit_id):
379 repo = self._factory.repo(wire)
320 repo = self._factory.repo(wire)
380 ctx = self._get_ctx(repo, revision)
321 ctx = self._get_ctx(repo, commit_id)
381 return [child.rev() for child in ctx.children()
322 return [child.rev() for child in ctx.children()
382 if not (child.hidden() or child.obsolete())]
323 if not (child.hidden() or child.obsolete())]
383
324
384 return _ctx_children(context_uid, repo_id, revision)
325 return _ctx_children(repo_id, commit_id)
385
326
386 @reraise_safe_exceptions
327 @reraise_safe_exceptions
387 def ctx_phase(self, wire, revision):
328 def ctx_phase(self, wire, commit_id):
388 cache_on, context_uid, repo_id = self._cache_on(wire)
329 cache_on, context_uid, repo_id = self._cache_on(wire)
389 @self.region.conditional_cache_on_arguments(condition=cache_on)
330 @self.region.conditional_cache_on_arguments(condition=cache_on)
390 def _ctx_phase(_context_uid, _repo_path, _revision):
331 def _ctx_phase(_context_uid, _repo_id, _commit_id):
391 repo = self._factory.repo(wire)
332 repo = self._factory.repo(wire)
392 ctx = self._get_ctx(repo, revision)
333 ctx = self._get_ctx(repo, commit_id)
393 # public=0, draft=1, secret=3
334 # public=0, draft=1, secret=3
394 return ctx.phase()
335 return ctx.phase()
395 return _ctx_phase(context_uid, repo_id, revision)
336 return _ctx_phase(context_uid, repo_id, commit_id)
396
337
397 @reraise_safe_exceptions
338 @reraise_safe_exceptions
398 def ctx_obsolete(self, wire, revision):
339 def ctx_obsolete(self, wire, commit_id):
399 cache_on, context_uid, repo_id = self._cache_on(wire)
340 cache_on, context_uid, repo_id = self._cache_on(wire)
400 @self.region.conditional_cache_on_arguments(condition=cache_on)
341 @self.region.conditional_cache_on_arguments(condition=cache_on)
401 def _ctx_obsolete(_context_uid, _repo_path, _revision):
342 def _ctx_obsolete(_context_uid, _repo_id, _commit_id):
402 repo = self._factory.repo(wire)
343 repo = self._factory.repo(wire)
403 ctx = self._get_ctx(repo, revision)
344 ctx = self._get_ctx(repo, commit_id)
404 return ctx.obsolete()
345 return ctx.obsolete()
405 return _ctx_obsolete(context_uid, repo_id, revision)
346 return _ctx_obsolete(context_uid, repo_id, commit_id)
406
347
407 @reraise_safe_exceptions
348 @reraise_safe_exceptions
408 def ctx_hidden(self, wire, revision):
349 def ctx_hidden(self, wire, commit_id):
409 cache_on, context_uid, repo_id = self._cache_on(wire)
350 cache_on, context_uid, repo_id = self._cache_on(wire)
410 @self.region.conditional_cache_on_arguments(condition=cache_on)
351 @self.region.conditional_cache_on_arguments(condition=cache_on)
411 def _ctx_hidden(_context_uid, _repo_path, _revision):
352 def _ctx_hidden(_context_uid, _repo_id, _commit_id):
412 repo = self._factory.repo(wire)
353 repo = self._factory.repo(wire)
413 ctx = self._get_ctx(repo, revision)
354 ctx = self._get_ctx(repo, commit_id)
414 return ctx.hidden()
355 return ctx.hidden()
415 return _ctx_hidden(context_uid, repo_id, revision)
356 return _ctx_hidden(context_uid, repo_id, commit_id)
416
357
417 @reraise_safe_exceptions
358 @reraise_safe_exceptions
418 def ctx_substate(self, wire, revision):
359 def ctx_substate(self, wire, revision):
@@ -502,7 +443,7 b' class HgRemote(object):'
502 return True
443 return True
503
444
504 @reraise_safe_exceptions
445 @reraise_safe_exceptions
505 def diff(self, wire, rev1, rev2, file_filter, opt_git, opt_ignorews, context):
446 def diff(self, wire, commit_id_1, commit_id_2, file_filter, opt_git, opt_ignorews, context):
506 repo = self._factory.repo(wire)
447 repo = self._factory.repo(wire)
507
448
508 if file_filter:
449 if file_filter:
@@ -513,16 +454,15 b' class HgRemote(object):'
513
454
514 try:
455 try:
515 return "".join(patch.diff(
456 return "".join(patch.diff(
516 repo, node1=rev1, node2=rev2, match=match_filter, opts=opts))
457 repo, node1=commit_id_1, node2=commit_id_2, match=match_filter, opts=opts))
517 except RepoLookupError as e:
458 except RepoLookupError as e:
518 raise exceptions.LookupException(e)()
459 raise exceptions.LookupException(e)()
519
460
520 @reraise_safe_exceptions
461 @reraise_safe_exceptions
521 def node_history(self, wire, revision, path, limit):
462 def node_history(self, wire, revision, path, limit):
522
523 cache_on, context_uid, repo_id = self._cache_on(wire)
463 cache_on, context_uid, repo_id = self._cache_on(wire)
524 @self.region.conditional_cache_on_arguments(condition=cache_on)
464 @self.region.conditional_cache_on_arguments(condition=cache_on)
525 def _node_history(_context_uid, _repo_path, _revision, _path, _limit):
465 def _node_history(_context_uid, _repo_id, _revision, _path, _limit):
526 repo = self._factory.repo(wire)
466 repo = self._factory.repo(wire)
527
467
528 ctx = self._get_ctx(repo, revision)
468 ctx = self._get_ctx(repo, revision)
@@ -550,10 +490,9 b' class HgRemote(object):'
550
490
551 @reraise_safe_exceptions
491 @reraise_safe_exceptions
552 def node_history_untill(self, wire, revision, path, limit):
492 def node_history_untill(self, wire, revision, path, limit):
553
554 cache_on, context_uid, repo_id = self._cache_on(wire)
493 cache_on, context_uid, repo_id = self._cache_on(wire)
555 @self.region.conditional_cache_on_arguments(condition=cache_on)
494 @self.region.conditional_cache_on_arguments(condition=cache_on)
556 def _meth(_context_uid, _repo_path):
495 def _node_history_until(_context_uid, _repo_id):
557 repo = self._factory.repo(wire)
496 repo = self._factory.repo(wire)
558 ctx = self._get_ctx(repo, revision)
497 ctx = self._get_ctx(repo, revision)
559 fctx = ctx.filectx(path)
498 fctx = ctx.filectx(path)
@@ -564,7 +503,7 b' class HgRemote(object):'
564 file_log = file_log[-limit:]
503 file_log = file_log[-limit:]
565
504
566 return [hex(fctx.filectx(cs).node()) for cs in reversed(file_log)]
505 return [hex(fctx.filectx(cs).node()) for cs in reversed(file_log)]
567 return _meth(context_uid, repo_id, revision, path, limit)
506 return _node_history_until(context_uid, repo_id, revision, path, limit)
568
507
569 @reraise_safe_exceptions
508 @reraise_safe_exceptions
570 def fctx_annotate(self, wire, revision, path):
509 def fctx_annotate(self, wire, revision, path):
@@ -588,28 +527,27 b' class HgRemote(object):'
588 return fctx.data()
527 return fctx.data()
589
528
590 @reraise_safe_exceptions
529 @reraise_safe_exceptions
591 def fctx_flags(self, wire, revision, path):
530 def fctx_flags(self, wire, commit_id, path):
592 cache_on, context_uid, repo_id = self._cache_on(wire)
531 cache_on, context_uid, repo_id = self._cache_on(wire)
593 @self.region.conditional_cache_on_arguments(condition=cache_on)
532 @self.region.conditional_cache_on_arguments(condition=cache_on)
594 def _fctx_flags(_context_uid, _repo_path, _revision, _path):
533 def _fctx_flags(_repo_id, _commit_id, _path):
595 repo = self._factory.repo(wire)
534 repo = self._factory.repo(wire)
596 ctx = self._get_ctx(repo, revision)
535 ctx = self._get_ctx(repo, commit_id)
597 fctx = ctx.filectx(path)
536 fctx = ctx.filectx(path)
598 return fctx.flags()
537 return fctx.flags()
599
538
600 return _fctx_flags(context_uid, repo_id, revision, path)
539 return _fctx_flags(repo_id, commit_id, path)
601
540
602 @reraise_safe_exceptions
541 @reraise_safe_exceptions
603 def fctx_size(self, wire, revision, path):
542 def fctx_size(self, wire, commit_id, path):
604
605 cache_on, context_uid, repo_id = self._cache_on(wire)
543 cache_on, context_uid, repo_id = self._cache_on(wire)
606 @self.region.conditional_cache_on_arguments(condition=cache_on)
544 @self.region.conditional_cache_on_arguments(condition=cache_on)
607 def _fctx_size(_context_uid, _repo_path, _revision, _path):
545 def _fctx_size(_repo_id, _revision, _path):
608 repo = self._factory.repo(wire)
546 repo = self._factory.repo(wire)
609 ctx = self._get_ctx(repo, revision)
547 ctx = self._get_ctx(repo, commit_id)
610 fctx = ctx.filectx(path)
548 fctx = ctx.filectx(path)
611 return fctx.size()
549 return fctx.size()
612 return _fctx_size(context_uid, repo_id, revision, path)
550 return _fctx_size(repo_id, commit_id, path)
613
551
614 @reraise_safe_exceptions
552 @reraise_safe_exceptions
615 def get_all_commit_ids(self, wire, name):
553 def get_all_commit_ids(self, wire, name):
@@ -628,16 +566,6 b' class HgRemote(object):'
628 return repo.ui.config(section, name, untrusted=untrusted)
566 return repo.ui.config(section, name, untrusted=untrusted)
629
567
630 @reraise_safe_exceptions
568 @reraise_safe_exceptions
631 def get_config_bool(self, wire, section, name, untrusted=False):
632 repo = self._factory.repo(wire)
633 return repo.ui.configbool(section, name, untrusted=untrusted)
634
635 @reraise_safe_exceptions
636 def get_config_list(self, wire, section, name, untrusted=False):
637 repo = self._factory.repo(wire)
638 return repo.ui.configlist(section, name, untrusted=untrusted)
639
640 @reraise_safe_exceptions
641 def is_large_file(self, wire, path):
569 def is_large_file(self, wire, path):
642 cache_on, context_uid, repo_id = self._cache_on(wire)
570 cache_on, context_uid, repo_id = self._cache_on(wire)
643 @self.region.conditional_cache_on_arguments(condition=cache_on)
571 @self.region.conditional_cache_on_arguments(condition=cache_on)
@@ -705,22 +633,6 b' class HgRemote(object):'
705 return _lookup(context_uid, repo_id, revision, both)
633 return _lookup(context_uid, repo_id, revision, both)
706
634
707 @reraise_safe_exceptions
635 @reraise_safe_exceptions
708 def pull(self, wire, url, commit_ids=None):
709 repo = self._factory.repo(wire)
710 # Disable any prompts for this repo
711 repo.ui.setconfig('ui', 'interactive', 'off', '-y')
712
713 remote = peer(repo, {}, url)
714 # Disable any prompts for this remote
715 remote.ui.setconfig('ui', 'interactive', 'off', '-y')
716
717 if commit_ids:
718 commit_ids = [bin(commit_id) for commit_id in commit_ids]
719
720 return exchange.pull(
721 repo, remote, heads=commit_ids, force=None).cgresult
722
723 @reraise_safe_exceptions
724 def sync_push(self, wire, url):
636 def sync_push(self, wire, url):
725 if not self.check_url(url, wire['config']):
637 if not self.check_url(url, wire['config']):
726 return
638 return
@@ -785,13 +697,6 b' class HgRemote(object):'
785 return list(repo.revs(rev_spec, *args))
697 return list(repo.revs(rev_spec, *args))
786
698
787 @reraise_safe_exceptions
699 @reraise_safe_exceptions
788 def strip(self, wire, revision, update, backup):
789 repo = self._factory.repo(wire)
790 ctx = self._get_ctx(repo, revision)
791 hgext_strip(
792 repo.baseui, repo, ctx.node(), update=update, backup=backup)
793
794 @reraise_safe_exceptions
795 def verify(self, wire,):
700 def verify(self, wire,):
796 repo = self._factory.repo(wire)
701 repo = self._factory.repo(wire)
797 baseui = self._factory._create_config(wire['config'])
702 baseui = self._factory._create_config(wire['config'])
@@ -807,20 +712,6 b' class HgRemote(object):'
807 return output.getvalue()
712 return output.getvalue()
808
713
809 @reraise_safe_exceptions
714 @reraise_safe_exceptions
810 def tag(self, wire, name, revision, message, local, user, tag_time, tag_timezone):
811 repo = self._factory.repo(wire)
812 ctx = self._get_ctx(repo, revision)
813 node = ctx.node()
814
815 date = (tag_time, tag_timezone)
816 try:
817 hg_tag.tag(repo, name, node, message, local, user, date)
818 except Abort as e:
819 log.exception("Tag operation aborted")
820 # Exception can contain unicode which we convert
821 raise exceptions.AbortException(e)(repr(e))
822
823 @reraise_safe_exceptions
824 def tags(self, wire):
715 def tags(self, wire):
825 cache_on, context_uid, repo_id = self._cache_on(wire)
716 cache_on, context_uid, repo_id = self._cache_on(wire)
826 @self.region.conditional_cache_on_arguments(condition=cache_on)
717 @self.region.conditional_cache_on_arguments(condition=cache_on)
@@ -849,23 +740,6 b' class HgRemote(object):'
849 return output.getvalue()
740 return output.getvalue()
850
741
851 @reraise_safe_exceptions
742 @reraise_safe_exceptions
852 def pull_cmd(self, wire, source, bookmark=None, branch=None, revision=None, hooks=True):
853 repo = self._factory.repo(wire)
854 baseui = self._factory._create_config(wire['config'], hooks=hooks)
855
856 # Mercurial internally has a lot of logic that checks ONLY if
857 # option is defined, we just pass those if they are defined then
858 opts = {}
859 if bookmark:
860 opts['bookmark'] = bookmark
861 if branch:
862 opts['branch'] = branch
863 if revision:
864 opts['rev'] = revision
865
866 commands.pull(baseui, repo, source, **opts)
867
868 @reraise_safe_exceptions
869 def heads(self, wire, branch=None):
743 def heads(self, wire, branch=None):
870 repo = self._factory.repo(wire)
744 repo = self._factory.repo(wire)
871 baseui = self._factory._create_config(wire['config'])
745 baseui = self._factory._create_config(wire['config'])
@@ -892,6 +766,99 b' class HgRemote(object):'
892 return hex(a)
766 return hex(a)
893
767
894 @reraise_safe_exceptions
768 @reraise_safe_exceptions
769 def clone(self, wire, source, dest, update_after_clone=False, hooks=True):
770 baseui = self._factory._create_config(wire["config"], hooks=hooks)
771 clone(baseui, source, dest, noupdate=not update_after_clone)
772
773 @reraise_safe_exceptions
774 def commitctx(self, wire, message, parents, commit_time, commit_timezone, user, files, extra, removed, updated):
775
776 repo = self._factory.repo(wire)
777 baseui = self._factory._create_config(wire['config'])
778 publishing = baseui.configbool('phases', 'publish')
779 if publishing:
780 new_commit = 'public'
781 else:
782 new_commit = 'draft'
783
784 def _filectxfn(_repo, ctx, path):
785 """
786 Marks given path as added/changed/removed in a given _repo. This is
787 for internal mercurial commit function.
788 """
789
790 # check if this path is removed
791 if path in removed:
792 # returning None is a way to mark node for removal
793 return None
794
795 # check if this path is added
796 for node in updated:
797 if node['path'] == path:
798 return memfilectx(
799 _repo,
800 changectx=ctx,
801 path=node['path'],
802 data=node['content'],
803 islink=False,
804 isexec=bool(node['mode'] & stat.S_IXUSR),
805 copysource=False)
806
807 raise exceptions.AbortException()(
808 "Given path haven't been marked as added, "
809 "changed or removed (%s)" % path)
810
811 with repo.ui.configoverride({('phases', 'new-commit'): new_commit}):
812
813 commit_ctx = memctx(
814 repo=repo,
815 parents=parents,
816 text=message,
817 files=files,
818 filectxfn=_filectxfn,
819 user=user,
820 date=(commit_time, commit_timezone),
821 extra=extra)
822
823 n = repo.commitctx(commit_ctx)
824 new_id = hex(n)
825
826 return new_id
827
828 @reraise_safe_exceptions
829 def pull(self, wire, url, commit_ids=None):
830 repo = self._factory.repo(wire)
831 # Disable any prompts for this repo
832 repo.ui.setconfig('ui', 'interactive', 'off', '-y')
833
834 remote = peer(repo, {}, url)
835 # Disable any prompts for this remote
836 remote.ui.setconfig('ui', 'interactive', 'off', '-y')
837
838 if commit_ids:
839 commit_ids = [bin(commit_id) for commit_id in commit_ids]
840
841 return exchange.pull(
842 repo, remote, heads=commit_ids, force=None).cgresult
843
844 @reraise_safe_exceptions
845 def pull_cmd(self, wire, source, bookmark=None, branch=None, revision=None, hooks=True):
846 repo = self._factory.repo(wire)
847 baseui = self._factory._create_config(wire['config'], hooks=hooks)
848
849 # Mercurial internally has a lot of logic that checks ONLY if
850 # option is defined, we just pass those if they are defined then
851 opts = {}
852 if bookmark:
853 opts['bookmark'] = bookmark
854 if branch:
855 opts['branch'] = branch
856 if revision:
857 opts['rev'] = revision
858
859 commands.pull(baseui, repo, source, **opts)
860
861 @reraise_safe_exceptions
895 def push(self, wire, revisions, dest_path, hooks=True, push_branches=False):
862 def push(self, wire, revisions, dest_path, hooks=True, push_branches=False):
896 repo = self._factory.repo(wire)
863 repo = self._factory.repo(wire)
897 baseui = self._factory._create_config(wire['config'], hooks=hooks)
864 baseui = self._factory._create_config(wire['config'], hooks=hooks)
@@ -899,6 +866,13 b' class HgRemote(object):'
899 new_branch=push_branches)
866 new_branch=push_branches)
900
867
901 @reraise_safe_exceptions
868 @reraise_safe_exceptions
869 def strip(self, wire, revision, update, backup):
870 repo = self._factory.repo(wire)
871 ctx = self._get_ctx(repo, revision)
872 hgext_strip(
873 repo.baseui, repo, ctx.node(), update=update, backup=backup)
874
875 @reraise_safe_exceptions
902 def merge(self, wire, revision):
876 def merge(self, wire, revision):
903 repo = self._factory.repo(wire)
877 repo = self._factory.repo(wire)
904 baseui = self._factory._create_config(wire['config'])
878 baseui = self._factory._create_config(wire['config'])
@@ -940,6 +914,20 b' class HgRemote(object):'
940 baseui, repo, base=source, dest=dest, abort=abort, keep=not abort)
914 baseui, repo, base=source, dest=dest, abort=abort, keep=not abort)
941
915
942 @reraise_safe_exceptions
916 @reraise_safe_exceptions
917 def tag(self, wire, name, revision, message, local, user, tag_time, tag_timezone):
918 repo = self._factory.repo(wire)
919 ctx = self._get_ctx(repo, revision)
920 node = ctx.node()
921
922 date = (tag_time, tag_timezone)
923 try:
924 hg_tag.tag(repo, name, node, message, local, user, date)
925 except Abort as e:
926 log.exception("Tag operation aborted")
927 # Exception can contain unicode which we convert
928 raise exceptions.AbortException(e)(repr(e))
929
930 @reraise_safe_exceptions
943 def bookmark(self, wire, bookmark, revision=None):
931 def bookmark(self, wire, bookmark, revision=None):
944 repo = self._factory.repo(wire)
932 repo = self._factory.repo(wire)
945 baseui = self._factory._create_config(wire['config'])
933 baseui = self._factory._create_config(wire['config'])
@@ -215,11 +215,11 b' class SvnRemote(object):'
215
215
216 cache_on, context_uid, repo_id = self._cache_on(wire)
216 cache_on, context_uid, repo_id = self._cache_on(wire)
217 @self.region.conditional_cache_on_arguments(condition=cache_on)
217 @self.region.conditional_cache_on_arguments(condition=cache_on)
218 def _revision_properties(_context_uid, _repo_id, _revision):
218 def _revision_properties(_repo_id, _revision):
219 repo = self._factory.repo(wire)
219 repo = self._factory.repo(wire)
220 fs_ptr = svn.repos.fs(repo)
220 fs_ptr = svn.repos.fs(repo)
221 return svn.fs.revision_proplist(fs_ptr, revision)
221 return svn.fs.revision_proplist(fs_ptr, revision)
222 return _revision_properties(context_uid, repo_id, revision)
222 return _revision_properties(repo_id, revision)
223
223
224 def revision_changes(self, wire, revision):
224 def revision_changes(self, wire, revision):
225
225
@@ -288,10 +288,14 b' class SvnRemote(object):'
288 return _assert_correct_path(context_uid, repo_id, path, revision, limit)
288 return _assert_correct_path(context_uid, repo_id, path, revision, limit)
289
289
290 def node_properties(self, wire, path, revision):
290 def node_properties(self, wire, path, revision):
291 repo = self._factory.repo(wire)
291 cache_on, context_uid, repo_id = self._cache_on(wire)
292 fsobj = svn.repos.fs(repo)
292 @self.region.conditional_cache_on_arguments(condition=cache_on)
293 rev_root = svn.fs.revision_root(fsobj, revision)
293 def _node_properties(_repo_id, _path, _revision):
294 return svn.fs.node_proplist(rev_root, path)
294 repo = self._factory.repo(wire)
295 fsobj = svn.repos.fs(repo)
296 rev_root = svn.fs.revision_root(fsobj, revision)
297 return svn.fs.node_proplist(rev_root, path)
298 return _node_properties(repo_id, path, revision)
295
299
296 def file_annotate(self, wire, path, revision):
300 def file_annotate(self, wire, path, revision):
297 abs_path = 'file://' + urllib.pathname2url(
301 abs_path = 'file://' + urllib.pathname2url(
@@ -324,7 +328,7 b' class SvnRemote(object):'
324
328
325 cache_on, context_uid, repo_id = self._cache_on(wire)
329 cache_on, context_uid, repo_id = self._cache_on(wire)
326 @self.region.conditional_cache_on_arguments(condition=cache_on)
330 @self.region.conditional_cache_on_arguments(condition=cache_on)
327 def _get_node_type(_context_uid, _repo_id, _path, _revision):
331 def _get_node_type(_repo_id, _path, _revision):
328 repo = self._factory.repo(wire)
332 repo = self._factory.repo(wire)
329 fs_ptr = svn.repos.fs(repo)
333 fs_ptr = svn.repos.fs(repo)
330 if _revision is None:
334 if _revision is None:
@@ -332,13 +336,13 b' class SvnRemote(object):'
332 root = svn.fs.revision_root(fs_ptr, _revision)
336 root = svn.fs.revision_root(fs_ptr, _revision)
333 node = svn.fs.check_path(root, path)
337 node = svn.fs.check_path(root, path)
334 return NODE_TYPE_MAPPING.get(node, None)
338 return NODE_TYPE_MAPPING.get(node, None)
335 return _get_node_type(context_uid, repo_id, path, revision)
339 return _get_node_type(repo_id, path, revision)
336
340
337 def get_nodes(self, wire, path, revision=None):
341 def get_nodes(self, wire, path, revision=None):
338
342
339 cache_on, context_uid, repo_id = self._cache_on(wire)
343 cache_on, context_uid, repo_id = self._cache_on(wire)
340 @self.region.conditional_cache_on_arguments(condition=cache_on)
344 @self.region.conditional_cache_on_arguments(condition=cache_on)
341 def _get_nodes(_context_uid, _repo_id, _path, _revision):
345 def _get_nodes(_repo_id, _path, _revision):
342 repo = self._factory.repo(wire)
346 repo = self._factory.repo(wire)
343 fsobj = svn.repos.fs(repo)
347 fsobj = svn.repos.fs(repo)
344 if _revision is None:
348 if _revision is None:
@@ -350,7 +354,7 b' class SvnRemote(object):'
350 result.append(
354 result.append(
351 (entry_path, NODE_TYPE_MAPPING.get(entry_info.kind, None)))
355 (entry_path, NODE_TYPE_MAPPING.get(entry_info.kind, None)))
352 return result
356 return result
353 return _get_nodes(context_uid, repo_id, path, revision)
357 return _get_nodes(repo_id, path, revision)
354
358
355 def get_file_content(self, wire, path, rev=None):
359 def get_file_content(self, wire, path, rev=None):
356 repo = self._factory.repo(wire)
360 repo = self._factory.repo(wire)
@@ -365,7 +369,7 b' class SvnRemote(object):'
365
369
366 cache_on, context_uid, repo_id = self._cache_on(wire)
370 cache_on, context_uid, repo_id = self._cache_on(wire)
367 @self.region.conditional_cache_on_arguments(condition=cache_on)
371 @self.region.conditional_cache_on_arguments(condition=cache_on)
368 def _get_file_size(_context_uid, _repo_id, _path, _revision):
372 def _get_file_size(_repo_id, _path, _revision):
369 repo = self._factory.repo(wire)
373 repo = self._factory.repo(wire)
370 fsobj = svn.repos.fs(repo)
374 fsobj = svn.repos.fs(repo)
371 if _revision is None:
375 if _revision is None:
@@ -373,7 +377,7 b' class SvnRemote(object):'
373 root = svn.fs.revision_root(fsobj, _revision)
377 root = svn.fs.revision_root(fsobj, _revision)
374 size = svn.fs.file_length(root, path)
378 size = svn.fs.file_length(root, path)
375 return size
379 return size
376 return _get_file_size(context_uid, repo_id, path, revision)
380 return _get_file_size(repo_id, path, revision)
377
381
378 def create_repository(self, wire, compatible_version=None):
382 def create_repository(self, wire, compatible_version=None):
379 log.info('Creating Subversion repository in path "%s"', wire['path'])
383 log.info('Creating Subversion repository in path "%s"', wire['path'])
@@ -691,7 +695,6 b' class SvnDiffer(object):'
691 return content.splitlines(True)
695 return content.splitlines(True)
692
696
693
697
694
695 class DiffChangeEditor(svn.delta.Editor):
698 class DiffChangeEditor(svn.delta.Editor):
696 """
699 """
697 Records changes between two given revisions
700 Records changes between two given revisions
@@ -36,7 +36,7 b' class TestDiff(object):'
36 'deadbeef', 'index', 'message')
36 'deadbeef', 'index', 'message')
37 with pytest.raises(Exception) as exc_info:
37 with pytest.raises(Exception) as exc_info:
38 hg_remote.diff(
38 hg_remote.diff(
39 wire={}, rev1='deadbeef', rev2='deadbee1',
39 wire={}, commit_id_1='deadbeef', commit_id_2='deadbee1',
40 file_filter=None, opt_git=True, opt_ignorews=True,
40 file_filter=None, opt_git=True, opt_ignorews=True,
41 context=3)
41 context=3)
42 assert type(exc_info.value) == Exception
42 assert type(exc_info.value) == Exception
General Comments 0
You need to be logged in to leave comments. Login now