Ejemplo n.º 1
0
Archivo: push.cs Proyecto: Kuzq/gitter
 public static PushCommand FormatPushCommand(string remote, ICollection<string> branches, bool force, bool thin, bool tags)
 {
     var args = new ICommandArgument[branches.Count + 3 + (force?1:0) + (tags?1:0)];
     int arg = 0;
     if(tags)
     {
         args[arg++] = Tags();
     }
     if(force)
     {
         args[arg++] = Force();
     }
     args[arg++] = thin ? Thin() : NoThin();
     args[arg++] = Porcelain();
     args[arg++] = new CommandParameter(remote);
     foreach(var branch in branches)
     {
         args[arg++] = new CommandParameter(branch);
     }
     return new PushCommand(args);
 }
Ejemplo n.º 2
0
 public static RemoteCommand FormatAddCommand(string name, string url, string master, string[] branches, bool mirror, bool fetch, bool tags)
 {
     var args = new ICommandArgument[1+2+(master!=null?1:0)+(branches!=null?branches.Length:0)+(mirror?1:0)+(fetch?(tags?2:1):0)];
     int id = 0;
     args[id++] = Add();
     if(branches != null && branches.Length != 0)
     {
         foreach(var b in branches)
         {
             args[id++] = TrackBranch(b);
         }
     }
     if(!string.IsNullOrEmpty(master))
     {
         args[id++] = Master(master);
     }
     if(fetch)
     {
         args[id++] = Fetch();
         if(tags) args[id++] = Tags();
     }
     if(mirror)
     {
         args[id++] = Mirror();
     }
     args[id++] = new CommandParameter(name);
     args[id++] = new CommandParameter(url);
     return new RemoteCommand(args);
 }