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

« back to all changes in this revision

Viewing changes to external/ngit/NGit/NGit.Transport/Transport.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:
78
78
                        PUSH
79
79
                }
80
80
 
81
 
                private static readonly IList<WeakReference<TransportProtocol>> protocols = new CopyOnWriteArrayList
82
 
                        <WeakReference<TransportProtocol>>();
 
81
                private static readonly IList<JavaWeakReference<TransportProtocol>> protocols = new 
 
82
                        CopyOnWriteArrayList<JavaWeakReference<TransportProtocol>>();
83
83
 
84
84
                static Transport()
85
85
                {
94
94
                        Register(TransportGitSsh.PROTO_SSH);
95
95
//                      RegisterByService();
96
96
                }
97
 
 
98
 
/*              private static void RegisterByService()
 
97
                /*
 
98
                private static void RegisterByService()
99
99
                {
100
100
                        ClassLoader ldr = Sharpen.Thread.CurrentThread().GetContextClassLoader();
101
101
                        if (ldr == null)
238
238
                /// <param name="proto">the protocol definition. Must not be null.</param>
239
239
                public static void Register(TransportProtocol proto)
240
240
                {
241
 
                        protocols.Add(0, new WeakReference<TransportProtocol>(proto));
 
241
                        protocols.Add(0, new JavaWeakReference<TransportProtocol>(proto));
242
242
                }
243
243
 
244
244
                /// <summary>Unregister a TransportProtocol instance.</summary>
256
256
                /// <param name="proto">the exact object previously given to register.</param>
257
257
                public static void Unregister(TransportProtocol proto)
258
258
                {
259
 
                        foreach (WeakReference<TransportProtocol> @ref in protocols)
 
259
                        foreach (JavaWeakReference<TransportProtocol> @ref in protocols)
260
260
                        {
261
261
                                TransportProtocol refProto = @ref.Get();
262
262
                                if (refProto == null || refProto == proto)
273
273
                {
274
274
                        int cnt = protocols.Count;
275
275
                        IList<TransportProtocol> res = new AList<TransportProtocol>(cnt);
276
 
                        foreach (WeakReference<TransportProtocol> @ref in protocols)
 
276
                        foreach (JavaWeakReference<TransportProtocol> @ref in protocols)
277
277
                        {
278
278
                                TransportProtocol proto = @ref.Get();
279
279
                                if (proto != null)
610
610
                public static NGit.Transport.Transport Open(Repository local, URIish uri, string 
611
611
                        remoteName)
612
612
                {
613
 
                        foreach (WeakReference<TransportProtocol> @ref in protocols)
 
613
                        foreach (JavaWeakReference<TransportProtocol> @ref in protocols)
614
614
                        {
615
615
                                TransportProtocol proto = @ref.Get();
616
616
                                if (proto == null)
627
627
                                , uri));
628
628
                }
629
629
 
 
630
                /// <summary>Open a new transport with no local repository.</summary>
 
631
                /// <remarks>Open a new transport with no local repository.</remarks>
 
632
                /// <param name="uri"></param>
 
633
                /// <returns>new Transport instance</returns>
 
634
                /// <exception cref="System.NotSupportedException">System.NotSupportedException</exception>
 
635
                /// <exception cref="NGit.Errors.TransportException">NGit.Errors.TransportException</exception>
 
636
                public static NGit.Transport.Transport Open(URIish uri)
 
637
                {
 
638
                        foreach (JavaWeakReference<TransportProtocol> @ref in protocols)
 
639
                        {
 
640
                                TransportProtocol proto = @ref.Get();
 
641
                                if (proto == null)
 
642
                                {
 
643
                                        protocols.Remove(@ref);
 
644
                                        continue;
 
645
                                }
 
646
                                if (proto.CanHandle(uri, null, null))
 
647
                                {
 
648
                                        return proto.Open(uri);
 
649
                                }
 
650
                        }
 
651
                        throw new NGit.Errors.NotSupportedException(MessageFormat.Format(JGitText.Get().URINotSupported
 
652
                                , uri));
 
653
                }
 
654
 
630
655
                /// <summary>
631
656
                /// Convert push remote refs update specification from
632
657
                /// <see cref="RefSpec">RefSpec</see>
868
893
                        this.credentialsProvider = CredentialsProvider.GetDefault();
869
894
                }
870
895
 
 
896
                /// <summary>Create a minimal transport instance not tied to a single repository.</summary>
 
897
                /// <remarks>Create a minimal transport instance not tied to a single repository.</remarks>
 
898
                /// <param name="uri"></param>
 
899
                protected internal Transport(URIish uri)
 
900
                {
 
901
                        this.uri = uri;
 
902
                        this.local = null;
 
903
                        this.checkFetchedObjects = true;
 
904
                        this.credentialsProvider = CredentialsProvider.GetDefault();
 
905
                }
 
906
 
871
907
                /// <summary>Get the URI this transport connects to.</summary>
872
908
                /// <remarks>
873
909
                /// Get the URI this transport connects to.