Exemplo n.º 1
0
        public bool Run(System.IO.DirectoryInfo workingDirectory, object _options)
        {
            UnstashVerbOptions localOptions = _options as UnstashVerbOptions;

            Printer.EnableDiagnostics = localOptions.Verbose;
            Area ws = Area.Load(workingDirectory);

            if (ws == null)
            {
                return(false);
            }

            var stash = StashList.LookupStash(ws, localOptions.Name);

            if (stash != null)
            {
                Area.ApplyStashOptions options = new Area.ApplyStashOptions();
                options.DisallowMoves       = localOptions.NoMoves;
                options.DisallowDeletes     = localOptions.NoDeletes;
                options.StageOperations     = localOptions.Stage;
                options.AllowUncleanPatches = localOptions.Relaxed;
                options.Reverse             = localOptions.Reverse;
                options.Interactive         = localOptions.Interactive;
                ws.Unstash(stash, options, localOptions.Delete);
            }

            return(true);
        }
Exemplo n.º 2
0
        protected override bool RunInternal(IRemoteClient client, RemoteCommandVerbOptions options)
        {
            PushStashVerbOptions localOptions = options as PushStashVerbOptions;

            foreach (var x in localOptions.Names)
            {
                var stash = StashList.LookupStash(client.Workspace, x);
                if (stash != null)
                {
                    client.PushStash(stash);
                }
            }
            return(true);
        }
Exemplo n.º 3
0
        protected override bool RunInternal(IRemoteClient client, RemoteCommandVerbOptions options)
        {
            PullStashVerbOptions localOptions = options as PullStashVerbOptions;

            foreach (var x in localOptions.Names)
            {
                bool ambiguous;
                var  stash = StashList.LookupStash(client.Workspace, x, out ambiguous, true);
                if (stash == null && !ambiguous)
                {
                    client.PullStash(x);
                }
            }
            return(true);
        }
Exemplo n.º 4
0
        public bool Run(System.IO.DirectoryInfo workingDirectory, object options)
        {
            StashDeleteVerbOptions localOptions = options as StashDeleteVerbOptions;

            Printer.EnableDiagnostics = localOptions.Verbose;
            Area ws = Area.Load(workingDirectory);

            if (ws == null)
            {
                return(false);
            }
            if (localOptions.All)
            {
                var stashes = ws.ListStashes();
                if (stashes.Count == 0)
                {
                    Printer.PrintMessage("Vault has no stashes.");
                }
                else
                {
                    foreach (var stash in stashes)
                    {
                        Printer.PrintMessage("Deleting stash #b#{0}##: #q#{1}##", stash.Author + "-" + stash.Key, stash.GUID);
                        ws.DeleteStash(stash);
                    }
                }
            }
            else if (localOptions.Names.Count == 0)
            {
                Printer.PrintMessage("#e#Error:## No stashes specified for deletion.");
            }
            else
            {
                foreach (var x in localOptions.Names)
                {
                    var stash = StashList.LookupStash(ws, x);
                    if (stash != null)
                    {
                        Printer.PrintMessage("Deleting stash #b#{0}##: #q#{1}##", stash.Author + "-" + stash.Key, stash.GUID);
                        ws.DeleteStash(stash);
                    }
                }
            }
            return(true);
        }