Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report