Customize version suffix MinVer - nuget

I'm using MinVer and can't find how to get the commit height to create a custom version suffix. Ideally I would like to have 1.0.0-preview.{commits} instead of 1.0.0.-preview.0.{commits}. What the zero between the pre-release label and commit height is I don't know. (Yes, I've set <MinVerDefaultPreReleasePhase> to preview :))
Secondly, using GitInfo I notice a discrepancy in the number of commits. Below is output from some me experimenting on github
$ dotnet Application.dll
========== Git ==========
Commit a54e9e9
Commit SHA a54e9e96868470ebf13d4a35ce9858c09a534363
Branch remotes/origin/master
Tag
Commits 39
========== Assembly ==========
Version 1.0.0
Assembly Not found: AssemblyVersionAttribute
Informational 1.0.0-preview.0.34+a54e9e96868470ebf13d4a35ce9858c09a534363
File 1.0.0.24 // AzDo BuildId=24
Diagnosing MinVer gives me some hints about a root commit, but I know to little about git what determines the root commit.
MinVer: Starting at commit a54e9e9 (height 0)...
MinVer: History diverges from 3c0633f (height 20) to:
MinVer: - 56af0a5 (height 21)
MinVer: - 747ef5a (height 21)
MinVer: Following path from 3c0633f (height 20) through first parent 56af0a5 (height 21)...
MinVer: Found root commit { Commit: faa505b, Tag: null, Version: 0.0.0-preview.0, Height: 34 }.
MinVer: Backtracking to 3c0633f (height 20) and following path through last parent 747ef5a (height 21)...
MinVer: History converges from 0f35453 (height 24) back to previously seen commit 8dc52dc (height 25). Abandoning path.
MinVer: 39 commits checked.
MinVer: No commit found with a valid SemVer 2.0 version prefixed with ''. Using default version 0.0.0-preview.0.
MinVer: Using { Commit: faa505b, Tag: null, Version: 0.0.0-preview.0, Height: 34 }.
So, to summarize:
How do I customize version suffix for MinVer?
What does the zero {MinVerDefaultPreReleasePhase}.0.{commits} represent?
How is the commit height calculated/determined?
Third question leads me into versioning of NuGet and the section about FileVersionAssembly specifically the Revision-part of version number. But I leave this for another question.
Note I tried to add the tag minver but couldn't due to low reputation :)
Thanks
Joakim

How do I customize version suffix for MinVer?
I assume that "version suffix" refers to the pre-release identifiers. You can't customise all of them, only the default pre-release phase, which you are already doing with MinVerDefaultPreReleasePhase.
What does the zero {MinVerDefaultPreReleasePhase}.0.{commits} represent?
It's a sentinel value that represents interim versions before the next version is released. Bear in mind that a fundamental assumption in MinVer is that you label before release, so you will never release one of these versions. E.g. the current commit may be building 0.0.0-preview.0.34. When you want to release your first preview, you'd tag the commit with 1.0.0-preview.1 and MinVer will embed that version into your assemblies and package.
How is the commit height calculated/determined?
This is explained in "How it works":
You will notice that MinVer adds another number to the pre-release identifiers when the current commit is not tagged. This is the number of commits since the latest tag, or if no tag was found, since the root commit. This is known as "height". For example, if the latest tag found is 1.0.0-beta.1, at a height of 42 commits, the calculated version is 1.0.0-beta.1.42.
and from the FAQ:
What if the history diverges, and then converges again, before the latest tag (or root commit) is found?
MinVer will use the height on the first path followed where the history diverges. The paths are followed in the same order that the parents of the commit are stored in git. The first parent is the commit on the branch that was the current branch when the merge was performed. The remaining parents are stored in the order that their branches were specified in the merge command.
You can also see, in excruciating detail, how MinVer walks the history:
Can I get log output to see how MinVer calculates the version?
Yes! MinVerVerbosity can be set to quiet, minimal (default), normal, detailed, or diagnostic.
At the diagnostic level you will see how MinVer walks the commit history, in excruciating detail.

Related

How to list a view name used for creating a version on a branch (ex:0,1,2) in ClearCase

In IBM Clearcase, I am trying to find the view name which was used to create a version on a branch. If I do version properties / Element properties I get information onto who created it but not the view name used to create that particular version.
Is there a quick cmd-prmpt way to find out which view was used on a particular version of a branch.
You can see the view name of a checked-out version.
But not directly of a checked-in one.
Check the result of a cleartool lshist -minor and see if the event you see (checkin, described in events_ccase ) does include the view used to make the checkin.
Try it on the file:
cleartool lshist -minor aFile
Or on the branch:
cleartool lshistory -minor -branch rel2_bugfix
I don't think cleartool descr -l would help directly.
As a last resort, check-out "Identifying elements by the source container path"
You cannot see the name of the view used to create a checked-in version. If you feel the information is critical to retain, you can create a postop checkin trigger to append the view information to the checkin comment using cleartool chevent.
I think you may be "thinking git" where it may be critical to know which "remote" was used to create a commit.
In CC, after a checkin, the view private data/metadata associated with the checkout is removed from the view and VOB. What is the objective of retaining that information?

Is there a way to find the important commits in GIT before a release?

