How can I release locks in Subversion recursively? - version-control

I am having a problem with version control in Subversion. I checked out a working copy from respository and got locks on all of its files. Then, without releasing the locks I have deleted the folder from disk.
I can't delete the folder from repository, since its got a lock
If the I and try to release the locks recursively, it says there are no locks to be released.
In Browse Repository view, I can only break the locks on particular, not folders recursively.
How can I break the locks residing in repository? I am using TortoiseSVN on Windows.
Is there a command to break locks recursively for a folder?

Ok I got it. Here's what worked for me.
Check out a
working copy
Then go in Windows explorer menu,
TortoiseSVN -> Check for
modifications...
Click on Check repository button
Select All the files, right click and
select the break lock option
Delete the working copy and the one
in repository. Voila! :)

Doing an SVN cleanup will release the lock as well:
$ svn cleanup

From the advance locking section
$ svn status -u
M 23 bar.c
M O 32 raisin.jpg
* 72 foo.h
Status against revision: 105
$ svn unlock raisin.jpg
svn: 'raisin.jpg' is not locked in this working copy
That simply means the file is not locked in your current working directory
, but if it is still locked at the repository level, you can force the unlock ("breaking the lock")
$ svn unlock http://svn.example.com/repos/project/raisin.jpg
svn: Unlock request failed: 403 Forbidden (http://svn.example.com)
$ svn unlock --force http://svn.example.com/repos/project/raisin.jpg
'raisin.jpg' unlocked.
(which is what you did through the TortoiseSVN GUI)

If somebody else has locked the files remotely, I found that using TortoiseSVN 1.7.11 to do the following successfully unlocked them in my working copy. (similar to vikkun's answer)
Right click working copy > Check for modifications
Click Check repository button
Select files you wish to unlock
Right click > Get lock
Check "Steal the lock" checkbox
After lock is stolen, select again
Right click > Release lock
Files in working copy should now be unlocked.

Unless you have admin access to the svn machine and can use the 'svnadmin' tool, your best option seems to be this:
Checkout the problematic directory using svn checkout --ignore-externals *your_repo*
Use svn status --show-updates on the checked out repository to find out which files are potentially locked (if someone finds the documentation on the meaning of the status codes please comment).
Use svn unlock --force *some_file* on the files found at 2.
I've used the following one-liner to automate 2. and 3.:
svn status -u | head -n -1 | awk '{ print $3 }' | xargs svn unlock --force

If you have access to the svnadmin tool in the repo server, you can use this alternative to remove all locks (based on the script posted by VonC)
svnadmin lslocks <path_to_repo> |grep -B2 Owner |grep Path |sed "s/Path: \///" | xargs svnadmin rmlocks <path_to_repo>

The repository administrator can remove the locks (recursively), operating on hundreds of files inside a problematic directory -- but only by scripting since there is not a --recursive option to svnadmin rmlocks.
$repopath=/var/svn/repos/myproject/;
$problemdirectory=trunk/bikeshed/
IFS=$'\n'; for f in $(sudo svnadmin lslocks $repopath $problemdirectory \
| grep 'Path: ' \
| sed "s/Path: \///") ; \
do sudo svnadmin rmlocks $repopath "$f" ; done
This solution works with filenames that have spaces in them.

For me deleting the lock file inside .svn did not work since I got bad checksum msg after trying to update the file.
I got the following msg after executing svn cleanup inside the directory:
svn: In directory ''
svn: Can't copy '.svn/tmp/text-base/file_name.svn-base' to 'filename.3.tmp': No such file or directory
So I copied my file to .svn/tmp/text-base and changed the name to file_name.svn-base. Then cleanup and update worked fine.

When I tried to run the script from above as originally provided, I was getting an error when it tried to set the variables:
./scriptname: line1: =/svn/repo/path/: No such file or directory
./scriptname: line2: =directory/: No such file or directory
I removed the '$' from the first two lines and this worked perfectly after that.
repopath=/var/svn/repos/myproject/;
problemdirectory=trunk/bikeshed/
IFS=$'\n'; for f in $(sudo svnadmin lslocks $repopath $problemdirectory \
| grep 'Path: ' \
| sed "s/Path: \///") ; \
do sudo svnadmin rmlocks $repopath "$f" ; done

Related

How to change (CQ5) VLT repo url/port?

I have checked out vlt repo using:
vlt co http://localhost:4502/crx/-/jcr:root path/to/repo --force
But now, my CQ instance changed location (port). Is there a way to set new URL(port) to vlt?
(without checking out again)
I have tried unzipping path/to/repo/.vlt and changing repository.url file sometimes it works, but in most cases it breaks local repo, or I'm unable to unzip.
I understand you're looking for something like the "svn relocate" command. This is not possible with the VLT tool directly.
Options (any one of these should do it):
I recommend checking out a new copy of the repository and reapplying the changes that show from running "vlt status" over there.
Set up a new CQ server on the old port, then use "vlt rcp". The process would probably be: copy the whole repository from old to new server, push your local stuff to the new server, copy part of the tree from new to old.
The repository.url setting is nested in .vlt files under all subdirectories of the repository. You could try a global/recursive search & replace for all of these. I've never tried this though. For example, something like this: (I get permission denied running this, needs more work.)
find -name .vlt -type f -print0 | xargs -0 sed -i 's/localhost:4502/localhost:4503/g'
Remove all the .vlt files and use the vlt import/export commands to load. See the "Using import/export instead of .vlt control" section of this document: http://wem.help.adobe.com/enterprise/en_US/10-0/core/how_to/how_to_use_the_vlttool.html

Restore deleted file directly from Eclipse local history

Some git mistakes happened and I lost a lot of changes for one file. I was using Eclipse as my IDE but the git mishap included deleting the project and re cloning the directory. So I can't do the restore from within Eclipse. I believe I have found the local history file that contains the code I want to restore but I'm not sure how to cat this file. It kinda looks like a json.
Anyone know how to restore or read the .metadata.plugins\org.eclipse.core.resources.history
files?
I was able to recover my code.
I went to prj/.metadata/.plugins/org.eclipse.core.resources/.history
Then did some bashing:
fgrep -r -c "[Some function name specific to that file]" * | grep -v ":0" | cut -d : -f 1 | xargs ls -l | grep "Jul 29"
So this is greping and counting the number of times some text specific to the code I'm missing shows up in the files, then removes the files where the count is 0, then removes the count from the end of the file name, then does ls to get details on the files, then optionally search for a specific day. Since I was working with clojure I noticed that there were files that either had a large or small file size. The large files were backups of the REPL, the small files were backups of the code.
+1 for Eclipse :)

Delete a Perforce client workspace with pending files when the workspace has already been removed from disk?

How do I delete a workspace that has pending files when that workspace has already been removed from disk?
Caveats:
p4 command line only; not p4v gui
regular user access; no admin access
Scenario:
create a workspace named user_workspace on the disk in the ~/my_workspace directory
p4 edit files in workspace on the default pending changelist
remove workspace by hand (rm -rf ~/my_workspace)
workspace still exists on server with pending files
Solutions that don't work:
1: Delete workspace
Doesn't work because the workspace has files opened.
p4 client -d user_workspace
Client 'user_workspace' has files opened; use -f to force delete.
2: Delete workspace with force
Doesn't work because not admin.
p4 client -d -f user_workspace
You don't have permission for this operation.
3: Delete the pending changelist; then delete workspace (try 1)
p4 changes -c user_workspace -s pending
Only lists pending numbered changelists, does not handle the default pending changelist.
p4 -c user_workspace -d changelist_number
Not possible because there is no changelist number for the pending changelist.
4: Delete the pending changelist; then delete workspace (try 2)
Trying to do a p4 revert on a directory that does not exist anymore gives a strange error.
p4 revert ~/my_workspace
/home/user/my_workspace - must refer to client 'user_workspace'.
p4 -c user_workspace revert ~/my_workspace
/home/user/my_workspace - must refer to client 'user_workspace'.
setenv P4CLIENT user_workspace; p4 -c user_workspace revert ~/my_workspace
/home/user/my_workspace - must refer to client 'user_workspace'.
1. Revert the pending changelist
Have to use Perforce depot notation instead of local directory notation because the local directory does not exist anymore.
p4 -c user_workspace revert -k //...
//blah/blah/blah/file#rev - was edit, reverted
2. Delete the client workspace
p4 client -d user_workspace
Client user_workspace deleted.
this will give you the pending changes on the client
p4 changes -c user_workspace
this will delete the pending change list of your choice
p4 change -d <change list number>
after that, you can delete the client using
p4 client -d user_workspace
The command line did not work for me. It kept reporting "over license quota" for any commands. I probably have something configured wrong related to that. This would mean I would have to first correct that problem and then use the above solution. However, I found another way to fix this issue using the p4v client.
The junk workspaces were old workspaces from my previous computer. Those without any files checked out I was able to right-click delete in the workspaces tab view. Those workspaces with files left checked out I was not able to remove as other are experiencing. To removes these I had to take a few extra steps.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Alternatively: Try these four step using only the p4v client *
Edit the workspace and just blank out the host field of the old workspace. In another thread I read this allows editing from any computer.
Switch to the workspace
Revert the files in the WORKSPACE view; there was no need to sync the files to my local machine
Delete the workspace after switching back to the workspaces tab.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I hope this helps someone.
Wrote this script called p4-delete-client for deleting a p4 client (which has changelists & other problems).
It has the following features:
automatically deletes changelists (reverts pending & deletes shelved)
fixes hostname (if differs from the one the client was created on)
unlocks the client if locked
deletes the client
deletes associated files (can be configured not to from arguments)
Note that the script relies on other scripts in the repo.
The rm -rf command only deleted files on your system, the workspace still exists in perforce. If you want to delete it, you have to revert the files first.
p4 revert ~/my_workspace
p4 client -d user_workspace

Mercurial hook not executing properly

This should be a very simple thing to have run, but for some reason it won't work with my Mercurial repository. All I want is for the remote repo to automatically run hg update whenever someone pushes to it. So I have this in my .hg/hgrc file:
[hook]
changegroup = hg update
Simple, right? But for some reason, this never executes. I also tried writing a shell script that did this. .hg/hgrc looked like this:
[hooks]
changegroup = /home/marc/bin/hg-update
and hg-update looked like this:
#!/bin/sh
hg help >> /home/marc/works.txt;
hg update >> /home/marc/works.txt;
exit 0;
But again, this doesn't update. The contents of hg help are written out to works.txt, but nothing is written out for hg update. Is there something obvious I'm missing here? This has been plaguing me for days and I just can't seem to get it to work.
Update
Okay so again, using the -v switch on the command line from my workstation pushing to the remote repo doesn't print any verbose messages even when I have those echo lines in .hg/hgrc. However, when I do a push from a clone of the repo on the same filesystem (I'm logged in via SSH), this is what I get:
bash-3.00$ hg -v push ../test-repo/
pushing to ../test-repo/
searching for changes
1 changesets found
running hook prechangegroup: echo "Remote repo is at `hg tip -q`"
echo "Remote repo wdir is at `hg parents -q`"
Remote repo is at 821:1f2656753c98
Remote repo wdir is at 821:1f2656753c98
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
running hook changegroup: echo "Updating.... `hg update -v`"
echo "Remote repo is at `hg tip -q`"
echo "Remote repo wdir is at `hg parents -q`"
Updating.... resolving manifests
getting license.txt
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Remote repo is at 822:389a6c7276c6
Remote repo wdir is at 822:389a6c7276c6
So it works, but again only when I push from the same filesystem. It doesn't work if I try pushing to the repo from another workstation over the network.
Well, after going through the same steps of frustration as Marc W did a while ago, I finally found the solution to the problem, at least when remote serving is done with the hgwebdir WSGI script.
I found out that when using this kind of remote push via HTTP or HTTPS, Mercurial simply ignores everything you write into the .hg/hgrc file or your repository. However, entering the hook in the hgwebdir config does the trick.
So if the bottom line in your hgwebdir.wsgi script is something like
application = hgwebdir('hgweb.config')
the [hooks] config section needs to go into the mentioned hgweb.config.
One drawback is that these hooks are executed for every repository listed in the [paths] section of that config. Even though HG offers another WSGI-capable function (hgweb instead of hgwebdir) to serve only a single repository, that one doesn't seem to support any hooks (neither does it have any config).
This can, however, be circumvented by using a hgwebdir as described above and having some Apache RewriteRule map everything into the desired subdirectory. This one works for me:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/reponame
RewriteRule ^(.*)$ reponame/$2 [QSA]
Have fun using your remote hooks over HTTP :D
I spent some time researching this myself. I think the answer to problem is described concisely here:
Output has to be redirected to stderr (or /dev/null), because stdout
is used for the data stream.
Basically, you're not redirecting to stderr, and hence polluting stdout.
First of all, I want to correct a few comments above.
Hooks are invoked also when pushing over file system.
It is not necessary to keep the hook in the repo on which you want them to operate. You can also write the same hook as in your question on the user end. You have to change the event from changegroup to outgoing and also to specify the URL of remote repo with the -R switch. Then if the pushing user has sufficient privileges on the remote repo, the hook will execute successfully.
.hg/hgrc
[hooks]
outgoing = hg update -R $HG_URL
Now towards your problem.... I suggest creating both prechangegroup and changegroup hooks and printing some debugging output.
.hg/hgrc
[hooks]
prechangegroup = echo "Remote repo is at `hg tip -q`"
echo "Remote repo wdir is at `hg parents -q`"
changegroup = echo "Updating.... `hg update -v`"
echo "Remote repo is at `hg tip -q`"
echo "Remote repo wdir is at `hg parents -q`"
And also push with the -v switch, so that you may know which hook is running. If you still can't figure out, post the output. I might be able to help.
My problem was that my hgwebdir application ran as the "hg" user, but the repository was owned by me, so I had to add in this bit of config to hgweb.config to get it to run the hooks:
[trusted]
users = me
You need to have it in the remote repositiory's hgrc. It sounds as if it's in your local repo.
Edit: It also depends on how you're pushing. Some methods don't invoke hooks on the right side. (ssh does, I think HTTP does, file system does not)
Edit2: What if you push "locally" at the remote repo's computer. You might have different users/permissions between the webserver and the hgrc-file. (See [server] and trusted directives for hgrc.)
I had the same problem pushing from Windows Eclipse via http, but after capturing stderr, I found that the full path was needed to the hg.bat file. My hooks section now looks like:
[hooks]
incoming = c:\Python27\Scripts\hg.bat update > hg_log.txt 2>>hg_err.txt
Hope this helps someone else.
SteveT
Try turning on hook debugging to see why it's not running.
Likely a permissions issue or something like that.
took a while but I got it working.
I started with
[hooks]
tag=set >&2
commit=set >&2
the >&2 pipes it to standard error so remote consoles will show it.
when remote this should output in console if it is running
hg push https://host/hg -v
It wasn't.
I was using hgweb.cgi so I switched to hgweb.wsgi with no difference.
what I discovered is that some hooks don't get called on remote.
when I switched it to
[hooks]
incoming= set >&2
the hooks tag and commit don't seem to get called but incoming and changeset do get called. I haven't confirmed the others.
now that I got it working I switched back to hgweb.cgi and everything works the same.
Tthe reason I've found for this has nothing to do with redirecting stdout to stderr. As you may see in the wiki page it is not specified on the wiki's current version
https://www.mercurial-scm.org/wiki/FAQ#FAQ.2FCommonProblems.Any_way_to_.27hg_push.27_and_have_an_automatic_.27hg_update.27_on_the_remote_server.3F
The problem I've found is around permissions.
In my original setup, I had a user, lets say hguser with a repo on its home, and a script /etc/init.d/hg.init to launch hg serve. The problem being hg serve was being run by root, while most files under the repo pertained to hguser (some of them switched to root at some point, but it won't mind, since I'll correct them with chown)
Solution:
chown -R hguser:hguser /home/hguser/repo (to correct ALL files, back to hguser)
launch su hguser -c "hg serve ..." (in my case from /etc/init.d/hg.init)
changegroup = hg update -C under [hooks] in repo/.hg/hgrc as usual
Now it should work on push
PS: in my case, I rather update to the head of a specific branch, so I use hg update -C -r staging, to make the staging server update only to the head of the intended branch, even if the tip is from another branch (like development for instance)
BTW my hg.init script ended up like this: (notice the su hguser part)
#!/bin/sh
#
# Startup script for mercurial server.
#
# #see http://jf.blogs.teximus.com/2011/01/running-mercurial-hg-serve-on-linux.html
HG=/usr/bin/hg
CONF=/etc/mercurial/hgweb.config
# Path to PID file of running mercurial process.
PID_FILE=/etc/mercurial/hg.pid
state=$1
case "$state" in
'start')
echo "Mecurial Server service starting."
(su hguser -c "${HG} serve -d --webdir-conf ${CONF} -p 8000 --pid-file ${PID_FILE}")
;;
'stop')
if [ -f "${PID_FILE}" ]; then
PID=`cat "${PID_FILE}"`
if [ "${PID}" -gt 1 ]; then
kill -TERM ${PID}
echo "Stopping the Mercurial service PID=${PID}."
else
echo Bad PID for Mercurial -- \"${PID}\"
fi
else
echo No PID file recorded for mercurial
fi
;;
*)
echo "$0 {start|stop}"
exit 1
;;
esac
PS: due credit to http://jf.blogs.teximus.com/2011/01/running-mercurial-hg-serve-on-linux.html

