[MonoDevelop] Git add-in

"Andrés G. Aragoneses" knocte at gmail.com
Wed Jul 28 13:20:01 EDT 2010


El 27/07/10 19:05, Lluis Sanchez Gual escribió:
> El dt 27 de 07 de 2010 a les 18:40 +0200, en/na "Andrés G. Aragoneses"
> va escriure:
>> El 27/07/10 17:49, Lluis Sanchez Gual escribió:
>>> Hi!
>>>
>>> I just committed an improved Git add-in which supports the basic Git
>>
>> Great!!
>>
>>
>>> operations integrated in MonoDevelop. This add-in does the work by
>>> invoking the git command and parsing the output it generates. This
>>> solution is not very efficient, but it does the job. The plan is to
>>> incrementally replace those git invocations by calls to the GitSharp
>>> library.
>>>
>>> I still have to figure out what's the best way of integrating the Git
>>> workflow into the MD version control system. The existing version
>>> control operations are implemented in this way:
>>>
>>>       * The Review Changes view shows files that have been added (new
>>>         files registered with git add), removed (files removed with git
>>
>> Then the user has to git add/rm the files manually??
> 
> This works like the SVN add-in. In most cases, MD will git-add or git-rm
> the files for you. For example, when you add to or delete a file from
> project.

Ok, but if you don't add them through MonoDevelop you wouldn't get them
in the Review Changes view, which is very annoying. Why not:
a) Adding these files (that were added with MonoDevelop) to the
ReviewChanges dialog with the enabled checkbox (for the commit) by
default. (BTW, I had trouble while doing this today using git master[1])
b) Adding the other files (added outside of MonoDevelop) to the
ReviewChanges dialog with the disabled checkbox (for the commit) by
default. (These files can be extracted from a "git status" command.)


>> If yes, why not
>> improving this to make the commit actually do a pre-commit (pursuing git
>> add and git rm in the files that have been marked in the checkbox) just
>> before the commit in the same atomic MonoDevelop-operation? This way the
>> ReviewChanges operation would show *any* change in the local repository.
> 
> You can only get a list of files added/removed if the files have been
> git-added and git-removed. That's why it has to be done before showing
> the status view (just like SVN).

As said above, you can obtain these files through git status, unless I'm
missing something.

>>
>>
>>>         rm) or modified (all modified files, staged and non-staged).
>>
>> I believe you also have to 'git add' modified files.
> 
> Yes, but that can be done when committing. Git will report modified
> files even if they are not stagged, so they can be shown in the status
> view without having to do a git-add on them.
> 
>>
>>
>>>       * A commit operation commits the selected files to the current
>>>         branch. It does not push.
>>>       * The Update command does a "pull --rebase --ff" of the current
>>>         branch.
>>>       * The Revert command does a "git checkout" of the selected files.
>>>       * The Show Annotations, Revert Revision and Revert to Revision
>>>         commands are not yet implemented.
>>>
>>> The Git add-in provides two additional commands available in the context
>>> menu:
>>>
>>>       * The new Push command shows all changes done wrt a remote branch
>>>         and then pushes the changes. The remote repo and branch can be
>>>         selected in a dialog.
>>>       * The new "Switch to Branch" command, allows switching the working
>>
>> Can a warning be implemented in case there are local uncommitted changes
>> when pursuing this operation (because I'm assuming you lose them??)?
> 
> Yes, I have to take a look a this. When switching branches, local
> changes seem to be kept, but there may be issues in case of conflicting
> changes.

Sounds good.


>>
>>>         tree to a branch (git checkout). Once a branch is selected, all
>>>         operations (including commit, push, pull) are done only for that
>>>         branch.
>>
>> I would add a very emphasized label then prior to the Push operation so
>> the user can visually spot which branch he's targetting.
> 
> That's in the push dialog, but I can emphasize it a bit more :)

Cool :)

> I'm also toying with the idea of having a branch selector in the
> toolbar, which would make the current branch more visible.

Looking forward to testing the addin these days. Today seems not very
usable because of the exception below and because the ReviewChanges
seems to hang when launching it (I see "scanning to look for changes..."
and nothing more, even after minutes).

Regards,

  Andres

[1] System.InvalidOperationException: Git operation failed
  at MonoDevelop.VersionControl.Git.GitRepository.RunCommand
(System.String cmd, Boolean checkExitCode, IProgressMonitor monitor)
[0x00074] in
/home/knocte/Documentos/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs:168

  at MonoDevelop.VersionControl.Git.GitRepository.RunCommand
(System.String cmd, Boolean checkExitCode) [0x00000] in
/home/knocte/Documentos/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs:153

  at
MonoDevelop.VersionControl.Git.GitRepository.GetDirectoryVersionInfo
(FilePath localDirectory, System.String fileName, Boolean
getRemoteStatus, Boolean recursive) [0x000be] in
/home/knocte/Documentos/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs:204

  at MonoDevelop.VersionControl.Git.GitRepository.GetVersionInfo
(FilePath localPath, Boolean getRemoteStatus) [0x0002d] in
/home/knocte/Documentos/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs:143

  at MonoDevelop.VersionControl.Repository.CanAdd (FilePath localPath)
[0x00022] in
/home/knocte/Documentos/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs:128

  at MonoDevelop.VersionControl.VersionControlService.OnFileAdded
(System.Object s, MonoDevelop.Projects.ProjectFileEventArgs args)
[0x0001d] in
/home/knocte/Documentos/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs:386

  at (wrapper delegate-invoke)
MonoDevelop.Projects.ProjectFileEventHandler:invoke_void__this___object_ProjectFileEventArgs
(object,MonoDevelop.Projects.ProjectFileEventArgs)
  at (wrapper delegate-invoke)
