简体   繁体   English

是否有可能获得修改方法的名称而不仅仅是perforce的类名?

[英]Is it possible to get name of modified method instead of just the class name with perforce?

I was wondering if you have an idea about how retrieve the name of a modified methods instead of the class name in perforce? 我想知道你是否知道如何在perforce中检索修改方法的名称而不是类名?

I mean, when you want to see the changes you have done before commit it, you type: p4 opened 我的意思是,当你想要在提交之前看到你所做的改变时,你输入:p4 opens

So know, I want to find the modified line, analyze the java file and say: ok you have modified some code in these methods or ok you have modified something outside any methods (like an attribute) 所以知道,我想找到修改过的行,分析java文件然后说:确定你已经在这些方法中修改了一些代码,或者你已经修改过任何方法之外的东西(比如属性)

So my question is: How I should do that? 所以我的问题是:我该怎么做? Any libraries can do that? 任何图书馆都可以做到吗? A Parser like JavaCC is a good idea? 像JavaCC这样的解析器是个好主意?

Thanks! 谢谢!

Perforce doesn't provide any kind of custom parsers which could figure out information like that. Perforce没有提供任何类型的自定义解析器,可以找出这样的信息。 The point of change management systems is that they can hold any kind of files. 变革管理系统的角色是它们可以容纳任何类型的文件。

Which methods changed would be specific to the source (in this case java files) and would be very tricky to implement because every language would require its own parser. 哪些方法更改将特定于源(在本例中为java文件),并且实现起来非常棘手,因为每种语言都需要自己的解析器。

Could it be done? 可以吗? Maybe, but change management is already tricky enough as it is and I don't see any big change management project coupling themselves to a specific language to accomplish what you're asking for. 也许吧,但变更管理本身已经很棘手了,我没有看到任何重大变革管理项目将自己与特定语言结合起来以实现您的要求。

In the meantime, you could just use p4 diff /path/to/file/NameOfFile.java before you submit. 与此同时,您可以在提交之前使用p4 diff /path/to/file/NameOfFile.java This will show you which lines changed and in most cases it is sufficient to narrow down what exactly changed. 这将显示哪些行已更改,在大多数情况下,只需缩小准确更改的内容即可。 Before I submit, I usually go through and p4 diff every file listed when I run p4 opened and p4 revert any files I marked for edit, but didn't end up making any changes to. 在我提交之前,我经常通过p4 diff运行p4 opened时列出的每个文件, p4 revert我标记为编辑的任何文件,但最终没有对其进行任何更改。

查看P4Eclipse插件,它提供了一个支持Java的diff视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM