revision

How do I add revision and build date to source?

穿精又带淫゛_ 提交于 2019-11-29 01:41:39
I have a GCC project and would like to automatically add defines for build date and revision number (from git) to my sources. What's the best way to do this? My goal is simple to be able to do something like this on startup: printf("Test app build on %s, revision %d", BUILD_DATE, REVISION) For building I'm using make with a simple Makefile.inc, not autoconf or anything like this. gucki I ended up using a simple command like this in my Makefile : echo "#define GIT_REF \"`git show-ref refs/heads/master | cut -d " " -f 1 | cut -c 31-40`\"" > git_ref.h VonC RCS keyword substitution is not natively

How can I store the new SVN revision number in my source code after I commit? (TortoiseSVN)

主宰稳场 提交于 2019-11-29 01:31:27
Is it possible, via TortoiseSVN, to know the SVN rev number you are about to get prior to a commit so that I can put that rev# into the source code comment section? Perhaps there is a special keyname/variable that I can put into my file that TortoiseSVN will automatically replace with the rev# it's about to commit to? The motivation behind this is that I can take the latest build and see what SVN rev's it was comprised of by just looking at the source code. It also gives management warm fuzzies. Subversion does support keyword expansion , but you may want to read here before choosing to

Generating and applying diffs in python

泪湿孤枕 提交于 2019-11-29 00:33:32
问题 Is there an 'out-of-the-box' way in python to generate a list of differences between two texts, and then applying this diff to one file to obtain the other, later? I want to keep the revision history of a text, but I don't want to save the entire text for each revision if there is just a single edited line. I looked at difflib, but I couldn't see how to generate a list of just the edited lines that can still be used to modify one text to obtain the other. 回答1: Did you have a look at diff

SVN: How to get the first revision of a file?

南笙酒味 提交于 2019-11-28 22:06:48
问题 When working with a subdirectory in a repository, how to find the revision when that specific directory has been added to the repository? By using "svn info http://.." I can find out when it was modified for the last time ("Last Changed Rev"), but I also need to find out the revision number of the commit when that directory (or file) was added for the first time (it's "first" revision). I have been searching for that at the "SVN book", googling, but, obviously, I got no results. Note: I need

Git (TortoiseGit) - How to revert a single file to a previous revision and then undo the revert?

家住魔仙堡 提交于 2019-11-28 20:13:08
When using Git with TortoiseGit: Does somebody know how to revert a single file(or a complete repository) to a previous revision? For example I have a repository containing multiple files. One file exists in three revisions (1 ; 2 ; 3). Now I want to change from revision 3 back to 2. TortoiseGit offers a "Revert" function in the "Show log" dialog which allows to jump back to a specific revision, but this will revert your whole repository instead of a single file. Also once I have reverted something, I don't have a clue how to undo the revert and jump back to the newest revision. In TortoiseGit

Mercurial scripting with python

北城余情 提交于 2019-11-28 17:14:42
I am trying to get the mercurial revision number/id (it's a hash not a number) programmatically in python. The reason is that I want to add it to the css/js files on our website like so: <link rel="stylesheet" href="example.css?{% mercurial_revision "example.css" %}" /> So that whenever a change is made to the stylesheet, it will get a new url and no longer use the old cached version. OR if you know where to find good documentation for the mercurial python module , that would also be helpful. I can't seem to find it anywhere. My Solution I ended up using subprocess to just run a command that

Find revision in trunk that a branch was created from

只愿长相守 提交于 2019-11-28 16:37:21
I am trying to merge the latest changes from trunk into a branch of my project, but the problem is I don't know what revision of the trunk I checked out that I eventually created the branch from. I would think SVN logged this somewhere. Does anyone know how I can find the revision number? (In other words, the Subversion equivalent of git merge-base master branch-name ) From the command line, the --stop-on-copy flag can be used to help show you where you copied a branch from: svn log --stop-on-copy --limit 1 -r0:HEAD ^/branches/feature The last line of will say something like this: Changed

Print Current Mercurial Revision Hash?

假如想象 提交于 2019-11-28 16:35:55
Is there a better way extract the current revision hash in Mercurial than hg log -l1|grep changeset|cut -d: -f3 ? Part of my webapp deployment script "tags" the uploaded app tarball with its unique revision hash. Try: hg id -i Example: $ hg id -i adc56745e928 hg --debug id -i This will output the long hash, with a plus if there are uncommitted changes. You can use --template with the parent command, I use this to get the long hash: hg parent --template '{node}' Summarising the answers and their responses, it seems that this is the best way to print the unique (not short form) identifier of the

Reverting to a previous revision using TortoiseSVN

混江龙づ霸主 提交于 2019-11-28 16:25:19
问题 What is the easiest way to revert my working copy to a previous revision using Windows TortoiseSVN? I did not find any "findable" command to do that quickly. 回答1: There are several ways to do that. But do not just update to the earlier revision as suggested here . The easiest way to revert the changes from a single revision, or from a range of revisions, is to use the revision log dialog. This is also the method to use of you want to discard recent changes and make an earlier revision the new

How to view revision history for Mercurial file?

牧云@^-^@ 提交于 2019-11-28 15:50:58
For a given file in a Mercurial repository, how can you see the revision history? And how can you diff two revisions of the file? Ideally doing all this with visual tools (we use ExamDiff to do some other diffs). I'd say this is basic source control functionality but I can't seem to figure out how to do this with Mercurial. hg log file hg diff -r 10 -r 20 file Geoffrey Zheng The hgk extension gives you hg view file command that shows a visual history, from which you can diff/vdiff arbitrary pair of revisions. TortoiseHg gives you thg log file command that does the same thing but looks better.