git version relative to a specific tag - git-tag

We're using multiple tag identifiers in our repo. Eg. ABC-1.3.5.234 and DEF-1.2.1.25. The describe command gives me almost what I want:
git describe --long
ABC-1.3.5.234-33-deadbeef
But I really wanted to know the value relative to the most recent DEF tag in my history. Is there a way to specify which tag I want to use as the base for calculating relative distance? Can I do it with a regex?

The git describe man page is clear:
If an exact match was not found, git describe will walk back through the commit history to locate an ancestor commit which has been tagged. The ancestor's tag will be output along with an abbreviation of the input committish's SHA-1.
If multiple tags were found during the walk then the tag which has the fewest commits different from the input committish will be selected and output.
Here fewest commits different is defined as the number of commits which would be shown by git log tag..input will be the smallest number of commits possible.
So you might have to write a script which:
git describe
take the commit found and git describe that commit
repeat until you get the tag you were looking for
sum all the number 'n' of additional commits on top of the found tagged objects during that loop
build and output the resulting string: DEF-xxx-n-DEF_SHA1.
Since 2013, as illustrated in Hendrik's answer, this work better:
git describe --all --match <tagPattern>
But only if, as I describe in "how to match a hidden ref using git describe", you are using Git 2.15 (Q3 2017).
Before 2.15, --all would have been ignored.
Note: Git 2.15 also allows multiple patterns for git describe --match
That allows even more advanced searches like:
For example, suppose you wish to find the first official release tag that contains a certain commit.
If we assume that official release tags are of the form "v*" and pre-release candidates include "*rc*" in their name, we can now find the first release tag that introduces the commit abcdef:
git describe --contains --match="v*" --exclude="*rc*" abcd

Just stumbled upon this question. This might help:
git describe --match "DEF-*"

For me
> git describe --all --match "<tag>"
tags/v0.0.0pre1-334-gbb55666
did the trick.
--all enables the search for all references not just tagged ones
--match "<tag>" specifies the tag to be used to calculate the distance.

Related

How do I merge POT and PO files so that I exclude entries that are not in the POT file?

In short, I am trying to find a way to create a new PO file from a new POT and an existing PO file - but I want to exclude any strings (and their translations) that are not in the POT file.
Every time we change the wording on our cakePHP site, we generate a new POT file that contains all the translatable strings in the site. But when we merge it with the existing PO file (using POEdit), the merge process only adds the POT entries to the PO file. It doesn't remove the translations we no longer need. We have over 12k unneeded translations in our PO files. This makes our translator very unhappy. She has taken to just looking at the site and sending me translations to add manually, which makes me very unhappy.
I've looked around for tools that do this destructive merge, but I haven't been successful finding one. Before I head off to write one...is there something I missed?
(Sorry if this belongs on a different exchange, I will move this post to a better exchange if anyone tells me which one).
What you describe as "destructive" merge is the standard, normal merge operation in gettext and what everybody wants — you'd have to go out of your way to accomplish non-destructive versions, and I'm not even sure how.
From this it's safe to conclude that (1) you must be doing some weird steps not described above, or (2) your POT file contains more than you think it does (e.g. because you append to it instead of replacing it), or (3) you or the tools you use misinterpret the resulting PO file.
To merge using GNU gettext command line tools:
msgmerge -U your_old_translation.po latest_strings.pot
To merge using Poedit (notice the spelling):
Open PO file with the (now outdated) translations.
Use Catalog → Update from POT file…
Choose the newly regenerated POT file.
Notice that by default, outdated translations are kept in the PO file as backup. In Poedit, you can purge them (see Catalog → Purge deleted translations). However, these obsolete entries are stored in a different way in the PO file, as specially formatted comments, and are not visible or editable in Poedit or any conforming PO editing tool.
If I were to bet, I'd say (3) is the most likely cause (in which case, use a better editor like, ahem, Poedit), or perhaps (2) (should be easy to review by searching the POT for now-unused strings).
But merging really does the right thing that you expect it to do.

Coverall branches [[0,0]] missed meaning?

I'm just starting out with Coveralls and testing coverage and I see info such as this. What do the arrays mean? How should I interpret these? I can't seem to find anywhere in the docs or online regarding the meaning of these.
First index is block number and the second is branch number assigned by GCC
Basing my theory on lcov documentation for branch coverage information
BRDA: line number,block number,branch number,taken
Block number and branch number are gcc internal IDs for the branch.
Taken is either '-' if the basic block containing the branch was never
executed or a number indicating how often that branch was taken.

TFS drop, exclude obj folder using minimatch pattern

