Giter Site home page Giter Site logo

intersystems-community / cache-tort-git Goto Github PK

View Code? Open in Web Editor NEW
31.0 16.0 20.0 213 KB

Access to Tortoise Git interface from Caché Studio

Home Page: https://github.com/intersystems-ru/cache-tort-git/wiki

License: MIT License

intersystems intersystems-ide tortoisegit git intersystems-cache

cache-tort-git's Introduction

Caché Git

Source Version Control plug-in for Caché Studio. Caché Git allows working with git-repos straight from Caché Studio.

Features

Caché Git provides interface from Caché Studio to TortoiseGit. Caché Git supports one repository for each Caché namespace. User chooses files to include in version control.

Pre-installation Requirements

  1. Install msysgit. Choose "Run Git from the Windows Command Prompt" option when installing.
  2. Install TorgoiseGit.

Caché Studio before 2011.1 cannot work with executables that have space in its name (like "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe"). In that case you should either install TortoiseGit in the folder without spaces or use newer version of Caché Studio. Caché Studio can work with previous version of Caché server. For example, Caché Studio 2013.1 can work with Caché 2009.

On *Nix systems Caché Git provides only Export/Import without calling TortoiseGit.

Installation in Caché:

  1. Enable write-access to CACHELIB database via the Management Portal. (This is required for csp-page with settings import.)

  2. Import project in %SYS:

    %SYS>do $system.OBJ.ImportDir("c:\your-path-that-contains-project-downloaded-from-github","*.xml","ck",,1)

  3. Now you can disable write-access to CACHELIB.

  4. In Management Portal select the new %SourceControl.Git class as the desired Source Control class in all namespaces where you wish to use it. (System Administration >> Configuration >> Additional Settings >> Source Control)

Setup

In Studio, in any namespace with %SourceControl.Git as a Version Control Class choose menu "Git > Settings"

  1. Enter full path to TortoiseGitProc.exe (usually "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe")
  2. Enter default temp folder (usually "C:\Temp"). ATTENTION! This folder shouldn't contain anything valuable. There will be subfolders for each Caché namespace.
  3. You can also specify temp folder for this particular namespace. Otherwise temp folder for this namespace will be <default-temp-folder>\<namespace>
  • If you don't want to enter you credentials every time you use git create in temp folder file _netrc and add string machine your-git-server login your-git-login password your-git-password. Instead of your-git-server, your-git-login and your-git-password write actual values. Or use Git Credentials.

How to work with plug-in

How to start

  1. In Studio, select Git >> Tortoise Git Settings and set up options for Git (e.g. Proxy). This options are stored in folder that you chose as temp.
  2. Choose Git >> Create Repo. Press OK, one more time.
  3. You will notice that the Git menu now has a full set of options.
  4. A new menu item appears in context menu — "Git -> Add to Source Control", when right-clicking on elements in the Workspace Window (Alt+3).
  5. Choose elements you want to add to Git. These programs, classes, csp-pages etc. are exported to hdd-folder and automatically synchronized with it every time when you open or save them in Studio.
  6. Choose menu Commit.
  7. Select all files, right-click on them and choose "Add".
  8. Write comment and press "Commit".
  9. Now you can immediately push changes to server.
  • You should press Push
  • Then click Manage button and specify git-server
  • For example:
  • Remote: assembla
  • URL: http://git.assembla.com/demobld.git
  • Choose the server you have just specified.
  • Press OK

How to join existing repository

  1. Choose menu Clone.
  2. Enter repository URL.
  3. [If your TortoiseGit Version < 1.8.5] In appeared window TortoiseGit adds repository name to folder. You should delete it (Write c:\temp\git\user instead of c:\temp\git\user\reponame)
  4. Press 'OK'.
  5. Select menu Import All to load changes from temp folder to Caché. Import All compares timestamps of files and Caché items and import files only if they are newer then Caché versions. There is also Import All Force menu item that import files without any checks.

Work Cycle

  1. Choose menu item Pull.
  2. Resolve conflicts in TortoiseGit if any.
  3. Select menu Import All to load changes from temp folder to Caché.
  4. Do some changes in Caché Studio.
  5. [Optional] Select menu Export All if you want to force-unload changes to temp folder from Caché.
  6. Select Commit
  7. Select Push from Caché Studio menu or immediately after Commit.

Global's structure

