I want to set up Mantis bug tracker and tortoise svn to work together.
I have added properties to tortoise svn like below:
And also I have added below properties to config_inc.php file
$g_source_control_notes_view_status = VS_PUBLIC;
$g_source_control_account = 'xxx';
$g_source_control_set_status_to = OFF;
$g_source_control_regexp = "/\bissue [#]{0,1}(\d+)\b/i";
And my post-commit.bat looks like
SET REPOS=%1
SET REV=%2
SET DETAILS_FILE=\svnfile_%REV%
echo Bug ID : %BUGID%>>%DETAILS_FILE%
svnlook log -r %REV% %REPOS%>>%DETAILS_FILE%
echo SVN Revision:%REV%>>%DETAILS_FILE%
echo Files Changed : >>%DETAILS_FILE%
svnlook changed -r %REV% %REPOS%>>%DETAILS_FILE%
\php.exe \checkin.php <%DETAILS_FILE% >%LOG_FILE%
This works fine if I provide issue ID in commit message.
If I provide issue id in commit message it shows commit message in mantis Notes.
Issue Now I Don't want to put issue id in commit message but want to take %BUGID% that I provide in right most upper corner when doing tortoise svn commit.
i.e. echo Bug ID : %BUGID%>>%DETAILS_FILE%
it is not working for me.
Can any one help me.
And yes Do anyone know how to add html link or html tags in post-commit hook script.
Thanks in advance.
Related
I have changed line of a sql file file. But the diff only shows the diff colour without any change code.
the line is: #enabled=0, before the change we had 1 instead of 0.
without the gitattribute
*.sql text diff
I get the error message that file suppressed by a .gitattributes entry or the file's encoding is unsupported.
[this is the link of the image of my git diff] (https://i.stack.imgur.com/bgMvv.png)
You need to check your git status (assuming the #enabled=0 was done on your workstation)
Check if:
the file is indeed Test/Scripts/ScriptsIgnoredOnImport.sql
there is any local commit which would not have been pushed yet.
The file on GitHub can also tell you more, by typing b (which triggers the file "blame" view on GitHub).
As shown here, you can then "View blame prior to this change" and see if your #enabled= was visible then.
As noted by torek, you could have a difference in encoding as well.
As I mentioned in "How do I determine file encoding?", you can (even in a simple CMD on Windows), check the encoding of your current file with:
git show :your/file.sql | file -
# compare it with the previous version
git show #~your/file.sql | file -
How can i get the last merged branch name in git from the remote
Tried
git log --first-parent --merges -1 --oneline
But not getting the branch name
Please help
In general, you cannot.
A merge commit may have, as its commit message, text of the form merge branch foo or merge branch foo of someurl, but to read that message, you must obtain the commit from the remote. Even so, there's no guarantee that branch foo exists any more, or that the name means anything if it does exist. Merging really works by commit hash IDs, not by branch names; branch names may evanesce.
If you think you need a branch name here, you are probably doing something wrong. Branch names do make sense here in other version control systems, but in Git, depending on them is unwise.
Here is the command you need to give (change the branch name from origin/master to whichever branch you're checking merges for):
git log --merges origin/master --oneline --grep='^Merge' -1 | grep -oe "[^']*[^']" | sed -n 2p
I had quite a bit of a hard time trying to solve this issue.
I had to get this information for my CircleCi pipeline, and to solve my problem I used the GitHub cli.
Specifically the pr list command: https://cli.github.com/manual/gh_pr_list
The following command gives you all the information of the last PR you merged into main
gh pr list -s merged -B main -L 1
Then you need to manipulate the string and get only the branch name. Which is the text before "MERGED"
I took it splitting the string and taking the penultimate element.
How to create and submit a new file using p4python?
create_and_submit_file(full_path_in_depot, new_file_text_content):
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
p4 = get_p4() # implemented
try: # Catch exceptions with try/except
connect_and_login_p4(p4) # implemented
# .. implementation here .. p4.some_call()
LOGGER.info('done')
except P4Exception:
for e in p4.errors: # Display errors
LOGGER.error(e)
If the file already exists on the local filesystem within a workspace, all you need to do is p4.run_add(file) and p4.run_submit('-d', 'this is my awesome file').
If the file doesn't exist, you need to create it, and if you don't have a workspace, you need to create that too. For the sake of brevity, here's how you'd do that from the command line completely from scratch (this maps pretty directly to P4Python but I don't know enough about your environment to give you code that'll work out of the box so I won't attempt the translation):
echo "my awesome file content" > my_awesome_file
p4 set P4CLIENT=my_awesome_client
p4 --field "View=//depot/... //my_awesome_client/..." client -o | p4 client -i
p4 add my_awesome_file
p4 submit -d "this is my awesome file"
Check out the example for p4.save_client to see a simple example of how you can create/modify a client spec with P4Python and modify the fields to suit your environment (similar to how I used the --field flag to set the View such that the root of my_awesome_client corresponds to //depot/...):
https://www.perforce.com/perforce/r14.2/manuals/p4script/python.p4.html#python.p4.save_spectype
I would like to store all of my dotfiles on GitHub, including .gitconfig which requires me to hide the GitHub token in the .gitconfig.
To do so I have a ".gitconfig-hidden-token" file which is the file I intend to edit and put under git that hides the token:
...
[github]
user = giuliop
token = --hidden--
...
And a shell script which I need to launch if I modify the ".gitconfig-hidden-token" file to create the ".gitconfig" file:
cp .gitconfig .gitconfig.backup
sed 's/--hidden--/123456789/' .gitconfig-hidden-token > .gitconfig
The drawback is the need to manually launch the script everytime I modidy the file. Is there a better, fully automated way to do this?
I just fixed this up for myself. The "proper" way to solve the issue is to split your gitconfig into two files, a public one with the alias/config/etc, and a private file that keeps your username and secrets. Like so...
From https://github.com/ddopson/dotfiles ...
.gitconfig:
[include]
# For username / creds / etc
path = ~/.gitconfig.local
[alias]
...
.gitconfig.local:
[user]
user = ddopson
name = Dave Dopson
email = ddopson#gmail.com
token = a123uber456secret789ceprivate000key78
[credential]
helper = osxkeychain
.gitignore:
/.gitconfig.local
Add your .gitconfig with git add -N.
Then git add -p it, edit the hunk, replace the token with anything, and push that. No need for an extra file this way.
Addendum: on additional modifications of your file, use git add -p again, and edit the hunk so that your initial manipulation not be overwritten.
You can now include another file in your gitconfig. You could put your github section in that extra file. See this question: Is it possible to include a file in your .gitconfig
I made a script to update my dotfiles repo, it also redacts sensitive information such as my github token. I don't think the github token is used by GitHub anymore though, but correct me if I'm wrong.
You can view my script here.
When I execute my svn post-commit hook from the command line I get the SVN log message well formatted. When I execute it from the hook (real commit test) I get the log message with bad charset. Looked everywhere but I cannot figure it out. Any help will be appreciated.
My post commit script:
REPOS="$1"
REV="$2"
CS="UTF-8"
USERS="blahblah#gmail.com"
svnnotify --charset $CS --svn-encoding $CS --css-inline --repos-path "$1" --revision "$2" --subject-prefix "[SuperProj-Commit]-" --to $USERS --handler HTML::ColorDiff -d
I get this:
[SuperProj-Commit]-[48] - testando acentua?\195?\167?\195?\163o!
In the subject line and in the body of the message as well. The problem is ONLY in the svn log message. Characters showing up in the diff are showing up correctly.
First install your language locale here: http://ubuntuforums.org/showthread.php?t=196414
Then do inside your post-commit:
export LANG=your_new_locale
To list the locales available in your linux system you can do:
locale -a