Example #1
0
        public static void ReportShelfResult(MercurialProgressMonitor monitor, MergeCommand result)
        {
            throw new NotImplementedException();

            /*
             * if (result.GetMergeStatus () == NGit.Api.MergeStatus.FAILED) {
             *      string msg = GettextCatalog.GetString ("Stash operation failed.");
             *      DispatchService.GuiDispatch (delegate {
             *              IdeApp.Workbench.StatusBar.ShowWarning (msg);
             *      });
             *      string txt = msg + "\n\n" + GetMergeResultErrorDetail (result);
             *      monitor.ReportError (txt, null);
             * }
             * else if (result.GetMergeStatus () == NGit.Api.MergeStatus.NOT_SUPPORTED) {
             *      string msg = GettextCatalog.GetString ("Operation not supported");
             *      monitor.ReportError (msg, null);
             *      DispatchService.GuiDispatch (delegate {
             *              IdeApp.Workbench.StatusBar.ShowWarning (msg);
             *      });
             * }
             * else if (result.GetMergeStatus () == NGit.Api.MergeStatus.CONFLICTING) {
             *      string msg = GettextCatalog.GetString ("Stash applied with conflicts");
             *      DispatchService.GuiDispatch (delegate {
             *              IdeApp.Workbench.StatusBar.ShowWarning (msg);
             *      });
             * }
             * else {
             *      string msg = GettextCatalog.GetString ("Stash successfully applied");
             *      DispatchService.GuiDispatch (delegate {
             *              IdeApp.Workbench.StatusBar.ShowMessage (msg);
             *      });
             * }
             */
        }
Example #2
0
        public MergeCommandResult Pop(MercurialProgressMonitor monitor)
        {
            List <Shelf>       stashes = ReadShelfes();
            Shelf              last    = stashes.Last();
            MergeCommandResult res     = last.Apply(monitor);

            if (res.Result == MergeResult.Success)
            {
                Remove(stashes, last);
            }
            return(res);
        }