MonoDevelop.Projects.ProjectFileEventHandler:invoke_void__this___object_ProjectFileEventArgs
(object,MonoDevelop.Projects.ProjectFileEventArgs)
  at (wrapper delegate-invoke)
MonoDevelop.Projects.ProjectFileEventHandler:invoke_void__this___object_ProjectFileEventArgs
(object,MonoDevelop.Projects.ProjectFileEventArgs)
  at MonoDevelop.Ide.RootWorkspace.NotifyFileAddedToProject
(System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e)
[0x0000b] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs:1085

  at __ProjectFileEventHandler_DelegateFactory_3.Dispatch (System.Object
) [0x00000] in <filename unknown>:0
  at MonoDevelop.Ide.Gui.GuiSyncContext.AsyncDispatch
(MonoDevelop.Ide.StatefulMessageHandler cb, System.Object ob) [0x0000a]
in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/GuiSyncContext.cs:47

  at __ProjectFileEventHandler_DelegateFactory_3.ProxyCall
(System.Object , MonoDevelop.Projects.ProjectFileEventArgs ) [0x00000]
in <filename unknown>:0
  at MonoDevelop.Projects.Solution.OnFileAddedToProject
(MonoDevelop.Projects.ProjectFileEventArgs args) [0x0000b] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs:683

  at MonoDevelop.Projects.SolutionFolder.OnFileAddedToProject
(MonoDevelop.Projects.ProjectFileEventArgs e) [0x00016] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:804

  at MonoDevelop.Projects.SolutionFolder.NotifyFileAddedToProject
(System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e)
[0x00000] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:671

  at MonoDevelop.Projects.SolutionFolder.OnFileAddedToProject
(MonoDevelop.Projects.ProjectFileEventArgs e) [0x0002d] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:806

  at MonoDevelop.Projects.SolutionFolder.NotifyFileAddedToProject
(System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e)
[0x00000] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:671

  at MonoDevelop.Projects.SolutionFolder.OnFileAddedToProject
(MonoDevelop.Projects.ProjectFileEventArgs e) [0x0002d] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:806

  at MonoDevelop.Projects.SolutionFolder.NotifyFileAddedToProject
(System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e)
[0x00000] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:671

  at (wrapper delegate-invoke)
MonoDevelop.Projects.ProjectFileEventHandler:invoke_void__this___object_ProjectFileEventArgs
(object,MonoDevelop.Projects.ProjectFileEventArgs)
  at (wrapper delegate-invoke)
MonoDevelop.Projects.ProjectFileEventHandler:invoke_void__this___object_ProjectFileEventArgs
(object,MonoDevelop.Projects.ProjectFileEventArgs)
  at (wrapper delegate-invoke)
MonoDevelop.Projects.ProjectFileEventHandler:invoke_void__this___object_ProjectFileEventArgs
(object,MonoDevelop.Projects.ProjectFileEventArgs)
  at MonoDevelop.Projects.Project.OnFileAddedToProject
(MonoDevelop.Projects.ProjectFileEventArgs e) [0x00012] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:642

  at MonoDevelop.Projects.Project.NotifyFileAddedToProject
(MonoDevelop.Projects.ProjectFile file) [0x00035] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:580

  at MonoDevelop.Projects.Project.OnItemAdded (System.Object obj)
[0x00012] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:527

  at MonoDevelop.Projects.DotNetProject.OnItemAdded (System.Object obj)
[0x00000] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs:944

  at MonoDevelop.Projects.ProjectItemCollection`1[T].NotifyAdded
(System.Object item, Boolean comesFromParent) [0x00083] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:142

  at
MonoDevelop.Projects.ProjectItemCollection`1[T].MonoDevelop.Projects.IItemListHandler.InternalAdd
(System.Object obj, Boolean comesFromParent) [0x00011] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:115

  at MonoDevelop.Projects.ProjectItemCollection`1[T].NotifyAdded
(System.Object item, Boolean comesFromParent) [0x0006b] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:140

  at MonoDevelop.Projects.ProjectItemCollection`1[T].OnItemAdded (.T
item) [0x0000d] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:103

  at MonoDevelop.Projects.ItemCollection`1[T].InsertItem (Int32 index,
.T item) [0x00008] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ItemCollection.cs:39

  at System.Collections.ObjectModel.Collection`1[T].Add (.T item)
[0x0000c] in
/usr/src/packages/BUILD/mono-2.6.3/mcs/class/corlib/System.Collections.ObjectModel/Collection.cs:72

  at MonoDevelop.Projects.Project.AddFile (System.String filename,
System.String buildAction) [0x00067] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:230

  at
MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddFileToProject
(MonoDevelop.Projects.SolutionItem policyParent,
MonoDevelop.Projects.Project project, System.String language,
System.String directory, System.String name) [0x00038] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs:115

  at
MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddToProject
(MonoDevelop.Projects.SolutionItem policyParent,
MonoDevelop.Projects.Project project, System.String language,
System.String directory, System.String name) [0x00000] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs:107

  at MonoDevelop.Ide.Templates.FileTemplate.CreateFile
(MonoDevelop.Ide.Templates.FileDescriptionTemplate newfile,
MonoDevelop.Projects.SolutionItem policyParent,
MonoDevelop.Projects.Project project, System.String directory,
System.String language, System.String name) [0x00006] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs:330

  at MonoDevelop.Ide.Templates.FileTemplate.Create
(MonoDevelop.Projects.SolutionItem policyParent,
MonoDevelop.Projects.Project project, System.String directory,
System.String language, System.String name) [0x0002b] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs:308

  at MonoDevelop.Ide.Projects.NewFileDialog.OpenEvent (System.Object
sender, System.EventArgs e) [0x000ac] in
/home/knocte/Documentos/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs:439




More information about the Monodevelop-list mailing list