Merge-NAVGIT

Sep 15, 2015 at 9:51 PM
Could you may give me a Little example how the Merge-NAVGIT function is working?

I just tried to merge 2 branches but i couldn't find out how to run the function.

There are the following three parameter
[Parameter(Mandatory = $true)]
[string]$repository,
[Parameter(Mandatory = $true)]
[string]$sourcefiles,
[Parameter(Mandatory = $true)]
[string]$targetbranch,
My Textfiles are splitted in the repository and the master branch is currently checked out:

C:\Temp\
COD1.txt
COD2.txt
COD3.txt

Now what is the source Parameter? The same as the repository? I tried different combinations (repository, files, '') but the files are not correct copied because the $sourcfile seems the be wrong? And therefore the System is not copying the files into the temporary Folders NAVGIT/Common,... and the whole merge is not correct working.

Could you may give me some advice?
I would very appreciate your help!

Best Regards
Sep 16, 2015 at 6:05 AM
Edited Sep 16, 2015 at 6:06 AM
Example of usage is this:
Merge-NAVGIT -repository c:\temp -sourcefiles *.txt -targetbranch master
it means:
-repository is folder where the repository resides (could be relative path to working directory or absolute path)
-sourcefiles is relative path/filter of the object files in the repository. It means, if objects are in subfolder objects in the repo, it should be "objects\*.txt"
-targetbranch is name of local branch or hash of commit with which you want to merge currently checked-out branch
Sep 16, 2015 at 9:32 AM
Thank you kine for your fast reply.
the temporary files are now correct copied.

But unfortunately i got one last Problem:

In my temporary Folder there is now the structure like the following:
Common\temp\
COD1.txt
COD2.Txt
COD3.Txt

it's the same for the other folders (result, source, target)

Within the merge command you are building the path with the following command:
(Join-Path -Path $commonfolder -ChildPath $sourcefilespath)
in my System this generates the following string
"C:\Users\xxx\AppData\Local\Temp\NAVGIT\Common.\"

but the Merge-NAVApplicationObject command could not find the objects

it is working if I set the temp folder
"C:\Users\xxx\AppData\Local\Temp\NAVGIT\Common\temp\"

The thing i do not understand is that the the following line is copying the temp Folder
$result = Copy-Item -Path $sourcefilespath -Filter $sourcefiles -Destination $commonfolder -Recurse -Container
Is there something i did wrong?
(I'm using your last build)
Sep 16, 2015 at 9:44 AM
Problem could be that the script is expecting, that the objects are in some subfolder. I never used it with objects directly in the repo root. I recommend to move the .txt files into subfolder like "objects" in the repo. It is good practice, because if you will start to use git as repo for your nav objects, you will find out that you need to store other things in the repo and it is better to drop them into different subfolders.

E.g. I am using this structure:

Components (folder with prerequisities like addins and external libraries)
PSScripts (powershell scripts used during build or development)
Objects (txt files with objects)

Try the subfolders, if there will be still problem, we will try to "debug" it somehow.
Sep 16, 2015 at 9:50 AM
Thank you kine, i will try :-)