Example #3
0
        /*
         * public Shelf Create (MercurialProgressMonitor monitor, string message)
         * {
         *      if (monitor != null) {
         *              monitor.Start (1);
         *              monitor.BeginTask ("Shelving changes", 100);
         *      }
         *
         *      UserConfig config = _repo.GetConfig ().Get (UserConfig.KEY);
         *      RevWalk rw = new RevWalk (_repo);
         *      ObjectId headId = _repo.Resolve (Constants.HEAD);
         *      var parent = rw.ParseCommit (headId);
         *
         *      PersonIdent author = new PersonIdent(config.GetAuthorName () ?? "unknown", config.GetAuthorEmail () ?? "unknown@(none).");
         *
         *      if (string.IsNullOrEmpty (message)) {
         *              // Use the commit summary as message
         *              message = parent.Abbreviate (7).ToString () + " " + parent.GetShortMessage ();
         *              int i = message.IndexOfAny (new char[] { '\r', '\n' });
         *              if (i != -1)
         *                      message = message.Substring (0, i);
         *      }
         *
         *      // Create the index tree commit
         *      ObjectInserter inserter = _repo.NewObjectInserter ();
         *      DirCache dc = _repo.ReadDirCache ();
         *
         *      if (monitor != null)
         *              monitor.Update (10);
         *
         *      var tree_id = dc.WriteTree (inserter);
         *      inserter.Release ();
         *
         *      if (monitor != null)
         *              monitor.Update (10);
         *
         *      string commitMsg = "index on " + _repo.GetBranch () + ": " + message;
         *      ObjectId indexCommit = GitUtil.CreateCommit (_repo, commitMsg + "\n", new ObjectId[] {headId}, tree_id, author, author);
         *
         *      if (monitor != null)
         *              monitor.Update (20);
         *
         *      // Create the working dir commit
         *      tree_id = WriteWorkingDirectoryTree (parent.Tree, dc);
         *      commitMsg = "WIP on " + _repo.GetBranch () + ": " + message;
         *      var wipCommit = GitUtil.CreateCommit(_repo, commitMsg + "\n", new ObjectId[] { headId, indexCommit }, tree_id, author, author);
         *
         *      if (monitor != null)
         *              monitor.Update (20);
         *
         *      string prevCommit = null;
         *      FileInfo sf = ShelfRefFile;
         *      if (sf.Exists)
         *              prevCommit = File.ReadAllText (sf.FullName).Trim (' ','\t','\r','\n');
         *
         *      Shelf s = new Shelf (prevCommit, wipCommit.Name, author, commitMsg);
         *
         *      FileInfo stashLog = ShelfLogFile;
         *      File.AppendAllText (stashLog.FullName, s.FullLine + "\n");
         *      File.WriteAllText (sf.FullName, s.CommitId + "\n");
         *
         *      if (monitor != null)
         *              monitor.Update (5);
         *
         *      // Wipe all local changes
         *      GitUtil.HardReset (_repo, Constants.HEAD);
         *
         *      monitor.EndTask ();
         *      s.ShelfCollection = this;
         *      return s;
         * }
         *
         * ObjectId WriteWorkingDirectoryTree (RevTree headTree, DirCache index)
         * {
         *      DirCache dc = DirCache.NewInCore ();
         *      DirCacheBuilder cb = dc.Builder ();
         *
         *      ObjectInserter oi = _repo.NewObjectInserter ();
         *      try {
         *              TreeWalk tw = new TreeWalk (_repo);
         *              tw.Reset ();
         *              tw.AddTree (new FileTreeIterator (_repo));
         *              tw.AddTree (headTree);
         *              tw.AddTree (new DirCacheIterator (index));
         *
         *              while (tw.Next ()) {
         *                      // Ignore untracked files
         *                      if (tw.IsSubtree)
         *                              tw.EnterSubtree ();
         *                      else if (tw.GetFileMode (0) != NGit.FileMode.MISSING && (tw.GetFileMode (1) != NGit.FileMode.MISSING || tw.GetFileMode (2) != NGit.FileMode.MISSING)) {
         *                              WorkingTreeIterator f = tw.GetTree<WorkingTreeIterator>(0);
         *                              DirCacheIterator dcIter = tw.GetTree<DirCacheIterator>(2);
         *                              DirCacheEntry currentEntry = dcIter.GetDirCacheEntry ();
         *                              DirCacheEntry ce = new DirCacheEntry (tw.PathString);
         *                              if (!f.IsModified (currentEntry, true)) {
         *                                      ce.SetLength (currentEntry.Length);
         *                                      ce.LastModified = currentEntry.LastModified;
         *                                      ce.FileMode = currentEntry.FileMode;
         *                                      ce.SetObjectId (currentEntry.GetObjectId ());
         *                              }
         *                              else {
         *                                      long sz = f.GetEntryLength();
         *                                      ce.SetLength (sz);
         *                                      ce.LastModified = f.GetEntryLastModified();
         *                                      ce.FileMode = f.EntryFileMode;
         *                                      var data = f.OpenEntryStream();
         *                                      try {
         *                                              ce.SetObjectId (oi.Insert (Constants.OBJ_BLOB, sz, data));
         *                                      } finally {
         *                                              data.Close ();
         *                                      }
         *                              }
         *                              cb.Add (ce);
         *                      }
         *              }
         *
         *              cb.Finish ();
         *              return dc.WriteTree (oi);
         *      } finally {
         *              oi.Release ();
         *      }
         * }
         */

        internal MergeCommandResult Apply(MercurialProgressMonitor monitor, Shelf shelf)
        {
            /*
             * monitor.Start (1);
             * monitor.BeginTask ("Applying stash", 100);
             * ObjectId cid = _repo.Resolve (shelf.CommitId);
             * RevWalk rw = new RevWalk (_repo);
             * RevCommit wip = rw.ParseCommit (cid);
             * RevCommit oldHead = wip.Parents.First();
             * rw.ParseHeaders (oldHead);
             * MergeCommandResult res = GitUtil.MergeTrees (monitor, _repo, oldHead, wip, "Shelf", false);
             * monitor.EndTask ();
             * return res;
             */
            throw new NotImplementedException();
        }
 public static void ReportShelfResult(MercurialProgressMonitor monitor, MergeCommand result)
 {
     throw new NotImplementedException ();
     /*
     if (result.GetMergeStatus () == NGit.Api.MergeStatus.FAILED) {
         string msg = GettextCatalog.GetString ("Stash operation failed.");
         DispatchService.GuiDispatch (delegate {
             IdeApp.Workbench.StatusBar.ShowWarning (msg);
         });
         string txt = msg + "\n\n" + GetMergeResultErrorDetail (result);
         monitor.ReportError (txt, null);
     }
     else if (result.GetMergeStatus () == NGit.Api.MergeStatus.NOT_SUPPORTED) {
         string msg = GettextCatalog.GetString ("Operation not supported");
         monitor.ReportError (msg, null);
         DispatchService.GuiDispatch (delegate {
             IdeApp.Workbench.StatusBar.ShowWarning (msg);
         });
     }
     else if (result.GetMergeStatus () == NGit.Api.MergeStatus.CONFLICTING) {
         string msg = GettextCatalog.GetString ("Stash applied with conflicts");
         DispatchService.GuiDispatch (delegate {
             IdeApp.Workbench.StatusBar.ShowWarning (msg);
         });
     }
     else {
         string msg = GettextCatalog.GetString ("Stash successfully applied");
         DispatchService.GuiDispatch (delegate {
             IdeApp.Workbench.StatusBar.ShowMessage (msg);
         });
     }
     */
 }
Example #5
0
 public Shelf Create(MercurialProgressMonitor monitor, string message)
 {
     throw new NotImplementedException();
 }
Example #6
0
 public Shelf Create(MercurialProgressMonitor monitor)
 {
     return(Create(monitor, null));
 }
Example #7
0
 public global::Mercurial.MergeCommand Apply(MercurialProgressMonitor monitor)
 {
     return(ShelfCollection.Apply(monitor, this));
 }