Ejemplo n.º 1
0
        public override void Ignore(FilePath[] paths)
        {
            string result;

            lock (client) {
                foreach (var path in paths)
                {
                    if (client.GetProperty(new SvnPathTarget(path.ParentDirectory), SvnPropertyNames.SvnIgnore, out result))
                    {
                        client.SetProperty(path.ParentDirectory, SvnPropertyNames.SvnIgnore, result + path.FileName);
                    }
                }
            }
        }
        public string ComposeForPath(string wc)
        {
            // find root (where .svn reside)
            var wcRoot = SvnUtils.FindSvnWC(wc);
            if (wcRoot == null)
                throw new ApplicationException("Can't find working copy root for " + wc);

            using (_client = new SvnClient())
            {
                var wcTarg = new SvnPathTarget(wcRoot);

                SvnInfoEventArgs info;
                _client.GetInfo(wcTarg, out info);
                _cancellationToken.ThrowIfCancellationRequested();
                _repoRoot = info.RepositoryRoot;
                _requestedMergeMessageForBranch = "/" + info.Path.Trim('/') + "/";

                SvnTargetPropertyCollection mergeInfoPre;
                if (!_client.GetProperty(wcTarg, "svn:mergeinfo", new SvnGetPropertyArgs { Revision = SvnRevision.Base }, out mergeInfoPre))
                    throw new ApplicationException("Error in GetProperty");

                string mergeInfoNew;
                if (!_client.GetProperty(wcTarg, "svn:mergeinfo", out mergeInfoNew))
                    throw new ApplicationException("Error in GetProperty");

                var baseMergeInfo = new Dictionary<string, RevRangeSet>();

                if (mergeInfoPre != null && mergeInfoPre.Count != 0)
                {
                    baseMergeInfo = ParseMegeinfoLines(mergeInfoPre[0].StringValue);
                }

                var currentMergeInfo = ParseMegeinfoLines(mergeInfoNew);

                var newRevs = Subtract(currentMergeInfo, baseMergeInfo);

                LoadLogEntries(newRevs);

                return BuildMessage(newRevs);
            }
        }
Ejemplo n.º 3
0
        //static void Test1()
        //{
        //	var cwd = System.IO.Directory.GetCurrentDirectory();
        //	using (Lua lua = new Lua())
        //	{
        //		lua.State.Encoding = Encoding.UTF8;
        //		//lua.DoString("Externals={{Path='Bin', Name='All', URL='myUrl/blabla' }} res = 'Файл'");
        //		lua.DoFile("Config/Templates/IG/externals.lua");
        //		//string res = (string)lua["res"];
        //		var exts = lua["Externals"] as LuaTable;
        //		foreach( LuaTable ext in exts.Values )
        //		{
        //			var path = (string)ext["Path"];
        //			var name = (string)ext["Name"];
        //			var unknown = (string)ext["unknown"];
        //		}
        //		//int i = 1;
        //	}
        //}

        static void Test2()
        {
            var    client = new SvnClient();
            string val;
            var    result = client.GetProperty(new SvnUriTarget("file:///D:/Work/svn/BIST/repo/releases/IG/Head/Config"), "svn:externals", out val);

            if (!result)
            {
                return;
            }
            SvnExternalItem[] items;
            result = SvnExternalItem.TryParse(val, out items);
        }
Ejemplo n.º 4
0
 public string GetPropertyValue(string fileName, string propertyName)
 {
     Debug("SVN: GetPropertyValue(" + fileName + ", " + propertyName + ")");
     BeforeReadOperation("propget");
     try {
         string propertyValue;
         if (client.GetProperty(fileName, propertyName, out propertyValue))
         {
             return(propertyValue);
         }
         else
         {
             return(null);
         }
     } catch (SvnException ex) {
         throw new SvnClientException(ex);
     } finally {
         AfterOperation();
     }
 }
Ejemplo n.º 5
0
        public static bool ReadExternals(SvnClient client, string externalsHostUrl, out SvnExternalItem[] extItems)
        {
            //SvnExternalItem[] extItems;
            extItems = new SvnExternalItem[0];
            {
                string externalsPropVal;
                if (!client.GetProperty(new SvnUriTarget(externalsHostUrl), "svn:externals", out externalsPropVal))
                {
                    return(false);
                }

                if (!String.IsNullOrEmpty(externalsPropVal))
                {
                    if (!SvnExternalItem.TryParse(externalsPropVal, out extItems))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 6
0
        static void Test7()
        {
            var    client = new SvnClient();
            string val;
            var    hostUrl = "file:///D:/Work/svn/BIST/repo/releases/IG/Head";
            var    result  = client.GetProperty(new SvnUriTarget(hostUrl), "svn:externals", out val);

            if (!result)
            {
                return;
            }
            SvnExternalItem[] items;
            result = SvnExternalItem.TryParse(val, out items);

            //var uriTarget = new SvnUriTarget( url );
            //var uri = new Uri(url);
            //uri.


            //ReleaseMaker.GetFullReferenceUrl(client, items[0], hostUrl);
        }
Ejemplo n.º 7
0
        private SortedList<String, String> getExternalsVersions(DirectoryInfo src)
        {
            SortedList<String, String> externals = new SortedList<String, String>();
            Log.LogMessage(MessageImportance.Normal, "fetching svn:externals for '{0}'", new object[] { src });

            using (SvnClient svn = new SvnClient())
            {
                String svnExternalsData;
                svn.GetProperty(src.FullName, SvnPropertyNames.SvnExternals, out svnExternalsData);
                Regex regexp = new Regex(@"^(\S+).*/((\d+[\._]?)+)$", RegexOptions.Multiline);
                MatchCollection matches = regexp.Matches(svnExternalsData.Replace("\r\n","\n"));
                foreach (Match match in matches)
                {
                    String externalName = match.Groups[1].Value;
                    String externalVersion = match.Groups[2].Value;
                    if (!String.IsNullOrEmpty(externalVersion))
                    {
                        externals.Add(externalName, externalVersion);
                    }
                }
                return externals;
            }
        }