As in not only the major changes maybe the installed dependencies and all before a release without checking one by one?
Since Git won't know which commits are important to you, you'll have to first define your own set of guidelines/format on how you write your commit messages, which you can then use later on to easily differentiate all the commits made for a particular development period.
For example:
If it's a bug fix, prepend the commit message with a "[bugfix]"
If it's a new feature, prepend the commit message with a "[feature]"
If it's a project setup change, prepend the commit message with a "[migration]"
Then, once all the branches have been merged to the main branch (let's say it's develop), checkout the develop branch and use git log --grep=<PATTERN> to identify a specific set of commits.
For example, if you only need the bug fix commits, do a:
git log --grep="bugfix"
which will show you all the commits with "bugfix" in the commit message.
If you only need the commits for a specific period, you can use the --since=<date> option:
git log --since="2017-06-01" --grep="bugfix"
If you want a formatted list (something that you can easily output to some sort of release notes, I assume), you can use the --format=<format> option:
git log --since="2017-06-01" --grep="bugfix" --format="(%ci) %h : %s"
The command above will give you something like this:
(2017-06-18 18:26:36 +0800) 63f330f : [bugfix] prevent crash when dialog is sent to background
(2017-07-01 10:03:40 +0800) cdcbd91 : [bugfix] remove extra row at the end of the list
You can check out the other format options from the complete git log docs.
Basically, it will all depend on your commit message format.
As a tip, you can look into using a commit.template to make it easier to format your commit messages.
commit.template
If you set this to the path of a file on your system,
Git will use that file as the default message when you commit. For
instance, suppose you create a template file at ~/.gitmessage.txt that
looks like this:
subject line
what happened
[ticket: X]

Github: comparing across forks?

Short version
When I compare two forks on Github, it does not compare the latest states, but the current state of the base fork with the last common commit (or am I wrong?); so how can I compare the latest states/heads on Github?
Longer version
I am trying to compare two repositories on Github.
It does not seem to compare the latest states of both repository. Instead, it compares:
the base fork as it was when both repositories where identical (last common commit?)
with
the head fork as it is now.
You can see this in the Github's fork comparison example, it says there are no changes between those two repositories, but there are now very different.
How can I compare the latest states/heads on Github?
https://github.com/github/linguist/compare/master...gjtorikian:master
github:master is up to date with all commits from gjtorikian:master.
Try switching the base for your comparison.
It means that all commits from gjtorikian/liguist are part of github/linguist.
The reverse is not true:
https://github.com/gjtorikian/linguist/compare/master...github:master
That would give all (1866) commits from github/linguist which are not part of gjtorikian/linkguist.
This is triple-dot '...' diff between the common ancestor of two branches and the second branch (see "What are the differences between double-dot “..” and triple-dot “…” in Git diff commit ranges?"):
In the first case github/linguist:master...gjtorikian/linguist:master, the common ancestor and gjtorikian/linguist:master are the same! O commits.
In the second case gjtorikian/linguist:master...github/linguist:master, github/linguist:master has 1866 commits since the common ancestor (here, since gjtorikian/linguist:master).
As a side note, the compare of forks can be reached from the compare page.
Say your project is Zipios:
https://github.com/Zipios/Zipios
What you want to do is add the .../compare to that URL:
https://github.com/Zipios/Zipios/compare
On that page, you can select two branches but if you look closely, at the top there is a link that says: compare across forks.
Once you clicked on that link, it shows you two extra dropdowns with your main branch and the list of forks.
What I have yet to discover is how to go from the main page of a project to the Compare page. Maybe someone could shed light on that part?
From #somerandomdev49:
To go to the compare page, go to the "Pull Requests" tab and click the "Create Pull Request" button.

* mark in Nodes in svn revion graph in Eclipse

Could anyone please explain the meaning of * symbol in on the node and its usage. I am seeing this after doing merge operations.
Stackoverflow not allowing to post a picture for me if anyone needed please let me know
I think it shows which revision is included in a tag or branch you've created. For example I have a file with revisions 3*, 10, 13, 32*, 34* and I have created 3 tags from my trunk. These tags were created with revision 8, 33 and 35.
So revision 3 is included in my tag I've created with revision 8, revision 32 is included in my tag with revision 33 etc.
Revisions 10 and 13 are not marked with * because the higher revision 32 was tagged.
Due to this fact, I think that it is related to the creation of tags and/or branches.
I hope you understand my explanations ...

How do I get ClearCase to make an archive of a subdir of snapshot as it was at an earlier revision?

I'm not particularly experienced with ClearCase, so if my terminology is incorrect please let me know.
In Git I can run the command:
git archive -o /tmp/dump.zip $SHA_FROM_THE_PAST path/to/dump
I want to do something similar in ClearCase.
The ClearCase repository contains two branches: main and snapshot_foo.
snapshot_foo branches from main at some point in the past.
What I want is a dump of all the files as they looked at the time the snapshot was first created.
I understand that there is no 'global' state identifier like there is in Git; in AFAIK, in ClearCase each element is versioned individually, so there will not necessarily be a one-to-one equivalent to that command.
I've thought about creating a new snapshot starting at the same point in time from main, and just copying what I need from that, but I am bewildered and confused as to how I would go about it.
The simplest case would be when you have set a label on main just before creating snapshot.
But if you have no such label, you can get all the files at the time just before the creation of the snapshot_foo branch:
a/ cleartool descr -l brtype:snapshot_foo#/myVob to get the date of creation for this branch
b/ make a snapshot view with a time-based selection rule similar to this question
element /myPath/... /main/{!created_since(01-Sep-2008.12:34:56)}
element /myPath/... /main/LATEST
(with 12h 34 minutes 56 seconds being the time just before the creation of the brtype snapshot_foo)
(see the config_spec man page)
Once the snapshot view is created with the right versions in it, you can zip its content, achieving a similar result to the git archive you mention in your question.