public void TestPythonException_PyErr_NormalizeException() { using (var scope = Py.CreateScope()) { scope.Exec(@" class TestException(NameError): def __init__(self, val): super().__init__(val) x = int(val)"); Assert.IsTrue(scope.TryGet("TestException", out PyObject type)); PyObject str = "dummy string".ToPython(); var typePtr = new NewReference(type.Reference); var strPtr = new NewReference(str.Reference); var tbPtr = new NewReference(Runtime.Runtime.None.Reference); Runtime.Runtime.PyErr_NormalizeException(ref typePtr, ref strPtr, ref tbPtr); using var typeObj = typePtr.MoveToPyObject(); using var strObj = strPtr.MoveToPyObject(); using var tbObj = tbPtr.MoveToPyObject(); // the type returned from PyErr_NormalizeException should not be the same type since a new // exception was raised by initializing the exception Assert.IsFalse(PythonReferenceComparer.Instance.Equals(type, typeObj)); // the message should now be the string from the throw exception during normalization Assert.AreEqual("invalid literal for int() with base 10: 'dummy string'", strObj.ToString()); } }
/// <summary> /// Creates the base state for testing (creates a repo, a commit in master, a branch, a commit in the branch and a pull request) /// </summary> /// <returns></returns> async Task <PullRequestData> CreatePullRequest(RepositoryContext context, string branch = branchName) { string branchHead = "heads/" + branch; string branchRef = "refs/" + branchHead; var repoName = context.RepositoryName; // Creating a commit in master var createdCommitInMaster = await CreateCommit(repoName, "Hello World!", "README.md", "heads/master", "A master commit message"); // Creating a branch var newBranch = new NewReference(branchRef, createdCommitInMaster.Sha); await _github.Git.Reference.Create(Helper.UserName, repoName, newBranch); // Creating a commit in the branch var createdCommitInBranch = await CreateCommit(repoName, "Hello from the fork!", path, branchHead, "A branch commit message"); // Creating a pull request var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master"); var createdPullRequest = await _github.PullRequest.Create(Helper.UserName, repoName, pullRequest); var data = new PullRequestData { Sha = createdCommitInBranch.Sha, Number = createdPullRequest.Number }; return(data); }
public async Task CanCreateAReference() { var blob = new NewBlob { Content = "Hello World!", Encoding = EncodingType.Utf8 }; var blobResult = await _client.GitDatabase.Blob.Create(_owner, _repository.Name, blob); var newTree = new NewTree(); newTree.Tree.Add(new NewTreeItem { Mode = FileMode.File, Type = TreeType.Blob, Path = "README.md", Sha = blobResult.Sha }); var treeResult = await _client.GitDatabase.Tree.Create(_owner, _repository.Name, newTree); var newCommit = new NewCommit("This is a new commit", treeResult.Sha); var commitResult = await _client.GitDatabase.Commit.Create(_owner, _repository.Name, newCommit); var newReference = new NewReference("heads/develop", commitResult.Sha); var result = await _fixture.Create(_owner, _repository.Name, newReference); Assert.Equal(commitResult.Sha, result.Object.Sha); }
/// <summary> /// Creates the base state for testing (creates a repo, a commit in master, a branch, a commit in the branch and a pull request) /// </summary> /// <returns></returns> async Task <PullRequestData> CreatePullRequest(Repository repository) { var repoName = repository.Name; // Creating a commit in master var createdCommitInMaster = await CreateCommit(repoName, "Hello World!", "README.md", "heads/master", "A master commit message"); // Creating a branch var newBranch = new NewReference(branchRef, createdCommitInMaster.Sha); await _gitHubClient.GitDatabase.Reference.Create(Helper.UserName, repoName, newBranch); // Creating a commit in the branch var createdCommitInBranch = await CreateCommit(repoName, "Hello from the fork!", path, branchHead, "A branch commit message"); // Creating a pull request var pullRequest = new NewPullRequest("Nice title for the pull request", branchName, "master"); var createdPullRequest = await _gitHubClient.PullRequest.Create(Helper.UserName, repoName, pullRequest); var data = new PullRequestData { Sha = createdCommitInBranch.Sha, Number = createdPullRequest.Number, }; return(data); }
public static void PyCheck_Iter_PyObject_IsIterable_Test() { Runtime.Runtime.Py_Initialize(); Runtime.Native.ABI.Initialize(Runtime.Runtime.PyVersion); // Tests that a python list is an iterable, but not an iterator using (var pyList = NewReference.DangerousFromPointer(Runtime.Runtime.PyList_New(0))) { Assert.IsFalse(Runtime.Runtime.PyIter_Check(pyList)); Assert.IsTrue(Runtime.Runtime.PyObject_IsIterable(pyList)); // Tests that a python list iterator is both an iterable and an iterator using var pyListIter = Runtime.Runtime.PyObject_GetIter(pyList); Assert.IsTrue(Runtime.Runtime.PyObject_IsIterable(pyListIter)); Assert.IsTrue(Runtime.Runtime.PyIter_Check(pyListIter)); } // Tests that a python float is neither an iterable nor an iterator using (var pyFloat = NewReference.DangerousFromPointer(Runtime.Runtime.PyFloat_FromDouble(2.73))) { Assert.IsFalse(Runtime.Runtime.PyObject_IsIterable(pyFloat)); Assert.IsFalse(Runtime.Runtime.PyIter_Check(pyFloat)); } Runtime.Runtime.Py_Finalize(); }
public static void PyCheck_Iter_PyObject_IsIterable_ThreadingLock_Test() { Runtime.Runtime.Py_Initialize(); Runtime.Native.ABI.Initialize(Runtime.Runtime.PyVersion); try { // Create an instance of threading.Lock, which is one of the very few types that does not have the // TypeFlags.HaveIter set in Python 2. This tests a different code path in PyObject_IsIterable and PyIter_Check. using var threading = Runtime.Runtime.PyImport_ImportModule("threading"); Exceptions.ErrorCheck(threading); var threadingDict = Runtime.Runtime.PyModule_GetDict(threading); Exceptions.ErrorCheck(threadingDict); var lockType = Runtime.Runtime.PyDict_GetItemString(threadingDict, "Lock"); if (lockType.IsNull) { throw PythonException.ThrowLastAsClrException(); } using var args = NewReference.DangerousFromPointer(Runtime.Runtime.PyTuple_New(0)); using var lockInstance = Runtime.Runtime.PyObject_CallObject(lockType, args); Exceptions.ErrorCheck(lockInstance); Assert.IsFalse(Runtime.Runtime.PyObject_IsIterable(lockInstance)); Assert.IsFalse(Runtime.Runtime.PyIter_Check(lockInstance)); } finally { Runtime.Runtime.Py_Finalize(); } }
public async Task CanDeleteAReferenceWithRepositoryId() { var blob = new NewBlob { Content = "Hello World!", Encoding = EncodingType.Utf8 }; var blobResult = await _github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob); var newTree = new NewTree(); newTree.Tree.Add(new NewTreeItem { Mode = FileMode.File, Type = TreeType.Blob, Path = "README.md", Sha = blobResult.Sha }); var treeResult = await _github.Git.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree); var newCommit = new NewCommit("This is a new commit", treeResult.Sha); var commitResult = await _github.Git.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit); var newReference = new NewReference("heads/develop", commitResult.Sha); await _fixture.Create(_context.Repository.Id, newReference); await _fixture.Delete(_context.Repository.Id, "heads/develop"); var all = await _fixture.GetAll(_context.Repository.Id); Assert.Empty(all.Where(r => r.Ref == "heads/develop")); }
protected async Task <Commit> GetCommitAsBase(string branchName, IGitHubClient client, Repository repository) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (repository == null) { throw new ArgumentNullException(nameof(client)); } var branches = await client.Repository.Branch.GetAll(repository.Owner.Login, repository.Name).ConfigureAwait(false); var existingBranch = branches.FirstOrDefault(branch => branch.Name == branchName); if (existingBranch == null) { _logger.LogInformation("Rule {ruleClass} / {ruleName}, Branch {branchName} did not exists, creating branch.", typeof(T).Name, RuleName, branchName); var baseBranch = await client.Git.Reference.Get(repository.Owner.Login, repository.Name, $"heads/{repository.DefaultBranch}").ConfigureAwait(false); var newReference = new NewReference("refs/heads/" + branchName, baseBranch.Object.Sha); var branchReference = await client.Git.Reference.Create(repository.Owner.Login, repository.Name, newReference).ConfigureAwait(false); return(await client.Git.Commit.Get(repository.Owner.Login, repository.Name, branchReference.Object.Sha).ConfigureAwait(false)); } _logger.LogInformation("Rule {ruleClass} / {ruleName}, Branch {branchName} already exists, using existing branch.", typeof(T).Name, RuleName, branchName); return(await client.Git.Commit.Get(repository.Owner.Login, repository.Name, existingBranch.Commit.Sha).ConfigureAwait(false)); }
/// <summary> /// Creates a reference for a given repository /// </summary> /// <remarks> /// http://developer.github.com/v3/git/refs/#create-a-reference /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="reference">The reference to create</param> /// <returns></returns> public IObservable <Reference> Create(string owner, string name, NewReference reference) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(reference, "reference"); return(_reference.Create(owner, name, reference).ToObservable()); }
/// <summary> /// Creates a reference for a given repository /// </summary> /// <remarks> /// http://developer.github.com/v3/git/refs/#create-a-reference /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="reference">The reference to create</param> /// <returns></returns> public IObservable<Reference> Create(string owner, string name, NewReference reference) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(reference, "reference"); return _reference.Create(owner, name, reference).ToObservable(); }
public void CanBorrowFromNewReference() { var dict = new PyDict(); using NewReference reference = Runtime.PyDict_Items(dict.Reference); BorrowedReference borrowed = reference.BorrowOrThrow(); PythonException.ThrowIfIsNotZero(Runtime.PyList_Reverse(borrowed)); }
private async Task CreateNewBranch(string newBranchName) { var headRef = $"heads/{_branch}"; var targetBranchReference = await _github.Git.Reference.Get(_owner, _repo, headRef); var newBranchRef = $"refs/heads/{newBranchName}"; var newReference = new NewReference(newBranchRef, targetBranchReference.Object.Sha); await _github.Git.Reference.Create(_owner, _repo, newReference); }
private async Task <Reference> CreatePullRequestBranch( Repository repo, Branch defaultBranch, Comment comment) { var reference = new NewReference($"refs/heads/comment-{comment.id}", defaultBranch.Commit.Sha); var pullRequestBranch = await _githubClient.Git.Reference.Create(repo.Id, reference); return(pullRequestBranch); }
public async Task <IActionResult> Create(NewReference newReference) { if (ModelState.IsValid) { var reference = await _refService.Create(newReference); return(RedirectToAction("Details", new { reference.Id })); } return(View(newReference)); }
public void CreateBranch(BranchName branchName, string commitSha) { var newReference = new NewReference(branchName.GitRef, commitSha); _logger.LogDebug("Creating branch {branchName}", branchName); var client = CreateGitHubClient(); client.Git.Reference.Create(_repositoryOwner, _repositoryName, newReference).Wait(); }
public void PostsToCorrectUrlWithRepositoryId() { var newReference = new NewReference("heads/develop", "sha"); var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableReferencesClient(gitHubClient); client.Create(1, newReference); gitHubClient.Received().Git.Reference.Create(1, newReference); }
public async Task <string> CreateBranch(string owner, string repository, string branchName, string commitSha) { var newRef = new NewReference("refs/heads/" + branchName, commitSha); log($"API Query - Create reference '{newRef.Ref}' in '{owner}/{repository}'."); var reference = await client.Git.Reference.Create(owner, repository, newRef); return(reference.Ref.Substring("refs/heads/".Length)); }
public static async Task <TempRepoContext> Create(string tempBranchName, VerifyBase verifyBase) { var newReference = new NewReference($"refs/heads/{tempBranchName}", "af72f8e44eb53d26969b1316491a294f3401f203"); await Client.DeleteBranch(tempBranchName); var tempBranchReference = await Client.GitHubClient.Git.Reference.Create("SimonCropp", "GitHubSync.TestRepository", newReference); return(new TempRepoContext(tempBranchReference, tempBranchName, $"refs/heads/{tempBranchName}", verifyBase)); }
public async Task PostsToCorrectUrl() { var newReference = new NewReference("heads/develop", "sha"); var connection = Substitute.For <IApiConnection>(); var client = new ReferencesClient(connection); await client.Create("owner", "repo", newReference); connection.Received().Post <Reference>(Arg.Is <Uri>(u => u.ToString() == "repos/owner/repo/git/refs"), newReference); }
public async Task CanUpdateAReference() { var firstBlob = new NewBlob { Content = "Hello World!", Encoding = EncodingType.Utf8 }; var firstBlobResult = await _client.GitDatabase.Blob.Create(_owner, _repository.Name, firstBlob); var secondBlob = new NewBlob { Content = "This is a test!", Encoding = EncodingType.Utf8 }; var secondBlobResult = await _client.GitDatabase.Blob.Create(_owner, _repository.Name, secondBlob); var firstTree = new NewTree(); firstTree.Tree.Add(new NewTreeItem { Mode = FileMode.File, Type = TreeType.Blob, Path = "README.md", Sha = firstBlobResult.Sha }); var firstTreeResult = await _client.GitDatabase.Tree.Create(_owner, _repository.Name, firstTree); var firstCommit = new NewCommit("This is a new commit", firstTreeResult.Sha); var firstCommitResult = await _client.GitDatabase.Commit.Create(_owner, _repository.Name, firstCommit); var newReference = new NewReference("heads/develop", firstCommitResult.Sha); await _fixture.Create(_owner, _repository.Name, newReference); var secondTree = new NewTree(); secondTree.Tree.Add(new NewTreeItem { Mode = FileMode.File, Type = TreeType.Blob, Path = "README.md", Sha = secondBlobResult.Sha }); var secondTreeResult = await _client.GitDatabase.Tree.Create(_owner, _repository.Name, secondTree); var secondCommit = new NewCommit("This is a new commit", secondTreeResult.Sha, firstCommitResult.Sha); var secondCommitResult = await _client.GitDatabase.Commit.Create(_owner, _repository.Name, secondCommit); var referenceUpdate = new ReferenceUpdate(secondCommitResult.Sha); var result = await _fixture.Update(_owner, _repository.Name, "heads/develop", referenceUpdate); Assert.Equal(secondCommitResult.Sha, result.Object.Sha); }
public BranchInfo CreateBranch(string folderPath, string displayName, string parentBranchId) { if (string.IsNullOrEmpty(displayName)) { throw new ArgumentNullException(nameof(displayName)); } if ((parentBranchId != null) && string.IsNullOrEmpty(parentBranchId)) { throw new ArgumentException(nameof(parentBranchId)); } var client = GetClient(); var parentBranchSha = GetParentBranchSha(parentBranchId, client); var newReference = new NewReference( displayName.ToBranchName(), parentBranchSha); client.Git.Reference .Create( GetSetting(GitHubItSettingKeys.RepositoryOwner), GetSetting(GitHubItSettingKeys.RepositoryName), newReference) .Wait(); var branch = client.Repository .GetBranch( GetSetting(GitHubItSettingKeys.RepositoryOwner), GetSetting(GitHubItSettingKeys.RepositoryName), displayName) .Result; if (branch == null) { return(null); } var branchInfo = branch.ToModel(); var repoInfo = client.Repository.Get( GetSetting(GitHubItSettingKeys.RepositoryOwner), GetSetting(GitHubItSettingKeys.RepositoryName)) .Result; branchInfo.IsDefault = repoInfo.DefaultBranch == branchInfo.Name; return(branchInfo); }
public void CanBorrowFromNewReference() { var dict = new PyDict(); NewReference reference = Runtime.PyDict_Items(dict.Handle); try { PythonException.ThrowIfIsNotZero(Runtime.PyList_Reverse(reference)); } finally { reference.Dispose(); } }
/// <summary> /// Creates a branch, based off the master branch. /// </summary> /// <param name="referencesClient">The <see cref="IReferencesClient" /> this method extends</param> /// <param name="owner">The owner of the repository.</param> /// <param name="name">The name of the repository.</param> /// <param name="branchName">The new branch name</param> public static async Task<Reference> CreateBranch(this IReferencesClient referencesClient, string owner, string name, string branchName) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(branchName, "branchName"); if (branchName.StartsWith("refs/heads")) { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "The specified branch name '{0}' appears to be a ref name and not a branch name because it starts with the string 'refs/heads'. Either specify just the branch name or use the Create method if you need to specify the full ref name", branchName), "branchName"); } var baseBranch = await referencesClient.Get(owner, name, "heads/master").ConfigureAwait(false); var newReference = new NewReference("refs/heads/" + branchName, baseBranch.Object.Sha); return await referencesClient.Create(owner, name, newReference).ConfigureAwait(false); }
/// <summary> /// Creates a branch, based off the branch specified. /// </summary> /// <param name="referencesClient">The <see cref="IReferencesClient" /> this method extends</param> /// <param name="owner">The owner of the repository.</param> /// <param name="name">The name of the repository.</param> /// <param name="branchName">The new branch name</param> /// <param name="baseReference">The <see cref="Reference" /> to base the branch from</param> public static async Task <Reference> CreateBranch(this IReferencesClient referencesClient, string owner, string name, string branchName, Reference baseReference) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(branchName, "branchName"); Ensure.ArgumentNotNull(baseReference, "baseReference"); if (branchName.StartsWith("refs/heads")) { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "The specified branch name '{0}' appears to be a ref name and not a branch name because it starts with the string 'refs/heads'. Either specify just the branch name or use the Create method if you need to specify the full ref name", branchName), "branchName"); } var newReference = new NewReference("refs/heads/" + branchName, baseReference.Object.Sha); return(await referencesClient.Create(owner, name, newReference).ConfigureAwait(false)); }
public void MoveToPyObject_SetsNull() { var dict = new PyDict(); NewReference reference = Runtime.PyDict_Items(dict.Handle); try { Assert.IsFalse(reference.IsNull()); using (reference.MoveToPyObject()) Assert.IsTrue(reference.IsNull()); } finally { reference.Dispose(); } }
public override ValueType Execute(ValueType arg) { // handle refering a clr object created in previous domain, // it should had been deserialized and became callable agian. using var handle = NewReference.DangerousFromPointer((IntPtr)arg); try { using (Py.GIL()) { BorrowedReference tp = Runtime.Runtime.PyObject_TYPE(handle.Borrow()); IntPtr tp_clear = Util.ReadIntPtr(tp, TypeOffset.tp_clear); Assert.That(tp_clear, Is.Not.Null); using (PyObject obj = new PyObject(handle.Steal())) { obj.InvokeMethod("Method"); obj.InvokeMethod("StaticMethod"); using (var scope = Py.CreateScope()) { scope.Set("obj", obj); scope.Exec(@" obj.Method() obj.StaticMethod() obj.Property += 1 obj.Field += 10 "); } var clrObj = obj.As <Domain.MyClass>(); Assert.AreEqual(clrObj.Property, 2); Assert.AreEqual(clrObj.Field, 20); } } } catch (Exception e) { Debug.WriteLine(e); throw; } return(0); }
public async Task <string> CreateAsync(string name) { var newRepo = new NewRepository(name) { AutoInit = true }; var repository = await Client.Repository.Create(newRepo).ConfigureAwait(false); var newLabels = Configuration.repository.labels.Select(label => new NewLabel(label.name, label.color)).ToList(); foreach (var newLabel in newLabels) { await Client.Issue.Labels.Create(repository.Owner.Login, repository.Name, newLabel).ConfigureAwait(false); } foreach (var branch in Configuration.repository.branches) { var master = await Client.GitDatabase.Reference.Get(repository.Owner.Login, repository.Name, "heads/master") .ConfigureAwait(false); var reference = new NewReference($"refs/heads/{branch.Name}", master.Object.Sha); var createdReference = await Client.GitDatabase.Reference.Create(repository.Owner.Login, repository.Name, reference) .ConfigureAwait(false); if (branch.IsDefault) { var repositoryUpdate = new RepositoryUpdate(); repositoryUpdate.Name = repository.Name; repositoryUpdate.DefaultBranch = branch.Name; await Client.Repository.Edit(repository.Owner.Login, repository.Name, repositoryUpdate).ConfigureAwait(false); } } return(repository.HtmlUrl); }
public static IntPtr CreateObjectType() { using var globals = NewReference.DangerousFromPointer(Runtime.PyDict_New()); if (Runtime.PyDict_SetItemString(globals, "__builtins__", Runtime.PyEval_GetBuiltins()) != 0) { globals.Dispose(); throw new PythonException(); } const string code = "class A(object): pass"; using var resRef = Runtime.PyRun_String(code, RunFlagType.File, globals, globals); if (resRef.IsNull()) { globals.Dispose(); throw new PythonException(); } resRef.Dispose(); BorrowedReference A = Runtime.PyDict_GetItemString(globals, "A"); Debug.Assert(!A.IsNull); return(new NewReference(A).DangerousMoveToPointer()); }
public async Task <Reference> Create(NewReference newRef) { var tags = newRef.Tags == null ? new List <string>() : newRef.Tags.Split(",").Select(t => t.Trim()); var id = ObjectId.GenerateNewId().ToString(); var newPath = string.Join('-', Path.GetFileNameWithoutExtension(newRef.File.FileName), id) + Path.GetExtension(newRef.File.FileName); var dest = Path.Combine(_env.WebRootPath, "uploads", newPath); using var stream = File.Create(dest); await newRef.File.CopyToAsync(stream); var reference = new Reference { Id = id, Name = newRef.Name, Description = newRef.Description, Tags = tags, CreatedAt = DateTime.Now, Path = newPath }; await _refs.InsertOneAsync(reference); return(reference); }
public async Task PostsToCorrectUrl() { var newReference = new NewReference("heads/develop", "sha"); var connection = Substitute.For<IApiConnection>(); var client = new ReferencesClient(connection); await client.Create("owner", "repo", newReference); connection.Received().Post<Reference>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/repo/git/refs"), newReference); }
public void PostsToCorrectUrlWithRepositoryId() { var newReference = new NewReference("heads/develop", "sha"); var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableReferencesClient(gitHubClient); client.Create(1, newReference); gitHubClient.Received().Git.Reference.Create(1, newReference); }
public void EnforcesRefsPrefix() { var create = new NewReference("heads/develop", "sha"); Assert.Equal("refs/heads/develop", create.Ref); }
/// <summary> /// Creates a reference for a given repository /// </summary> /// <remarks> /// http://developer.github.com/v3/git/refs/#create-a-reference /// </remarks> /// <param name="repositoryId">The ID of the repository</param> /// <param name="reference">The reference to create</param> /// <returns></returns> public IObservable<Reference> Create(int repositoryId, NewReference reference) { Ensure.ArgumentNotNull(reference, "reference"); return _reference.Create(repositoryId, reference).ToObservable(); }
/// <summary> /// Creates a reference for a given repository /// </summary> /// <remarks> /// http://developer.github.com/v3/git/refs/#create-a-reference /// </remarks> /// <param name="repositoryId">The Id of the repository</param> /// <param name="reference">The reference to create</param> /// <returns></returns> public IObservable <Reference> Create(long repositoryId, NewReference reference) { Ensure.ArgumentNotNull(reference, nameof(reference)); return(_reference.Create(repositoryId, reference).ToObservable()); }