~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ngit/NGit.Test/NGit.Submodule/SubmoduleUpdateTest.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
        [NUnit.Framework.TestFixture]
60
60
        public class SubmoduleUpdateTest : RepositoryTestCase
61
61
        {
 
62
                /// <exception cref="NGit.Api.Errors.GitAPIException"></exception>
62
63
                [NUnit.Framework.Test]
63
64
                public virtual void RepositoryWithNoSubmodules()
64
65
                {
79
80
                        string path = "sub";
80
81
                        DirCache cache = db.LockDirCache();
81
82
                        DirCacheEditor editor = cache.Editor();
82
 
                        editor.Add(new _PathEdit_93(commit, path));
 
83
                        editor.Add(new _PathEdit_94(commit, path));
83
84
                        editor.Commit();
84
85
                        StoredConfig config = ((FileBasedConfig)db.GetConfig());
85
86
                        config.SetString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.
98
99
                        SubmoduleWalk generator = SubmoduleWalk.ForIndex(db);
99
100
                        NUnit.Framework.Assert.IsTrue(generator.Next());
100
101
                        Repository subRepo = generator.GetRepository();
 
102
                        AddRepoToClose(subRepo);
101
103
                        NUnit.Framework.Assert.IsNotNull(subRepo);
102
104
                        NUnit.Framework.Assert.AreEqual(commit, subRepo.Resolve(Constants.HEAD));
103
105
                }
104
106
 
105
 
                private sealed class _PathEdit_93 : DirCacheEditor.PathEdit
 
107
                private sealed class _PathEdit_94 : DirCacheEditor.PathEdit
106
108
                {
107
 
                        public _PathEdit_93(RevCommit commit, string baseArg1) : base(baseArg1)
 
109
                        public _PathEdit_94(RevCommit commit, string baseArg1) : base(baseArg1)
108
110
                        {
109
111
                                this.commit = commit;
110
112
                        }
119
121
                }
120
122
 
121
123
                /// <exception cref="System.IO.IOException"></exception>
 
124
                /// <exception cref="NGit.Api.Errors.GitAPIException"></exception>
122
125
                [NUnit.Framework.Test]
123
126
                public virtual void RepositoryWithUnconfiguredSubmodule()
124
127
                {
126
129
                        string path = "sub";
127
130
                        DirCache cache = db.LockDirCache();
128
131
                        DirCacheEditor editor = cache.Editor();
129
 
                        editor.Add(new _PathEdit_134(id, path));
 
132
                        editor.Add(new _PathEdit_137(id, path));
130
133
                        editor.Commit();
131
134
                        FileBasedConfig modulesConfig = new FileBasedConfig(new FilePath(db.WorkTree, Constants
132
135
                                .DOT_GIT_MODULES), db.FileSystem);
145
148
                        NUnit.Framework.Assert.IsTrue(updated.IsEmpty());
146
149
                }
147
150
 
148
 
                private sealed class _PathEdit_134 : DirCacheEditor.PathEdit
 
151
                private sealed class _PathEdit_137 : DirCacheEditor.PathEdit
149
152
                {
150
 
                        public _PathEdit_134(ObjectId id, string baseArg1) : base(baseArg1)
 
153
                        public _PathEdit_137(ObjectId id, string baseArg1) : base(baseArg1)
151
154
                        {
152
155
                                this.id = id;
153
156
                        }
162
165
                }
163
166
 
164
167
                /// <exception cref="System.IO.IOException"></exception>
 
168
                /// <exception cref="NGit.Api.Errors.GitAPIException"></exception>
165
169
                [NUnit.Framework.Test]
166
170
                public virtual void RepositoryWithInitializedSubmodule()
167
171
                {
169
173
                        string path = "sub";
170
174
                        DirCache cache = db.LockDirCache();
171
175
                        DirCacheEditor editor = cache.Editor();
172
 
                        editor.Add(new _PathEdit_168(id, path));
 
176
                        editor.Add(new _PathEdit_172(id, path));
173
177
                        editor.Commit();
174
178
                        Repository subRepo = Git.Init().SetBare(false).SetDirectory(new FilePath(db.WorkTree
175
179
                                , path)).Call().GetRepository();
180
184
                        NUnit.Framework.Assert.IsTrue(updated.IsEmpty());
181
185
                }
182
186
 
183
 
                private sealed class _PathEdit_168 : DirCacheEditor.PathEdit
 
187
                private sealed class _PathEdit_172 : DirCacheEditor.PathEdit
184
188
                {
185
 
                        public _PathEdit_168(ObjectId id, string baseArg1) : base(baseArg1)
 
189
                        public _PathEdit_172(ObjectId id, string baseArg1) : base(baseArg1)
186
190
                        {
187
191
                                this.id = id;
188
192
                        }