Permalink
Browse files

henon entered the plan. i will "fast forward" the development speed

* Gitty.Core is now a "real" standalone project (git-sharp) and got its own solution.
* added testgui that can execute the unit tests. cool for debugging!!!
* ported a lot of unit tests and a lot of code to get them working
* fixed some errors in the existing ported code
* ... and had a lot of fun ;)

Signed-off-by: henon <meinrad.recheis@gmail.com>
  • Loading branch information...
1 parent f42efb8 commit 92300d82e3c10f3a7a35652d9a770c487795a64a @henon committed Jun 13, 2009
Showing with 7,604 additions and 99 deletions.
  1. +1 −0 .gitignore
  2. +5 −3 AnyObjectId.cs
  3. +51 −29 Commit.cs
  4. +411 −0 Constants.cs
  5. +27 −13 FileMode.cs
  6. +6 −2 Gitty.Core.csproj
  7. +10 −0 LockFile.cs
  8. +387 −0 ObjectChecker.cs
  9. +5 −4 PersonIdent.cs
  10. +46 −39 RepositoryConfig.cs
  11. +8 −0 TestGUI/App.xaml
  12. +16 −0 TestGUI/App.xaml.cs
  13. +66 −0 TestGUI/Browser.xaml
  14. +53 −0 TestGUI/Browser.xaml.cs
  15. +55 −0 TestGUI/Properties/AssemblyInfo.cs
  16. +71 −0 TestGUI/Properties/Resources.Designer.cs
  17. +117 −0 TestGUI/Properties/Resources.resx
  18. +30 −0 TestGUI/Properties/Settings.Designer.cs
  19. +7 −0 TestGUI/Properties/Settings.settings
  20. +66 −0 TestGUI/TestFixtureView.cs
  21. +123 −0 TestGUI/TestGUI.csproj
  22. +32 −0 TestGUI/TestRunner.xaml
  23. +336 −0 TestGUI/TestRunner.xaml.cs
  24. +92 −0 TestGUI/TestcaseView.cs
  25. BIN TestGUI/screenshot01.png
  26. BIN Tests/Dependencies/nunit.framework.dll
  27. +78 −8 Tests/Gitty.Core.Tests.csproj
  28. +1,626 −0 Tests/ObjectCheckerTests.cs
  29. +111 −1 Tests/ObjectIdTests.cs
  30. +123 −0 Tests/PersonIdentTests.cs
  31. +328 −0 Tests/RepositoryTestCase.cs
  32. +96 −0 Tests/Resources/all_packed_objects.txt
  33. +155 −0 Tests/Resources/create-second-pack
  34. BIN Tests/Resources/gitgit.index
  35. +1,437 −0 Tests/Resources/gitgit.lsfiles
  36. +331 −0 Tests/Resources/gitgit.lstree
  37. BIN Tests/Resources/pack-3280af9c07ee18a87705ef50b0cc4cd20266cf12.idx
  38. BIN Tests/Resources/pack-3280af9c07ee18a87705ef50b0cc4cd20266cf12.pack
  39. BIN Tests/Resources/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx
  40. BIN Tests/Resources/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idxV2
  41. BIN Tests/Resources/pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.pack
  42. BIN Tests/Resources/pack-546ff360fe3488adb20860ce3436a2d6373d2796.idx
  43. BIN Tests/Resources/pack-546ff360fe3488adb20860ce3436a2d6373d2796.pack
  44. BIN Tests/Resources/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.idx
  45. BIN Tests/Resources/pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745.pack
  46. BIN Tests/Resources/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx
  47. BIN Tests/Resources/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idxV2
  48. BIN Tests/Resources/pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.pack
  49. BIN Tests/Resources/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.idx
  50. BIN Tests/Resources/pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa.pack
  51. BIN Tests/Resources/pack-huge.idx
  52. +33 −0 Tests/Resources/packed-refs
  53. +13 −0 Tests/TestUtils.cs
  54. +317 −0 Tests/TreeTests.cs
  55. +73 −0 Util/ISystemReader.cs
  56. +54 −0 Util/MutableInteger.cs
  57. +32 −0 Util/Numbers.cs
  58. +729 −0 Util/RawParseUtils.cs
  59. +15 −0 Util/String.cs
  60. +32 −0 git-sharp.sln
