Bazaar merge hook? - bazaar

i want to run a batch file after a merge operation to resolve certain conflicts automatically.
any ideas?
post_merge_hook will work just fine but i didnt find any references for it existence
thanks
Gil Idelson

There is no post-merge hook in Bazaar. Your best bet is to make a shell alias or batch file which executes the merge and then your conflict resolution tool.
Another alternative is to create a plugin which registers a merge_file_content hook that controls how bzr merges specific files. Since bzr 2.4, there is bundled plugin called news_merge which demonstrates how this can be used. You may also want to read about hooks in the user guide.
Unless the standard merge algorithms really cannot handle your special files correctly, I would recommend the first option.

Related

How to implement merge conflict preview using libgit2?

I'm trying to implement a content management website, in many ways, it's like a simplified github.
the version control and collaboration part is based on git using libgit2.
But I can't find how to implement merge conflict preview, that would tell an user if her change is clean to merge or not and which lines have conflict.
the example here https://github.com/libgit2/libgit2/blob/master/examples/merge.c
performs merging with the git_merge function, however, this function would directly alter the current index.
I also checked a github open source alternative, but I forgot its name now. That project used a library from the eclipse ide, which provides a conflict preview feature.
How should I implement this with libgit2 and is there an example code?
As you noted, the git_merge function mutates the working directory and the index. You can use the git_merge_commits function to do an in-memory merge of two commits and return the resulting index.
You can then iterate over the index looking for conflicts or simply call git_index_has_conflicts if you only want to know if conflicts exist.

How to open and modify .gtk plugin

I have found a plugin (EELSTools.gtk from http://www.dmscripting.com) which I want to modify.
The plugin contains nearly every function I need, but I want also to integrate some extra functions.
Does anyone know how to open .gtk files?
You can't and shouldn't.
*.gtk files are packages files with the purpose of encapsulation. This might either be because of convenience, but it might as well be, because the author does not want to make the code open-source. (Note that there are some proprietory plugins as well, they are also .gtk files.)
If you have found a plugin and want to expand on it, the best way forward is to contact the plugin-author.
The *.gtk files get loaded before *.s files. If you install your own script from DM Menu Install Script File or Install Script, you can add it to the menu that the *.gtk file has, e.g. EELSTools. It is added at the end of the list. For example, I put a measure ZLP width script in EELSTools.

How to reference the absolute directory of a project in Autoconf (to call custom scripts in portable way)?

I'm writing a custom check for installed libraries in autoconf:
AC_DEFUN([AC_GHC_PKG_CHECK],[
...
GHC_PKG_RESULT=$($PYTHON autotools/check-ghc-version-range ....)
...
])
where my Python script that actually performs the check resides in the autotools/ sub-directory of the project.
However, this is not portable, for example make dist-check fails because then autoconf tools are called from a different directory. How can I reference the absolute path to my Python script so that it gets called properly no matter what the current directory is?
ac_top_srcdir or ac_abs_top_srcdir should work in this case:
AC_DEFUN([AC_GHC_PKG_CHECK],[
...
GHC_PKG_RESULT=$($PYTHON $ac_top_srcdir/autotools/check-ghc-version-range ....)
...
])
EDIT: I don't think this approach will work -- it seems that $ac_top_srcdir aren't evaluated until later (AC_OUTPUT?).
What I think might work in this instance is to do something similar to what the runtime C tests do: blast a configuration test to a temporary file (conftest.py instead of conftest.c in this case) and run it. Unfortunately, there's (yet) no builtin macros or for automake/autoconf other tools that directly assist with this task.
Fortunately it seems that a clever person has written at least a couple different ways to do this. The first one is GNU pyconfigure which seems to have facilities for writing Python test code as I described above. The second one is more of an ad hoc macro collection that he used for his project.
You can use $srcdir.
It's not necessarily an absolute path, but it's a path that points from the top of the build tree to the top of the source tree.

How to take snapshot of registry entries/folders before installing upgraded software?

I am installing an major upgrade of product in my system.
Folders and registry entries will be updated for this.
I would like to take snapshot of folder structure and registry before/after installing update so that i can compare them easily.
Is there any tool or simple powershell module available to do this?
I hope testers would have done this while doing installation testing. If you have followed any good approach ,please update us.
One of the best tools I've come across for before/after registry comparisons is called RegShot:
http://portableapps.com/apps/utilities/regshot_portable
The 1.8.3 version supports 64 bit registries:
http://sourceforge.net/projects/regshot/
Yet another tool is called ZSoft Uninstaller:
http://portableapps.com/apps/utilities/zsoft_uninstaller_portable
This one is tailored toward software installation analysis.
Both of these can perform registry and file system before/after comparisons.
Well, practically, I think you'll have to limit the paths you want to "monitor". You can use the PowerShell provider for registry very easily. For example:
Get-ChildItem -Path HKCU:\SOFTWARE -recurse | Out-File HKCU_Software.reg
More information here. Then, you can make a diff (before, after) using a tool like DiffMerge. Same principles for directories.
However, once again, beside a shallow check, I don't think that approach is realistic.
Don't know your context, but Microsoft's Attack Surface Analyzer might be useful.
I recommend RegistryChangesView by NirSoft.
It could be particularly good for you as you mentioned PowerShell modules in your question, and RegistryChangesView has documented command-line options. RegistryChangesView also supports exporting the comparison to a .reg, HTML, or CSV file etc.
I'm still looking for a tool that can directly output the difference in the form of PowerShell commands; until then, I can export to a .reg file and then run it through a .reg-to-PowerShell-commands converter.
Other options include the classic Regshot which has also been forked as Regshot Advanced. However, personally, I go with RegistryChangesView because I think it has better documentation/command-line options.

Is it possible to override the behavior of a merge module

Supposing I have a merge module that installs a file "MyFile.txt" to a certain location, and that I wish to use that merge module, however I want to supply a different copy of "MyFile.txt" from the one supplied with the merge module.
Is it possible to do this? (And for bonus points how can I do this using Wix)
Update: Roughly speaking MyFile.txt is part of a package up component of installable items that we provide to others, they then comine these components with their own to produce an installer.
In the ideal world they would only need to add new files to the output, however this is a replacement for an existing system where they currently have the ability to modify or even replace items (suce as MyFile.txt) in the end installer, and so without the ability to do the same with the merge module the migration path will be difficult.
The packaged up component doesn't need to be a merge module if there is a better solution, however merge modules seemed like the sensible choice and in all other respects provide a very nice re-usable package of installer logic.
It's possible but every technique that I know is a bit of a hack and doesn't scale very well. Can you tell me more about what type of file MyFile.txt is and what the intent of the different flavors of the file? Usually my goal is to never have the same filename twice ( darn component rules ) and then design variation points to support the needs. Sometimes upstream changes to the application are required to do this correctly.