Beispiel #1
0
        public static void Export(string svnFileUrl, uint pegRevision, string targetPath,
                                  bool force            = false,
                                  bool ignore_externals = false,
                                  bool ignore_keywords  = false)
        {
            if (String.IsNullOrEmpty(svnFileUrl))
            {
                throw new Exception("svnFileUrl is empty");
            }

            if (pegRevision == 0)
            {
                throw new Exception("pegRevision is 0");
            }

            if (String.IsNullOrEmpty(targetPath))
            {
                throw new Exception("targetPath is empty");
            }

            string fileAtPegRevision = String.Format("{0}@{1}", svnFileUrl, pegRevision);

            BridgeCliOpt opt = new BridgeCliOpt
            {
                force            = Convert.ToInt32(force),
                ignore_externals = Convert.ToInt32(ignore_externals),
                ignore_keywords  = Convert.ToInt32(ignore_keywords)
            };

            ExportCmd cmd    = new ExportCmd();
            IntPtr    source = NativeStringHelper.StringToNativeUtf8(fileAtPegRevision);
            IntPtr    to     = NativeStringHelper.StringToNativeUtf8(targetPath);

            cmd.Run(source, to, opt);
        }
Beispiel #2
0
        public static LogCmdResult Log(ICollection <string> urls, ICollection <uint> revisions,
                                       LogRevisionMode revisionMode = LogRevisionMode.Change,
                                       Depth depth          = Depth.svn_depth_unknown,
                                       Depth setDepth       = Depth.svn_depth_unknown,
                                       int limit            = 0,
                                       bool stopOnCopy      = false,
                                       bool useMergeHistory = true)
        {
            if (urls.Count <= 0)
            {
                throw new Exception("Empty urls");
            }

            SortedSet <uint> filteredRevisions = new SortedSet <uint>(revisions, new RevisionComparer());

            switch (revisionMode)
            {
            case LogRevisionMode.RevisionRanges:
                throw new NotImplementedException();

            case LogRevisionMode.Change:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(revisionMode), revisionMode, null);
            }

            LogCmd       logCmd = new LogCmd();
            BridgeCliOpt opt    = new BridgeCliOpt
            {
                depth             = (int)depth,
                set_depth         = (int)setDepth,
                limit             = limit,
                verbose           = Convert.ToInt32(true),
                stop_on_copy      = Convert.ToInt32(stopOnCopy),
                use_merge_history = Convert.ToInt32(useMergeHistory)
            };

            List <IntPtr> nativeUtf8 = new List <IntPtr>();

            foreach (string url in urls)
            {
                if (String.IsNullOrEmpty(url))
                {
                    throw new Exception("url is empty");
                }

                nativeUtf8.Add(NativeStringHelper.StringToNativeUtf8(url));
            }

            BridgeCli.LogCmdResult cliResult = logCmd.Run(nativeUtf8, filteredRevisions, opt);

            return(ParseCliResult(cliResult));
        }