I'm setting up TFS 2015 on-prem and I'm having an issue on my last build step, Publish Build Artifacts. For some reason, the build agent appears to be archiving old binaries and I'm left with a huge filepath:
E:\TFSBuildAgent\_work\1a4e9e55\workspace\application\Development\project\WCF\WCF\obj\Debug\Package\Archive\Content\E_C\TFSBuildAgent\_work\1a4e9e55\workspace\application\Development\project\WCF\WCF\obj\Debug\Package\PackageTmp\bin
I'm copying the files using the example minimatch pattern to begin with:
**\bin
I'm only testing at the moment so this is not a permanent solution but how can I copy all binaries that are in a bin folder but not a descendant of obj?
From research I think that this should work, but it doesn't (It doesn't match anything):
**!(obj)**\bin
I'm using www.globtester.com to test. Any suggestions?
On a separate note, I'll look into the archiving issue later but if anyone has any pointers on it, feel free to comment. Thanks
In VSTS there are two kinds of pattern matching for URLs that are built-in to the SDKs. Most tasks nowadays use the Minimatch pattern as described in Matt's answer. However, some use the pattern that was used by the 1.x Agent's Powershell SDK. That format is still available in the 2.x Agent's Powershell SDK by the way.
So that means there are 5 kinds of tasks:
1.x agent - Powershell SDK
2.x agent - Node SDK
2.x agent - Powershell 1 Backwards compatibility
2.x agent - Powershell 3 SDK - Using find-files
2.x agent - Powershell 3 SDK - Using find-match
The ones in bold don't Minimatch, but the format documented in the VSTS-Task-SDK's find-files method.
The original question was posted in 2015, at which point in time the 2.x agent wasn't yet around. In that case, the pattern would, in all likelihood, be:
**\bin\$(BuildConfiguration)\**\*;-:**\obj\**
The -: excludes the items from the ones in front of it.
According to Microsoft's documentation, here is a list of
file matching patterns you can use. The most important rules are:
Match with ?
? matches any single character within a file or directory name (zero or one times).
Match with * or +
* or + matches zero or more characters within a file or directory name.
Match with # sign
# matches exactly once.
Match with Brackets (, ) and |
If you're using brackets with | it is treated as a logical OR, e.g. *(hello|world) means "Zero or more occurrances of hello or world"
Match with Double-asterisk **
** recursive wildcard. For example, /hello/**/* matches all descendants of /hello.
Exclude patterns with !
Leading ! changes the meaning of an include pattern to exclude. Interleaved exclude patterns are supported.
Character sets with [ and ]
[] matches a set or range of characters within a file or directory name.
Comments with #
Patterns that begin with # are treated as comments.
Escaping
Wrapping special characters in [] can be used to escape literal glob characters in a file name. For example the literal file name hello[a-z] can be escaped as hello[[]a-z].
Example
The following expressions can be used in the Contents field of the "Copy Files" build step to create a deployment package for a web project:
**\?(.config|.dll|*.sitemap)
**\?(.exe|.dll|.pdb|.xml|*.resx)
**\?(.js|.css|.html|.aspx|.ascx|.asax|.Master|.cshtml|*.map)
**\?(.gif|.png|.jpg|.ico|*.pdf)
Note: You might need to add more extensions, depending on the needs of your project.

Generating keywords from the article

How can we generate important keywords for any random article ?Does there exist any existing algorithm or tool to get the important keywords from the given text.
If you are using linux you can just use grep command to get the lines which has important keywords.
Eg: $ cat file_name.txt |grep key_word
The above command will display only the lines which has the specified key_word.
Please specify more details, like what type of file(eg:txt or doc files etc) More information about which programming language and Operating system you use to get a proper answer

How to Add an Auto Version Number in Latex?

This question Add a version number to the title of a LaTeX document spurred my curiosity:
How do you add an auto-version number in Latex?
( So one is not doing this: {\bf Version:} 1.2 and then later {\bf Version:} 1.2 1.3) ?
\usepackage[nofancy]{svninfo}
\svnInfo $Id: viperdefects.tex 125 2007-05-29 16:29:07Z longborb $
\svnKeyword $URL: file:///F:/Stuff/Repository/Development/Essays/Viper/viperdefects.tex $
If you use Subversion, the above code is an example of what you can do. SVN updates the information as you update the file, but beware: only if you up the containing file. It doesn't track updates elsewhere in the tree.
However, I get the feeling that this is now considered a bit old-fashioned; the modern trend is to DVCSs, where there isn't really a valid concept of a linearly incrementing version number.
If you're using Windows, you can install Tortoise SVN and Collabnet Subversion Server. These tools work fine with the svn-multi package in LaTeX to produce the revision/version numbers that you need.

Resources