I know I can search svn logs using svn log --search $pattern. However, I'd like to limit the results to a certain number. The only thing I was able to find is the -l option but it limits the original log entries on which the search is run and I'd like for the search to be run on the entire log history and only limit the number of results themselves.
There is no built-in way to tell svn log --search to limit the results. As you already know, you can limit the number of revisions it checks, but this is not what you look for. I guess that you could write a script that checks the output of svn log and cuts it to the necessary amount. Don't forget that you could use --xml switch.
If you desperately need such feature by some reason, drop a line to users# Apache Subversion mailing list. Describe how and why you need this enhancement and maybe it will be filed as a feature request. :)
Linux style:
svn log --search $pattern | head -n 10
Related
Consider this:
svn log -r HEAD:1 --search $pattern | head -4
Sometimes this command finds the necessary amount of lines (e.g. 4) and stops. But sometimes it just keeps searching (i.e. hangs) even after having found the necessary amount of lines.
I don't know on what it depends (whether it keeps searching or stops). I would like to know the reason and I would like to know how to modify my command so it always stops right after having found the necessary amount of lines (I don't want the svn log to search the entire svn history as this might take forever).
Plain svn log will always continue showing the revision history from HEAD revision to 0 relevant to your query unless you kill the process (assuming that you don't use the --limit switch or specified some subtree like /branches/myfeature). Adjust your script to kill the process once it shows the required number of log messages.
with svn log | grep "keyword"
I can grep the line containing the "keyword", e.g.,
svn log -v | grep "recur"
(endless recursion) when deleting an object in the tree.
However, how can I get the revision number of this commit?
I am using svn 1.6 (not latest one, which has no svn search)
I don't know that working with the command-line svn tools is the way to go here. Your best bet is probably to use the Subversion library's bindings for a scripting language like Python or Ruby. You can retrieve a log as an list of objects (one per revision) that have the commit message and revision numbers as members. Finding what you're looking for would simply involve iterating the list.
I am wondering if its possible to list who all modified the file with course of time. I am aware that stat or ls -lrt will give the last user who modified the file. But I want to find out if it is possible to find the N-1 user who modified the file.
Note: I think chances are very slim to find such user. Just want to confirm with experts before declaring its a dead end.
Example:
At 1:00 AM ABC modified the file
At 2:00 AM XYZ modified the same file.
I am aware that XYZ has modified the file, How to find who modified the file before XYZ (In this case ABC)?
One hack that can be used is (This will only work for the recent modification) you can check the last modified time for the file, and cross check with the log-in times of the users. You might be able to narrow the list down.
use stat command (ex: stat , See this)
Find the Modify time
Use last command to see the log in history (see this)
Compare the log-in/log-out times with the file's Modify timestamp
This will not work all the time, but you can narrow the results down.
I am aware that stat or ls -lrt will give the last user who modified the file.
No. Modifying a file does not change its owner.
In general filesystems do not keep track of modification histories. If this information is crucial, the way to go is
For complete file hierarchies: a VCS (Version Control System) like Git, Subversion, Mercurial, CVS, ...
For single files, RCS or SCCS, ...
It is possible to configure auditing to track changes to specific files. There are some limitations:
it has to be configured before the changes of interest
the auditing daemon tends to refuse to start if told to watch a file which has been deleted.
Still, it can be useful. Look for auditctl. Here are some useful links discussing the topic:
Linux audit files to see who made changes to a file
Monitoring Linux File access, Changes and Data Modifications
Track file changes using auditd
The Linux Audit System, or Who Changed That File?
It is not possible to track user details like username who modify the file by a particular command. Only we can check the assigned username to file by ls -l.
dear all,
I am using the Perforce Windows x64 GUI 2014.1888424. Per my test, the answer is NO. It will use the assigned revision number.
I found the "integrate" and "branch" commands also don't keep the revision info.
Are these commands designed to behavior like this?
PS: I know that rename/move will keep the revision info.
Would you please give me any hint? Thank you very much!
You didn't describe precisely what test you did, so I'm speculating slightly, but: the Perforce integrate, copy, and merge commands do preserve the overall revision history of the file.
However, many of the commands which display file history do not display the full history by default; you have to specify additional commands to instruct the server to output the history across integrations.
For example, compare the output of
p4 filelog -i
versus
p4 filelog
or
p4 changes -i
versus
p4 changes
for your experiments.
The -i flag tells the server that you want to see the history of the file from prior to the integration or copy from its previous location. Here's how it's described in 'p4 help filelog':
The -i flag includes inherited file history. If a file was created by
branching (using 'p4 integrate'), filelog lists the revisions of the
file's ancestors up to the branch points that led to the specified
revision. File history inherited by renaming (using 'p4 move') is
always displayed regardless of whether -i is specified.
Note that, as you've observed, renaming is indeed handled differently than integ/copy/merge.
As for myself, when I am studying the history of a file, I tend to nearly always use the P4V tool and its supremely powerful Revision Graph and Time Lapse View tools. These tools know how to navigate all sorts of complex integration history, and make studying the history of a file much easier.
I want to be able to print out all of the changes to the code since a certain date. Without manually copy and pasting the information from all the commit logs, is there an easier way to get all this information into a central location?
svn log -r {DATE} > myfile.txt