Data used by Caché-Git is stored in global which name is defined by Storage parameter of %SourceControl.Git.Utils class. Its value by default — ^Git. Options (path to tortoiseproc.exe and temp folder) are stored in %SYS namespace in nodes ^Git("%gitBinPath") and ^Git("%defaultTemp"). In each namespace we also store path to temp folder for this namespace that can override default path. Global name is ^Git("settings","namespaceTemp")

In ^Git("items") node namespace elements are stored that traced by Caché-Git. We store names of particular items with extension in lower-case.

In ^Git("TSH") node timestamps of last synchronization for each routine are stored.

To run all tests:

%SYS>do ##class(%SourceControl.Git.Test.Git).runall()

Extra Repository Settings

Mappings

To specify particular folder in repository where Caché Git should place files set value of `^Git("settings","mappings") to relative path. Additionally you can specify subfolder for each particular item type.

For example:

USER>zwrite ^Git
^Git("settings","mappings")="src/cache/"
^Git("settings","mappings","cls")="cls/"
^Git("settings","mappings","csp")="csp-data/"
^Git("settings","mappings","dfi")="dfi/"
^Git("settings","mappings","mac")="mac/"
^Git("settings","namespaceTemp")="C:\temp\testctg\"

In this particular case Caché Git stores all its files (except sc-list.txt) in src/cache/ subfolder. Classes are stored in src/cache/cls/ etc. All csp files (including static files -- js, css) are stored in src/cache/csp-data/. With this particular path to repository classes will be stored in folder C:\temp\testctg\src\cache\cls\.

You can omit root mappings. Mappings for particular item type are still applied.

Other Settings

The following sub-nodes of ^Git("settings") allow for further configuration:

  • "groupByFolder" - boolean value that defaults to 0 when not specified. The setting applies to all INC, MAC and INT routines as well as DFI exports.
    • When this value is true, use nested folders for these files, e.g. Package.Include.INC would be exported to <rootfolder>/Package/Include.inc.xml
    • When this value is false, all these files are exported to the root folder, e.g. Package.Include.INC would be exported to <rootfolder>/Package.Include.inc.xml
  • "includeExtensionInFilename" - boolean value that defaults to 1 when not specified.
    • When true, exported files include the lowercase extension in the filename, e.g. MyClass.cls.xml
    • When false, exported files do not include the extension in the filename, e.g. MyClass.xml

NOTE: Caché Git does not do any automatic moving of files. If you have classes placed in root folder and change mappings for cls to "src/cache/cls/" you need to move files corresponding to these classes manually. Better -- set mappings on creating of repository, before adding new items to source control.

cache-tort-git's People

Contributors

adaptun avatar daledupreezisc avatar eduard93 avatar evshvarov avatar lanhamm avatar ssarkisy avatar tsafin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cache-tort-git's Issues

support routines with dots in name

Create routine Test.test.mac
Add it to source control via Workspace -> Namespace (not Workspace -> Project)
See error that no such web application

Force Exprort All, ERROR #6304: Unable to export item

Hello,
When do Force Exprort All from Git menu in Cahce Studio, I am getting error, "ERROR #6304: Unable to export item 'myclass.something' because XML export does not support items of this type. Will skip this item."

However, the same class, exports fine from Studio.
Workspace > Project tab > select myclass.something > right-click Export.

What is this error and how can I resolve it or how can I debug to see what line inside that class is causing Force Export All issue?

Thx!

Handle $$$ClassDoesNotExist error when deleting classes

I often receive this error:

Class delete mvk.production.ContractPreparationProcess
Error #5351: Class 'package.classname' Does not exist.
Error: could not delete  'package.classname.cls'

This error should not be displayed, but rather ^Git global should be automatically actualized by removing offending class entry.

Git > Export All does not export updated cls files after importing new project.xml from Studio

Hello,
I am having this issue with Export All.
My workflow is as follow:

  1. Studio currently have latest master checkout from git.
  2. From Studio Import Local> select an updated project.xml export that had updated several cls files.
  3. From Studio Git > Export All ("Progam export is done" message is displayed)
  4. From Studio Git > Commit
    Here is where issue is, only project.xml is listed as changed files, no other cls files that got updated from the project.xml import are listed.

I am using Studio 2015.1
Does anyone have a workaround to force Export All after doing a Import Local?

Thanks!

export on recompile not only on save

Use case.
Create %Persistent class. Save it.
File is exported, because hook is on Save.
Recompile class. Now it has storage.
But file with storage is not exported, because there is no hook on recompile

Can't get it up

Trying to import xml's and get the error:

"ERROR #6301 Line: 3 Offset: 34 ERROR #5883: Item '%SourceControl.Git' is mapped from a database that you do not have write permission on. Will skip this item."

I'm running on Windows 10 server with full privileges in Cache and in Windows. Export and Import of other cls files (not part of this pull) work fine. Any suggestions?

Menu doesn't seem to work ...

I installed and configured the cache-tort-git.
I followed the steps :

  1. Select menu Tortoise Git Settings and set up options for Git (e.g. Proxy). This options are stored in folder that you chose as temp.
  2. Chose menu Create Repo. Press OK. One more time. -> Repo is created under C:\InterSystems\Cache\bin\SAMPLES
  3. Now menu has full view. -> doesn't show
  4. A new menu item appears in context menu — "Git -> Add to Source Control".-> doesn't show
    I only get Settings,TortoiseGit Settings, ...

Support different csp apps

Currently cache-tort-git puts files from all different csp apps in one folder csp.
That is bad, because these apps might contain files with the same name

Git holds xml instead of actual code

This makes it really hard to view diffs on the code.
Is there any way to make the actual class files be saved to git, instead of the xml representations?

Thanks,
Jonathan.

What is procedure for updating plugin to different version?

Hello,

What is procedure for updating plugin to a newer release?
My installation already have plugin installed and setup for my namespace.
Currently using: "cache-tort-git" LastModified="2015-02-24 12:30:27.321554"
Want to update to "cache-tort-git" LastModified="2016-07-31 23:57:25.117897"

Thanks

Git Plugin only allows to add 10 routines at a time

Currently the Git plugin only allows us to submit 10 routines to the repository at a time using the UI, is there a workaround that can be used so that more routines can be submitted at once? If not, this should be added, the capability to submit a folder of routines instead of selecting a small group.

better support across upgrades

The code works fine. The one issue I have is the name of the objects. According to Intersystems documentation

Custom Items in CACHESYS
You can create items in the CACHESYS database. When you install a Caché upgrade, this database is upgraded. During this upgrade, some items are deleted unless they follow the naming conventions for custom items.
To add code or data to this database so that your items are not overwritten, do one of the following:
Go to the %SYS namespace and create the item. For this namespace, the default routine database and default global database are both CACHESYS. Use the following naming conventions to prevent your items from being affected by the upgrade installation:
Classes: start the package with Z or z
Routines: start the name with Z, z, %Z, or %z
Globals: start the name with ^Z, ^z, ^%Z, or ^%z

I had previously installed your code and it was working fine. I upgraded Cache/Healthshare and as part of the upgrade all of %SourceControl was removed.

Could this code either

  1. be named %ZSourceControl.*
    or
  2. be formally included in a Cache/Healthshare kit

so that I do not have to re-apply the code after an upgrade?

Export on workstation in stead of on server ...

We have a central Caché-server to wich the developers connect with Caché-studio.
I can configure Cache-tort-git in the local Caché Studio's but the exports are saved on the server instead of on the workstations.
Is it possible that cache-tort-git exports directly in the right folder on the workstations ?

License required

Could you please put explicit license your code is supposed to be used under?

Если файлы веб-приложения меняются в другом редакторе, не получается commit и export all

Представим, что в папке веб-приложения области есть js и html файлы и вообще любые файлы, которые являются частью приложения, но изменяются не в студии, а во внешнем редакторе.

При обновлении такого файла извне, гит в студии не чувствует изменений и нет возможности включить этот файл в коммит и/или сделать export all в репозиторий.
Приходится выключать всю папку csp из сурс-контрола и потом снова включать.
После этого изменения можно закоммитить и экспортнуть в репозиторий.
Это неудобно - можно это исправить?

BUG c обновлением веб приложения

Создаётся впечатление что новый git отслеживает изменения раздела CSP снаружи и если видит изменения то использует свою версию, а не изменившуюся. Более того он сохраняет её а не новую. Восстановил предыдущую версию - бага не стало

Lack of timestamps -> always skips import

My ^Git global

MDX2JSON>zw ^Git
^Git("TSH","MDX2JSON.EmptyPortlet.cls")="63943,46991"
^Git("TSH","MDX2JSON.MDX2JSON.inc")="63943,47000"
^Git("TSH","MDX2JSON.Tests.cls")="63943,77136"
^Git("items","/MDX2JSON/MDX2JSON.inc")=""
^Git("items","MDX2JSON.AbstractREST.cls")=""
^Git("items","MDX2JSON.Dashboard.cls")=""
^Git("items","MDX2JSON.DashboardFilters.cls")=""
^Git("items","MDX2JSON.EmptyPortlet.cls")=""
^Git("items","MDX2JSON.Installer.cls")=""
^Git("items","MDX2JSON.MDX2JSON.inc")=""
^Git("items","MDX2JSON.REST.cls")=""
^Git("items","MDX2JSON.ResultSet.cls")=""
^Git("items","MDX2JSON.Task.cls")=""
^Git("items","MDX2JSON.Tests.cls")=""
^Git("items","MDX2JSON.Users.cls")=""
^Git("items","MDX2JSON.Utils.cls")=""
^Git("items","MDX2JSON.pkg")=""
^Git("settings","groupByFolder")=1
^Git("settings","hook")=$lb("MDX2JSON.Tests","OnCommit")

When I'm pressing ImportAll, I get the following output

MDX2JSON.REST.CLS is newer than on-disk version, skipping import
MDX2JSON.Dashboard.CLS is newer than on-disk version, skipping import
MDX2JSON.DashboardRS.CLS is newer than on-disk version, skipping import
MDX2JSON.Task.CLS is newer than on-disk version, skipping import
MDX2JSON.EmptyPortlet.CLS is newer than on-disk version, skipping import
MDX2JSON.ResultSet.CLS is newer than on-disk version, skipping import
MDX2JSON.AbstractREST.CLS is newer than on-disk version, skipping import
MDX2JSON.Utils.CLS is newer than on-disk version, skipping import
MDX2JSON.Users.CLS is newer than on-disk version, skipping import
MDX2JSON.Tests.CLS is newer than on-disk version, skipping import

Expected:

  1. Import of items without TS
  2. TS for all items

Export inc to target directory and not project root

Consider the following project:

project.class.cls
project.include.inc

Cache studio thinks that they both are in a directory project.
But in cache-tort-git if we add them to source control, they would be exported to disk as:

\root\project\class.cls.xml
\root\project.include.inc.xml

I propose cace-tort-git export them as:

\root\project\class.cls.xml
\root\project\include.inc.xml

Error adding Routines to control manager

Hello, when select many routines at a same time and click on Add to SourceControl we have this error:

image

class '%Studio.SourceControl.Interface', method 'UserAction': SUBSCRIPT 201 zTS+22^%Library.RoutineMgr.1 ^oddDEF("")

class '%Studio.SourceControl.Interface', method 'GetStatus': SUBSCRIPT 201 zTS+22^%Library.RoutineMgr.1 ^oddDEF("")

Thanks!

Import exclusions

Until recently I had non-importable items in the repository, so "Import All" if failed on loading, but ddin't bring anything undesired.

But right now I want to put a few actual Studio projects as examples of containers, and I do not want to get them imported by "Import All" (but rather they will be used/loaded/unloaded as part of unit-testing scenarios). Like here https://github.com/intersystems-ru/CPM/tree/package_xml/t/simple/simple.xml

Could you please provide exclude patterns functionality?

Versioning CSP Application

For CSP applications I do not see the need for versioning export XML files, this because within the application often have files from other formats that would provide greater control if they were versioned for its extension origin.

I can not save a new file in a .csp already versioned folder

After I add a folder with CSP pages to version control I can not create any more .csp file in it.

After creating the new file I try to save him and the error message as the image below.

bug

My workstation is in pt-BR, so the translation of the message is: "ERROR #5012: The file 'c:\temp\TESTE_VERSIONAMENTO\csp\teste\Untitled4.csp.xml' not exists"

Project hooks

Here's an idea: hooks for projects. I got 3 implementations:

  • On ExportItem we check ^Git("hook") = class, method and execute do $classmame(class, method) or do $classmame(class, method, itemname)
  • Same as previous but only once after user presses Commit button
  • We check for each class: does method OnExport exist? If yes, do something.

Ideas?
I require it for MDX2JSON (need to execute 1 action before commit), but I want my changes integrated into master branch so let's work out a solution for everybody.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.