How to find untracked files in a Perforce tree? (analogue of svn status)

Anybody have a script or alias to find untracked (really: unadded) files in a Perforce tree?
EDIT: I updated the accepted answer on this one since it looks like P4V added support for this in the January 2009 release.
EDIT: Please use p4 status now. There is no need for jumping through hoops anymore. See #ColonelPanic's answer.
In the Jan 2009 version of P4V, you can right-click on any folder in your workspace tree and click "reconcile offline work..."
This will do a little processing then bring up a split-tree view of files that are not checked out but have differences from the depot version, or not checked in at all. There may even be a few other categories it brings up.
You can right-click on files in this view and check them out, add them, or even revert them.
It's a very handy tool that's saved my ass a few times.
EDIT: ah the question asked about scripts specifically, but I'll leave this answer here just in case.
On linux, or if you have gnu-tools installed on windows:
find . -type f -print0 | xargs -0 p4 fstat >/dev/null
This will show an error message for every unaccounted file. If you want to capture that output:
find . -type f -print0 | xargs -0 p4 fstat >/dev/null 2>mylogfile
Under Unix:
find -type f ! -name '*~' -print0| xargs -0 p4 fstat 2>&1|awk '/no such file/{print $1}'
This will print out a list of files that are not added in your client or the Perforce depot. I've used ! -name '*~' to exclude files ending with ~.
Ahh, one of the Perforce classics :) Yes, it really sucks that there is STILL no easy way for this built into the default commands.
The easiest way is to run a command to find all files under your clients root, and then attempt to add them to the depot. You'll end up with a changelist of all new files and existing files are ignored.
E.g dir /s /b /A-D | p4 -x - add
(use 'find . -type f -print' from a nix command line).
If you want a physical list (in the console or file) then you can pipe on the results of a diff (or add if you also want them in a changelist).
If you're running this within P4Win you can use $r to substitute the client root of the current workspace.
Is there an analogue of svn status or git status?
Yes, BUT.
As of Perforce version 2012.1, there's the command p4 status and in P4V 'reconcile offline work'. However, they're both very slow. To exclude irrelevant files you'll need to write a p4ignore.txt file per https://stackoverflow.com/a/13126496/284795
2021-07-16: THIS ANSWER MAY BE OBSOLETE.
I am reasonably sure that it was accurate in 2016, for whatever version of Perforce I was using them (which was not necessarily the most current). But it seems that this problem or design limitation has been remedied in subsequent releases of Perforce. I do not know what the stack overflow etiquette for this is -- should this answer be removed?
2016 ANSWER
I feel impelled to add an answer, since the accepted answer, and some of the others, have what I think is a significant problem: they do not understand the difference between a read-only query command, and a command that makes changes.
I don't expect any credit for this answer, but I hope that it will help others avoid wasting time and making mistakes by following the accepted but IMHO incorrect answer.
---+ BRIEF
Probably the most convenient way to find all untracked files in a perforce workspace is p4 reconcile -na.
-a says "give me files that are not in the repository, i.e. that should be added".
-n says "make no changes" - i.e. a dry-run. (Although the messages may say "opened for add", mentally you must interpret that as "would be opened for add if not -n")
Probably the most convenient way to find all local changes made while offline - not just files that might need to be added, but also files that might need to be deleted, or which have been changed without being opened for editing via p4 edit, is p4 reconcile -n.
Several answers provided scripts, often involving p4 fstat. While I have not verified all of those scripts, I often use similar scripts to make up for the deficiencies of perforce commands such as p4 reconcile -n - e.g. often I find that I want local paths rather than Perforce depot paths or workspace paths.
---+ WARNING
p4 status is NOT the counterpart to the status commands on other version control systems.
p4 status is NOT a read-only query. p4 status actually finds the same sort of changes that p4 reconcile does, and adds them to the repository. p4 status does not seem to have a -n dry-run option like p4 reconcile does.
If you do p4 status, look at the files and think "Oh, I don't need those", then you will have to p4 revert them if you want to continue editing in the same workspace. Or else the changes that p4 status added to your changeset will be checked in the next time.
There seems to be little or no reason to use p4 status rather than p4 reconcile -n, except for some details of local workspace vs depot pathname.
I can only imagine that whoever chose 'status' for a non-read-only command had limited command of the English language and other version control tools.
---+ P4V GUI
In the GUI p4v, the reconcile command finds local changes that may need to be added, deleted, or opened for editing. Fortunately it does not add them to a changelist by default; but you still may want to be careful to close the reconcile window after inspecting it, if you don't want to commit the changes.
Alternatively from P4Win, use the ""Local Files not in Depot" option on the left hand view panel.
I don't use P4V much, but I think the equivalent is to select "Hide Local Workspace Files" in the filter dropdown of the Workspace view tab.p4 help fstat
In P4V 2015.1 you'll find these options under the filter button like this:
I use the following in my tool that backs up any files in the workspace that differ from the repository (for Windows). It handles some odd cases that Perforce doesn't like much, like embedded blanks, stars, percents, and hashmarks:
dir /S /B /A-D | sed -e "s/%/%25/g" -e "s/#/%40/g" -e "s/#/%23/g" -e "s/\*/%2A/g" | p4 -x- have 1>NUL:
"dir /S /B /A-D" lists all files at or below this folder (/S) in "bare" format (/B) excluding directories (/A-D). The "sed" changes dangerous characters to their "%xx" form (a la HTML), and the "p4 have" command checks this list ("-x-") against the server discarding anything about files it actually locates in the repository ("1>NUL:"). The result is a bunch of lines like:
Z:\No_Backup\Workspaces\full\depot\Projects\Archerfish\Portal\Main\admin\html\images\nav\navxx_background.gif - file(s) not on client.
Et voilĂ !
Quick 'n Dirty: In p4v right-click on the folder in question and add all files underneath it to a new changelist. The changelist will now contain all files which are not currently part of the depot.
The following commands produce status-like output, but none is quite equivalent to svn status or git status, providing a one-line summary of the status of each file:
p4 status
p4 opened
p4 diff -ds
I don't have enough reputation points to comment, but Ross' solution also lists files that are open for add. You probably do not want to use his answer to clean your workspace.
The following uses p4 fstat (thanks Mark Harrison) instead of p4 have, and lists the files that aren't in the depot and aren't open for add.
dir /S /B /A-D | sed -e "s/%/%25/g" -e "s/#/%40/g" -e "s/#/%23/g" -e "s/\*/%2A/g" | p4 -x- fstat 2>&1 | sed -n -e "s/ - no such file[(]s[)]\.$//gp"
===Jac
Fast method, but little orthodox. If the codebase doesn't add new files / change view too often, you could create a local 'git' repository out of your checkout. From a clean perforce sync, git init, add and commit all files locally. Git status is fast and will show files not previously committed.
The p4 fstat command lets you test if a file exists in the workspace, combine with find to locate files to check as in the following Perl example:
// throw the output of p4 fstat to a 'output file'
// find:
// -type f :- only look at files,
// -print0 :- terminate strings with \0s to support filenames with spaces
// xargs:
// Groups its input into command lines,
// -0 :- read input strings terminated with \0s
// p4:
// fstat :- fetch workspace stat on files
my $status=system "(find . -type f -print0 | xargs -0 p4 fstat > /dev/null) >& $outputFile";
// read output file
open F1, $outputFile or die "$!\n";
// iterate over all the lines in F1
while (<F1>) {
// remove trailing whitespace
chomp $_;
// grep lines which has 'no such file' or 'not in client'
if($_ =~ m/no such file/ || $_ =~ m/not in client/){
// Remove the content after '-'
$_=~ s/-\s.*//g;
// below line is optional. Check ur output file for more clarity.
$_=~ s/^.\///g;
print "$_\n";
}
}
close F1;
Or you can use p4 reconcile -n -m ...
If it is 'opened for delete' then it has been removed from the workspace. Note that the above command is running in preview mode (-n).
I needed something that would work in either Linux, Mac or Windows. So I wrote a Python script for it. The basic idea is to iterate through files and execute p4 fstat on each. (of course ignoring dependencies and tmp folders)
You can find it here: https://gist.github.com/givanse/8c69f55f8243733702cf7bcb0e9290a9
This command can give you a list of files that needs to be added, edited or removed:
p4 status -aed ...
you can use them separately too
p4 status -a ...
p4 status -e ...
p4 status -d ...
In P4V, under the "View" menu item choose "Files in Folder" which brings up a new tab in the right pane.
To the far right of the tabs there is a little icon that brings up a window called "Files in Folder" with 2 icons.
Select the left icon that looks like a funnel and you will see several options. Choose "Show items not in Depot" and all the files in the folder will show up.
Then just right-click on the file you want to add and choose "Mark for Add...". You can verify it is there in the "Pending" tab.
Just submit as normal (Ctrl+S).