public void testAddURI() { readConfig(string.Empty); URIish uri = new URIish("/some/dir"); RemoteConfig rc = new RemoteConfig(config, "backup"); Assert.AreEqual(0, rc.URIs.Count); Assert.IsTrue(rc.AddURI(uri)); Assert.AreEqual(1, rc.URIs.Count); Assert.AreSame(uri, rc.URIs[0]); Assert.IsFalse(rc.AddURI(new URIish(uri.ToString()))); Assert.AreEqual(1, rc.URIs.Count); }
public void test017_SaveAllTags() { RemoteConfig rc = new RemoteConfig(db.Config, "origin"); rc.AddURI(new URIish("/some/dir")); rc.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + rc.Name + "/*")); rc.SetTagOpt(TagOpt.FETCH_TAGS); rc.Update(db.Config); db.Config.Save(); checkFile(new FileInfo(Path.Combine(db.Directory.ToString(), "config")), "[core]\n" + "\trepositoryformatversion = 0\n" + "\tfilemode = true\n" + "[remote \"origin\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/origin/*\n" + "\ttagopt = --tags\n"); }
public void test013_SaveAddURI() { writeConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" + "fetch = +refs/heads/*:refs/remotes/spearce/*\n"); RemoteConfig rc = new RemoteConfig(db.Config, "spearce"); rc.AddURI(new URIish("/some/dir")); Assert.AreEqual(2, rc.URIs.Count); rc.Update(db.Config); db.Config.Save(); checkFile(new FileInfo(Path.Combine(db.Directory.ToString(), "config")), "[core]\n" + "\trepositoryformatversion = 0\n" + "\tfilemode = true\n" + "[remote \"spearce\"]\n" + "\turl = http://www.spearce.org/egit.git\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/spearce/*\n"); }
public void test011_RemoveOnlyURI() { writeConfig(""); URIish a = new URIish("/some/dir"); RemoteConfig rc = new RemoteConfig(db.Config, "backup"); Assert.IsTrue(rc.AddURI(a)); Assert.AreEqual(1, rc.URIs.Count); Assert.AreSame(a, rc.URIs[0]); Assert.IsTrue(rc.RemoveURI(a)); Assert.AreEqual(0, rc.URIs.Count); }
public void test010_RemoveLastURI() { writeConfig(""); URIish a = new URIish("/some/dir"); URIish b = new URIish("/another/dir"); URIish c = new URIish("/more/dirs"); RemoteConfig rc = new RemoteConfig(db.Config, "backup"); Assert.IsTrue(rc.AddURI(a)); Assert.IsTrue(rc.AddURI(b)); Assert.IsTrue(rc.AddURI(c)); Assert.AreEqual(3, rc.URIs.Count); Assert.AreSame(a, rc.URIs[0]); Assert.AreSame(b, rc.URIs[1]); Assert.AreEqual(c, rc.URIs[2]); Assert.IsTrue(rc.RemoveURI(c)); Assert.AreEqual(2, rc.URIs.Count); Assert.AreSame(a, rc.URIs[0]); Assert.AreSame(b, rc.URIs[1]); }
public void test016_SaveNoTags() { RemoteConfig rc = new RemoteConfig(db.Config, "origin"); rc.AddURI(new URIish("/some/dir")); rc.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + rc.Name + "/*")); rc.SetTagOpt(TagOpt.NO_TAGS); rc.Update(db.Config); db.Config.save(); checkFile(db.Config.getFile(), "[core]\n" + "\trepositoryformatversion = 0\n" + "\tfilemode = true\n" + "[remote \"origin\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/origin/*\n" + "\ttagopt = --no-tags\n"); }
private void saveRemote(URIish uri) { RemoteConfig rc = new RemoteConfig(db.Config, remoteName); rc.AddURI(uri); rc.AddFetchRefSpec(new RefSpec().SetForce(true).SetSourceDestination(Constants.R_HEADS + "*", Constants.R_REMOTES + remoteName + "/*")); rc.Update(db.Config); db.Config.save(); }
public void test007_AddURI() { writeConfig(""); URIish uri = new URIish("/some/dir"); RemoteConfig rc = new RemoteConfig(db.Config, "backup"); Assert.AreEqual(0, rc.URIs.Count); Assert.True(rc.AddURI(uri)); Assert.AreEqual(1, rc.URIs.Count); Assert.AreSame(uri, rc.URIs[0]); Assert.False(rc.AddURI(new URIish(uri.ToString()))); Assert.AreEqual(1, rc.URIs.Count); }
public void testSaveTimeout() { RemoteConfig rc = new RemoteConfig(config, "origin"); rc.AddURI(new URIish("/some/dir")); rc.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + rc.Name + "/*")); rc.Timeout = 60; rc.Update(config); checkConfig("[remote \"origin\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/origin/*\n" + "\ttimeout = 60\n"); }
public void testSaveNoTags() { RemoteConfig rc = new RemoteConfig(config, "origin"); rc.AddURI(new URIish("/some/dir")); rc.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + rc.Name + "/*")); rc.SetTagOpt(TagOpt.NO_TAGS); rc.Update(config); checkConfig("[remote \"origin\"]\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/origin/*\n" + "\ttagopt = --no-tags\n"); }
public void testSaveAddURI() { readConfig("[remote \"spearce\"]\n" + "url = http://www.spearce.org/egit.git\n" + "fetch = +refs/heads/*:refs/remotes/spearce/*\n"); RemoteConfig rc = new RemoteConfig(config, "spearce"); rc.AddURI(new URIish("/some/dir")); Assert.AreEqual(2, rc.URIs.Count); rc.Update(config); checkConfig("[remote \"spearce\"]\n" + "\turl = http://www.spearce.org/egit.git\n" + "\turl = /some/dir\n" + "\tfetch = +refs/heads/*:refs/remotes/spearce/*\n"); }
public void testRemoveOnlyURI() { readConfig(string.Empty); URIish a = new URIish("/some/dir"); RemoteConfig rc = new RemoteConfig(config, "backup"); Assert.IsTrue(rc.AddURI(a)); Assert.AreEqual(1, rc.URIs.Count); Assert.AreSame(a, rc.URIs[0]); Assert.IsTrue(rc.RemoveURI(a)); Assert.AreEqual(0, rc.URIs.Count); }
public void testRemoveMiddleURI() { readConfig(string.Empty); URIish a = new URIish("/some/dir"); URIish b = new URIish("/another/dir"); URIish c = new URIish("/more/dirs"); RemoteConfig rc = new RemoteConfig(config, "backup"); Assert.IsTrue(rc.AddURI(a)); Assert.IsTrue(rc.AddURI(b)); Assert.IsTrue(rc.AddURI(c)); Assert.AreEqual(3, rc.URIs.Count); Assert.AreSame(a, rc.URIs[0]); Assert.AreSame(b, rc.URIs[1]); Assert.AreEqual(c, rc.URIs[2]); Assert.IsTrue(rc.RemoveURI(b)); Assert.AreEqual(2, rc.URIs.Count); Assert.AreSame(a, rc.URIs[0]); Assert.AreSame(c, rc.URIs[1]); }