[译]VssReporter 2.1-用于构建管理员的Visual SourceSafe报告工具
By robot-v1.0
本文链接 https://www.kyfws.com/applications/vssreporter-2-1-a-visual-sourcesafe-reporting-tool-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 17 分钟阅读 - 8230 个词 阅读量 0[译]VssReporter 2.1-用于构建管理员的Visual SourceSafe报告工具
原文地址:https://www.codeproject.com/Articles/4709/VssReporter-2-1-A-Visual-SourceSafe-reporting-tool
原文作者:.dan.g.
译文由本站 robot-v1.0 翻译
前言
A support tool to allow those performing builds to independently determine exactly what source files have been changed and by whom
一个支持工具,使执行构建的人员可以独立地准确确定已更改了哪些源文件以及由谁进行了更改
资料下载(Downloads)
- 可用于VSS6和.NET(Executable for VSS6 & .NET) -65 Kb(- 65 Kb)
- 可用于VSS5(Executable for VSS5) -65 Kb(- 65 Kb)
- 源代码(Source Code) -104 Kb(- 104 Kb)
重要的提示(Important Note)
VssReporter要求(VssReporter requires)Visual SourceSafe 5或6(Visual SourceSafe 5 or 6)进行预安装,以运行和构建它.(to be pre-installed, both to run it and to build it.)
由于这不是免费的可再发行组件(据我所知),我什至不能包含VSS组件((Since this is not a free redistributable (as far as I am aware) I cannot include even the VSS component ()ssapi.dll(ssapi.dll)).() that VssReporter requires.)
注意(Note):如果任何人都可以指出我的Microsoft文档证明我是错误的,那么我很乐意加入(: If anyone can point me to a Microsoft document that proves me wrong, then I will gladly include)ssapi.dll(ssapi.dll)-但目前不行.(- but not at the present.)
介绍(Introduction)
在大多数现实世界中的活动中,很容易确定某人是否做了某事:(With most real-world activities its fairly easy to determine whether someone has done something or not:)
“吉米,你打扫房间了吗?"(“Jimmy, have you cleaned your room?")
“是的爸爸”(“Yes Dad”)
(团块,团块,团块-爸爸走上楼的声音)((clump, clump, clump - sound of dad walking upstairs))
“不,您还没有(或类似的话).快点实现”(“No you jolly well haven’t (or words to that effect). Get to it”)
但是,软件是完全不同的.(Software, however, is a completely different kettle of fish.)
您所看到的部分(二进制文件的UI,网页或其他内容)通常只是冰山一角(尤其是二进制文件),而真正构成该组件的大部分内容都隐藏在视线之外.(The bit you see (the binary’s UI, web page or other) is generally just the tip of the iceberg (especially with binaries), with most of what really makes up the component hidden away out of sight.)
此外,由于编译过程导致的额外间接级别,使得已编译的二进制文件更加复杂.对于负责在多个人的项目上进行定期构建的不幸草皮来说,这一切变得非常痛苦.(Moreover, compiled binaries are further complicated by the extra level of indirection caused by the compilation process; something that becomes all too painfully clear to the unlucky sod responsible for performing regular builds on projects of more than one person.)
听起来很简单,邮寄所有编码器以了解他们自上次构建以来所做的工作.但这就是当您发现很少有程序员清楚地记得他们在前一周(甚至一天)修正(或破坏)的内容的时候.(It sounds so simple, mailing all the coders to find out what they’ve worked on since the last build. But that’s when you discover that few coders retain a clear memory of exactly what they fixed (or broke) in the preceding week (or even day).)
确实,有些人几乎记不清早餐吃的东西了;)(Indeed, some can barely remember what they had for breakfast ;))
我们几乎无意识地做的事情,例如较小的重构(又称"春季大扫除"或"整理”),特别容易被人们遗忘.(It’s the things we do almost unconsciously, like minor refactoring (aka ‘spring cleaning’ or ‘tidying up’), that are especially prone to being forgotten.)
我有很多由我自己和其他人共同经历的经历,这些经历看起来无害的"次要"代码更改并没有带来麻烦,因为没有人可以回忆起发生问题的代码中的任何更改.(I have had many experiences caused by both myself and others where an apparently innocuous ‘minor’ code change has caused no end of trouble because no one can recall changing anything in the code where the problem occurs.)
输入VssReporter!(Enter VssReporter!)
VssReporter(VssReporter)
简单地说,VssReporter是用于查询SourceSafe以确定在某些日期之后,之前或之间已更改了哪些源文件的工具.(At its simplest, VssReporter is a tool for querying SourceSafe to find out what source files have been changed after, before or between certain date(s).)
日期可以是显式的,例如” 02/08/2002",也可以是隐式的,例如标签.(Dates can be an explicit eg ‘02/08/2002’ or the implicit eg a label.)
它将允许您查询任何人(只有您本人或命名编码器)所做的修改.(It will allow you to query for modifications made by anyone, only yourself, or a named coder.)
但是,听起来似乎很方便(或可能没有),但我发现VssReporter最重要的价值在于可以应用它的各种问题.(However, as handy as that may (or may not) sound, I’ve found that VssReporter’s most significant value has been in the variety of problems to which I’ve been able to apply it.)
这里有一些:(Here are a few:)
- 常规构建(Regular Builds)
如前所述,负责构建意味着您必须确切地知道自上次构建以来发生了什么变化.否则,您将无法编写适当的发行说明,这意味着随着时间的流逝,您正在构建的产品变得越来越不确定.(As I mentioned before, being responsible for builds means you have to know exactly what has changed since the last build. Otherwise you can’t possibly write appropriate release notes which means that the product you’re building becomes increasingly undefined as time goes by.)
在负责我还编码过的多个项目的构建之后,我发现VssReporter必不可少.(Having been responsible for builds on a number of projects on which I also coded, I found VssReporter indispensible.)
这是我的工作方式:(This is how I worked it:)
- 首先,我决定在每次构建后都要使用的标签,例如" Last Build".(*First I decided on a label to be used after every build eg 'Last Build'.*)*注意:在VSS中重复使用相同的标签只会将标签移至最新用途,而不是复制标签.(*Note: reusing the same label in VSS simply moves the label to the latest use rather than duplicating it.*)*
- 然后,在每次构建之前,我将在VssReporter中运行相同的查询,以确定自上次使用标签以来哪些文件已更改.(*Then, prior to every build I would run the same query in VssReporter to determine what files had changed since the label was last used.*)
- 然后,我将麻烦编码器来解决他们所做的任何文件更改,这些更改与我们本应为构建而更改的任何内容都不对应.(*Then I would go hassle a coder about any file changes they had done which did not correspond to any of things we were meant to be changing for the build.*)
- 最后,在完成构建后,我将重新标记项目.(*Finally I would re-label the project when I'd done the build.*)
当我发现自己做了一些我几乎不记得做的"琐碎"更改时,我什至发现了自己几次!(I even caught myself out a few times when I discovered that I made some ‘trivial’ changes that I barely remembered making!)
- 重组项目(Restructuring Projects)
就在最近,我被要求对表面上包含在单个Vss项目根目录中的一组组件进行一些小的更改.(Just recently I was required to make a number of small changes to a set of components ostensibly contained within a single Vss project root.)
以前在这些组件上工作过的所有人员都离开了公司,所以我被委以了重任.(All personnel who had previously worked on these components had left the company and so I was delegated the task.)
我在尝试构建组件时发现的是一顿真正的狗的早餐:(What I found when I tried to build the components was a real dog’s breakfast:)
- 不同工作空间中存在源文件和项目的多个副本(*Multiple copies of sourcefiles and projects existed within different workspaces*)
- 项目已经搬迁,这意味着它们不再可以建造(*Projects had been moved meaning they no longer could be built*)
- 每个项目都有大量的测试项目,不同的编码员在不同的时间炮制了这些项目(*Each project had a mass of test projects that different coders had concocted at different times*)
我对同事说:“只有一件事情要做”,“重新组织整个血腥的事情!".他回答说:“迟到了”.(“There’s only one thing to do”, I said to a co-worker, “re-structure the whole bloody thing!”. To which he replied, “Well overdue”.)
那是我遇到麻烦的时候:如何确定真正需要重建的代码,因为如果您认为这是一件小事,我计算了根文件夹下存储的47个项目,全部包含7个主要组件.(That’s when i hit a snag: how to determine what code really needed to be rebuilt since, in case you think this was a trivial exercise, I counted 47 projects stored below the root folder, all for 7 principal components.)
首先,我花了一个小时试图解决这个难题,逐渐使自己更加沮丧,直到我受不了为止,然后向埃德(我最亲密的同事)抱怨.(First I spent an hour trying to figure it out the hard way, getting progressively more demoralized, until i couldn’t stand it any more and went to whinge to Ed (my closest co-worker).)
多年来,我为他进行了一系列的短视更改,这使我大吃一惊,但我想到的是,我所需要的只是一种确定哪些代码已更改的方法,例如,在过去一年中,该代码已作为更改代码的指标目前正在使用中.(As i regaled him with the litany of short-sighted changes that had been made over the years, it occurred to me that all i needed was a way of determining what code had changed, say, over the last year as an indicator of what code was currently in use.)
用VssReporter进行了两个查询,几个小时之后,整个工作就完成了!(Two queries with VssReporter and a couple of hours later and the whole thing was done!)
- 偷窥!(Snooping!)
令我感到震惊的是,作为一名程序员,我从未惊讶于我有多少同事会仅仅因为他们可以修改别人的代码而感到惊讶.(To my continued dismay as a programmer, I never cease to be amazed at how many of my co-workers will modify someone else’s code simply because they can.)
这不是我的直接经验(我发现人们从不修改我的代码,如果您了解我的意思的话),而不是几年前观察一个由4个人组成的团队,他们正在研究3D引擎.(This is less my direct experience (I find people never modify my code more than once if you get my meaning), than observing a team of 4 guys working on a 3D engine a few years ago.)
每隔几天,您会听到一声尖叫,因为几天后已对某人实施的修复程序进行了"修复”.(Every so often you would hear a scream because a fix someone had implemented had been ‘unfixed’ a few days later.)
共享代码库也会发生类似的问题:对一个项目的修复可能会破坏另一个项目.(Similar problems occur with shared code libaries: a fix for one project can break another.)
因此,我现在每隔一段时间在某些项目上运行VssReporter查询,以查看是否有任何更改-“被警告已被预备”(或者不管如何).(So every so often I now run VssReporter queries on certain projects to see if anything has changed - ‘forewarned is forarmed’ (or however it goes).)
安装VssReporter(Installing VssReporter)
- 复制(Copy)*VssReporter.exe(VssReporter.exe)*到合适的工具位置.(to a suitable tools location.)
- 运行.(Run it.)
- 可能会提示您找到(You may be prompted to locate)*ssapi.dll(ssapi.dll)*如果未注册,但如果VSS安装正确,则不太可能.(if its not registered but this is unlikely if VSS is installed correctly.)
使用VssReporter(Using VssReporter)
使用VssReporter几乎和安装它一样简单:(Using VssReporter is almost as trivial as installing it:)
- 选择(或浏览)到您选择的VSS数据库.(Select (or Browse) to your VSS database of choice.) 注意(Note):这将在关闭VssReporter时保存,并在下次运行时恢复.(: this will be saved on closing VssReporter and restored on next run.)
- 突出显示要在其上运行查询的VSS项目.(Highlight the VSS project on which you want to run your query.)
- 选择您是否对每个人,您自己或特定程序员所做的文件更改感兴趣.(Select whether you are interested in file changes made by everyone, just yourself or a specific programmer.)
- 选择是查询"之后",“之前"还是"之间"的日期或标签(Choose whether to query ‘After’, ‘Before’ or ‘Between’ dates or labels)
- 输入日期或标签(Enter the date(s) or label(s))
- 点击"报告"按钮.(Click the ‘Report’ button.) 这将在右侧列表控件中生成文件列表,如果将列表向右滚动,则该列表还会显示上次更改文件和更改文件的人.(This will generate a list of files in the right-hand list control which, if you scroll the list to the right, also displays the last time the file was changed and the person who changed it.)
之后,您可以将结果作为格式文本复制到剪贴板,或者右键单击单个文件并在父项目上打开SourceSafe.(Thereafter you can either copy the results to the clipboard as formatted text, or right-click on individual files and open SourceSafe on the parent project.)
内部VssReporter(Inside VssReporter)
VssReporter通过ssapi.dll中包含的类型库导出的对象模型来操作VSS(听起来正确吗?).(VssReporter manipulates VSS via the object model exported by the type library contained within ssapi.dll (does that sound right?).)
从本质上讲,这只是一个电话案例(Essentially its just a case of calling)
#import "ssapi.dll" no_namespace
然后就是阅读任何您可以放手的文档并进行大量试验和错误的案例.(Then its a case of reading whatever documentation you can lay your mits on and carrying out lots of trial and error.)
我认为VssReporter上VSS代码的核心来自MSDN,但如果有人认为我可能使用过其代码,那么请告诉我,我会加点功劳.(I think the core of the VSS code on VssReporter came from MSDN but if anyone thinks that there is credit due to anyone whose code I might have used then please tell me and I’ll add a credit.)
其他景点(Other points of interest)
因为VssReporter的VSS相关位并不令人兴奋,所以我想指出一些您可能会发现有用的其他位.(Because the VSS related bits of VssReporter are not that exciting, I thought I’d point out some other bits and pieces that you might find useful.)
这些是:(These are:)
- 按需填充树控件(请参见(Filling a tree control on demand (see)
CVSSTreeCtrl::OnItemexpanding()
在(in)VSSTreeCtrl.cpp(VSSTreeCtrl.cpp))()) - 实施"停止"按钮以取消冗长的操作(请参见(Implementing a ‘Stop’ button to cancel a lengthy operation (see)
CVssreporterDlg::ReportOnItem()
和(and)CVssreporterDlg::Continue()
在(in)VSSReporterDlg.cpp(VSSReporterDlg.cpp))()) - 执行应用程序并等待其终止,然后再继续(请参阅(Executing an application and waiting until it has terminated before continuing (see)
CVssreporterDlg::OnInitDialog()
在(in)VSSReporterDlg.cpp(VSSReporterDlg.cpp))()) - 简单的剪贴板用法(请参阅(Simple clipboard usage (see)
CVssreporterDlg::OnCopytoclipboard()
在(in)VSSReporterDlg.cpp(VSSReporterDlg.cpp))())
进一步的工作(Further Work)
- 列印(Printing)
- 额外检查当前签出文件的功能.(Facility to additionally check for files currently checked out.)
版权(Copyright)
此处提供了该代码,供您不受限制地使用和滥用,除了您不能修改它并以自己的身份将其传递出去.(The code is supplied here for you to use and abuse without restriction, except that you may not modify it and pass it off as your own.)
历史(History)
-
2.1(2.1)(2006年3月26日)((26 Mar 2006))
- 搜索结束时播放的系统"星号"声音(system ‘Asterisk’ sound played at the end of a search)
- 清单已添加(以提供主题支持)(manifest added (to give themed support))
- 选项卡式文件定界符错误已修复(tabbed file delimiter bug fixed)
- 文件标签已添加到结果列表(file label added to results list)
- 标签搜索更改为"包含"而不是"等于"以提供更大的灵活性(label search changed to ‘containing’ rather than ‘equals’ to give more flexibility)
- 调用VSS时使用命令行的用户名/密码(username/password to commandline when invoking VSS)
- 文件类型图标移到单独的结果列中以启用对类型的排序(file type icon moved into separate result column to enable sorting on type)
- 对话框字体更改为tahoma(dialog fonts changed to tahoma)
- 提示添加到在复制文件时不重建树(即文件夹结构被展平)(prompt added to not rebuild tree when copying files (ie folder structure is flattened))
-
2.0(2.0)(2004年9月10日)((10 Sep 2004))
- 为Visual SourceSafe 5添加了支持(support added for Visual SourceSafe 5)
- 支持已删除文件(support added for deleted files)
- 图标添加到结果列表中以区分添加,编辑和删除(icons added to results list to differentiate between additions, edits and deletions)
-
1.9.2(1.9.2)(2004年3月10日)((10 Mar 2004))
- 修复与错误清除智能指针有关的错误(fixed bugs relating to incorrect cleanup of smart pointers)
-
1.9.1(1.9.1)(2004年3月3日)((3 Mar 2004))
- 小调整(minor tweak)
-
1.9(1.9)(2004年2月12日)((12 Feb 2004))
- 修复了与在未搜索签到标签的标签上搜索标签有关的错误(fixed a bug relating to searching on labels where labels attached to check-ins were not being searched)
- 在结果列表中添加了"差异"功能.通过” Diff Config …“按钮指定自己选择的差异工具(added ‘diffing’ capabilities to the results list. specify the diff tool of your own choice via the ‘Diff Config…’ button)
- 评论添加到结果列表(comments added to the results list)
- 对查询描述文本的次要澄清调整(minor clarification tweaks to the query description text)
-
1.71(1.71)
- 修复了与输入包含空格的"其他编码器"名称有关的错误(感谢(fixes bug relating to entering ‘other coders’ names containing spaces (thanks to)迈尔斯`戴维斯(Miles Davis)(Miles Davies))())
- 包含空格的"其他编码器"名称不包含在单引号中(‘other coders’ names containg spaces are now enclosed in single quotes)
-
1.7(1.7)
- 添加将结果另存为xml的选项(建议由(adds options to save results as xml (suggested by)罗伯`海格(Rob Hegt))())
- 尝试澄清查询的期望(建议(attempts to clarify what to expect from queries (suggested by)贾德(Judd))())
- 修复了一些与查询相关的UI错误(感谢(fixes some more query related UI bugs (thanks to)贾德(Judd))())
- 在结果上下文菜单中添加"全选"和"复制"选项(建议由(adds “Select all” and “copy” options to results context menu (suggested by)克里克利(KLIKLI))())
- 现在仅复制/保存所选结果(now only the selected results are copied/saved)
- 在制表符分隔结果文本中添加选项,以便轻松导入excel(建议由(adds option to tab-delimit results text for easy import into excel (suggested by)克里克利(KLIKLI))())
- 修复了日期/时间未与其他结果文本复制的错误(感谢(fixes bug where date/time was not getting copied with the other results text (thanks to)克里克利(KLIKLI))())
- 递归复选框增加了对搜索深度的更多控制(建议(recursive checkbox added to give more control over the depth of the search (suggested by)克里克利(KLIKLI))())
- 结果文件名和路径现在位于单独的列中(建议由(results filename and path now in separate columns (suggested by)克里克利(KLIKLI))())
- 结果标题控件现在显示排序方向(results header control now shows sort direction)
-
1.6(1.6)
- 各种查询对话框相关的UI调整(感谢(various query dialog related UI tweaks (thanks to)贾德(Judd))())
- 修复了标签查询中显示标签细节的错误,而不是标签前的最后一个mod的细节(感谢(fixes bug on label queries where the details of the lael were being displayed rather than the details for the last mod immediately preceding the label (thanks to)克里克利(KLIKLI)).().)
- 修复了针对"上次修改的"查询显示重复条目的错误(感谢(fixes bug where duplicate entries were shown for ‘last modified’ queries (thanks to)克里克利(KLIKLI))())
- 密码编辑框将重点放在启动上(建议由(password edit box has the focus on startup (suggested by)克里克利(KLIKLI))())
- 添加到对话框标题栏中的版本号(建议由(version number added to dialog titlebar (suggested by)克里克利(KLIKLI))())
-
1.5(1.5)
- 实质性重构(substantial refactoring)
- 更有效=>更快的报告(more efficient => faster reporting)
- 当前查询的简明英语摘要(plain english summary of current query)
- 添加了结果列排序(建议由(added results column sorting (suggested by)克里克利(KLIKLI))())
- 添加功能以报告具有特定标签的文件(建议由(added facility to report on files having a certain label (suggested by)乌利`格雷佩尔(Uli Grepel)(Uli Grepel))())
- 添加功能以报告某个标签或日期之间(之前或之后)的所有版本的文件(建议由(added facility to report on all versions of files between/before or after a certain label or date (suggested by)克里克利(KLIKLI))())
-
1.4(1.4)
- 围绕ssapi.dll关键调用添加了更多的try/catch代码.(added some more try/catch code around key ssapi.dll calls.)
- 修复了本地化问题(感谢(fixed localization problems (thanks to)磨碎者(tbrammer))())
- 添加了将结果直接保存到文件的功能(感谢(added facility for saving results directly to file (thanks to)???(???))())
- 添加了将结果文件复制到用户定义的文件夹的功能(感谢(added facility for copying result files to user defined folder (thanks to)亨里克`格雷克(Henrik Grek)(Henrik Grek))())
- 修复了无法正确报告某些项目的过滤代码中的错误(感谢(fixed bug in filtering code where some items would not be correctly reported (thanks to)磨碎者(tbrammer))())
- 添加对返回键的处理,以便当用户名/密码字段具有焦点时,它将重新加载选定的数据库(感谢(add handling for return key so that when the username/password fields have the focus it will reload the selected database (thanks to)克里克利(KLIKLI))())
- 版本号已添加到exe资源(感谢(version number added to exe resources (thanks to)克里克利(KLIKLI))())
- 修正了一些小错误(minor bug fixes)
- 将结果复制到剪贴板或文件时,大大加快了"结果->文本"生成(significantly speeded up the ‘results->text’ generation when copying results to clipboard or file)
-
1.3(1.3)
- 在关键的ssapi.dll调用周围添加了一些try/catch代码.例如,如果用户没有查看文件的正确权限(例如,(added some try/catch code around key ssapi.dll calls. These can throw exceptions if, for instance, the user does not have the correct permissions to view a file (thanks to)罗伯特`哈伯(Robert Harber))())
- 如果找不到其他标签之一,则可以改善用户反馈.(improved user feedback if one of other of the labels cannot be found.)
- 较小的返工,以便也可以使用"停止"按钮停止"标签查找”(minor reworking so that ‘label finding’ can also be stopped using the ‘Stop’ button)
- 可能的修复(possible fix for)**视觉人(Vision Guy)**关于日期和标签的报告(无承诺!)(relating to reporting on dates and labels (no promises!))
-
1.2(1.2)
- 添加了支持以允许修改vss登录名和密码(感谢(support added to allow modification of the vss login name and password (thanks to)shtwang,贾德,马可(shtwang, Judd, Marco))())
-
1.1(1.1)
- 虚假引用(spurious reference to)vsdiff.h(vsdiff.h)已经从…删除(removed from)vssreporterdlg.h(vssreporterdlg.h)(谢谢((thanks to)德芬斯(Dfens))())
-
1.0(1.0)
- 初始发行(Initial Release)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
VC7.0 VC7.1 VC6 WinXP Win2003 Win2K VS2005 VS.NET2003 QA Dev 新闻 翻译