View
@@ -7,3 +7,4 @@ bin
obj
*.user
*.suo
+*.bak
View
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2008, Kevin Thompson <kevin.thompson@theautomaters.com>
+ * Copyright (C) 2009, Henon <meinrad.recheis@gmail.com>
*
* All rights reserved.
*
@@ -59,7 +60,7 @@ internal class Constants
public static readonly int StringLength = ObjectIdLength * 2;
}
-
+
public static bool operator ==(AnyObjectId a, AnyObjectId b)
{
if ((object)a == null)
@@ -81,7 +82,7 @@ internal class Constants
public virtual bool Equals(AnyObjectId obj)
{
- return (obj != null) ? Equals(this, obj) : false;
+ return (obj != null) ? this == obj : false;
}
public override bool Equals(object obj)
@@ -231,7 +232,8 @@ public override string ToString()
return new string(ToHexCharArray());
}
- public ObjectId Copy() {
+ public ObjectId Copy()
+ {
if (this.GetType() == typeof(ObjectId))
return (ObjectId)this;
return new ObjectId(this);
View
@@ -3,6 +3,7 @@
* Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2007, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2008, Kevin Thompson <kevin.thompson@theautomaters.com>
+ * Copyright (C) 2009, Henon <meinrad.recheis@gmail.com>
*
* All rights reserved.
*
@@ -139,38 +140,38 @@ public Commit(Repository db, ObjectId id, byte[] raw)
private ObjectId treeId;
public ObjectId TreeId
- {
- get
- {
- return treeId;
- }
- set
- {
- if (treeId == null || !treeId.Equals(value))
- {
- treeEntry = null;
- }
- treeId = value;
+ {
+ get
+ {
+ return treeId;
}
- }
-
+ set
+ {
+ if (treeId == null || !treeId.Equals(value))
+ {
+ treeEntry = null;
+ }
+ treeId = value;
+ }
+ }
+
private Tree treeEntry;
public Tree TreeEntry
- {
- get
- {
- if (treeEntry == null)
- {
- treeEntry = Repository.MapTree(this.TreeId);
- if (treeEntry == null)
- throw new MissingObjectException(this.TreeId, ObjectType.Tree);
- }
- return treeEntry;
- }
- set
- {
- treeId = value.TreeId;
- treeEntry = value;
+ {
+ get
+ {
+ if (treeEntry == null)
+ {
+ treeEntry = Repository.MapTree(this.TreeId);
+ if (treeEntry == null)
+ throw new MissingObjectException(this.TreeId, ObjectType.Tree);
+ }
+ return treeEntry;
+ }
+ set
+ {
+ treeId = value.TreeId;
+ treeEntry = value;
}
}
@@ -181,6 +182,27 @@ public Tree TreeEntry
public Encoding Encoding { get; set; }
public Repository Repository { get; protected set; }
+ // Returns all ancestor-commits of this commit
+ public IEnumerable<Commit> Ancestors
+ {
+ get
+ {
+ var ancestors = new Dictionary<ObjectId, Commit>();
+ CollectAncestorIdsRecursive(this, ancestors);
+ return ancestors.Values.ToArray();
+ }
+ }
+
+ private static void CollectAncestorIdsRecursive(Commit commit, Dictionary<ObjectId,Commit> ancestors)
+ {
+ foreach (var parent in commit.ParentIds.Where(id => !ancestors.ContainsKey(id)).Select(id => commit.Repository.OpenCommit(id)))
+ {
+ var parent_commit = parent as Commit;
+ ancestors[parent_commit.CommitId] = parent_commit;
+ CollectAncestorIdsRecursive(parent_commit, ancestors);
+ }
+ }
+
private string message;
public string Message
{
Oops, something went wrong. Retry.

0 comments on commit 92300d8

Please sign in to comment.