Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Convert QTP object library xx.tsr files to xx.xml files for git tracking

Shulou Source: shulou.com Published: 2022-06-03 04:50:13 10月03日 Update

As we all know, Git can only track text files, while the object library file xx.tsr generated by QTP is a binary file that cannot be tracked by git. This article describes in detail the use of git's hooks feature to convert xx.tsr files into xx.xml files in order to track the version history of the object library.

First of all, the hooks feature of git refers to the ability to execute specific script code before or after a particular event (similar to listening for events, triggers, and so on). Since specific events refer to specific events performed by git, such as commit,push,recieve, the following are common git events:

Applypatch-msg

Pre-applypatch

Post-applypatch

Pre-commit

Prepare-commit-msg

Commit-msg

Post-commit

Pre-rebase

Post-checkout

Post-merge

Pre-receive

Update

Post-receive

Post-update

Pre-auto-gc

Post-rewrite

In this article, the events we will use are pre-commit and post-merge. The configuration method is as follows:

I) the first way: default hooks directory

Each git repository contains a .git / hooks directory, which is where the hooks (script) is placed, and when the git event is executed, the corresponding hooks (script) is executed automatically.

Note:

The script file name of the hooks corresponding to the git event must be the same as the event list name (all cases under .git / hooks end with .sample by default, and the suffix should be removed when using it). For example, when writing the hooks of the pre-commit event, the file name must be pre-commit, not pre-commit.sample.

II) the second way: customize the hooks directory

Create a .gitconfig file that specifies the hooks directory address, and then use the .gitconfig configuration. For example:

Create a .gitconfig file under the repository root and contain the following:

[core]

HooksPath=./libs/hooks

two。 Run the following command to reference .gitconfig

# gitconfig-- local include.path.. / .gitconfig

In order to make it easy to use, I have created a Sample repository on my GitHub, which you can use directly under clone. There are two scripts configured according to the second way: pre-commit and post-merge, which are used to automatically convert xx.tsr into xx.xml files for tracking before commit, and when pull comes down and merge, then convert xx.xml files into xx.tsr files that can be used by QTP.

Github address: https://github.com/TaoismLEE/Sample.git

Note:

1. After clone comes down, be sure to run gitconfig-- local include.path.. / .gitconfig to reference the configuration

two。 Put the xx.tsr file in the libs folder for the first time.

Tags: Files events scripts traces directories configurations repositories methods objects addresses file names features runs well known two cases binaries code content functions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Linux Microsoft MySQL Xiaomi