Perforce auto resolve always accept target - perforce

I remember that there was a setting, which would always automatically resolve and accept targe without user interaction. However I forgot if this was a server option or a client and not sure how to set it.

Add -ay to the resolve command to accept the target ("yours").
See p4 help resolve:
The -ay flag resolves all files by accepting yours and ignoring
theirs. It preserves the content of workspace files.

Related

(NLog) When to call ReconfigExistingLoggers?

What types of changes require a call to ReconfigExistingLoggers?
In my particular use case, I load everything from a config file and then:
Delete a Target
Delete a rule that would have logged to the target
This seems to work without me calling ReconfigExistingLoggers, but I wanted to be sure I wasn't missing anything.
Additionally, I'm considering a refactor that would use a variable. This means I would have a Target that uses a variable and a single rule that logs to that Target. At runtime, I would set/update that variable.
Does that require a call to ReconfigExistingLoggers?
My specific use case is around the Syslog target:
When my software starts up, it needs to decide whether to log to SyslogServerA or SyslogServerB. My current approach is:
Configure both servers in my Config file
Configure rules to log to both servers in my Config file
At startup, determine the server I should log to
Remove the Target and Rule for the other one
I can think of several ways to achieve my end goal of only logging to a single syslog server, but I'm not sure which way is best.
For what it's worth: If I have both Targets and both Rules active, I have a runaway memory problem that builds over time. This is why I'm actively disabling an unused UDP Syslog target.
The LogManager.ReconfigExistingLoggers() should be explicitly called after having added/updated/removed LoggingRules (Like a commit-operation). It will refresh the configuration of all active Logger-objects. It will also perform synchronous initialization of any new NLog targets, so when the call has completed then all changes has been applied.
NLog has the following method to remove existing target from a configuration:
LoggingConfiguration.RemoveTarget - It will automatically call ReconfigExistingLoggers (Along with removing LoggingRules that becomes empty)
NLog supports changes of LoggingConfiguration while application is running (Ex. adding removing LoggingRules and Targets). But it is recommended to register all NLog targets upfront, and then use semi-dynamic-filtering to enable/disable output to the relevant NLog targets (Notice minLevel="Off" means disable output to target)

How to "unsync" files from perforce client?

I have files in my perforce client which I no longer need.
Is there a way to remove the files from my client to free up the space?
I don't want to delete the client and create a new one.
Thanks in advance.
You can sync to any revision, including #none. To temporarily remove a directory (e.g. the current directory, ...) from your client just do:
p4 sync ...#none
If you want to more permanently remove the directory from your client (so it won't come back even if you re-sync your entire workspace), remove it from your client's View:
View:
//depot/... //my-client/...
-//depot/some_directory/... //my-client/some_directory/...

SVN export leads to E020024: Error resolving case

I've been having a very weird error using svn export. Calling this command from within a powershell script:
svn export svnFilePath \\abcd.aa.bb\aaa_b_c6$\abcdef\Abcdef\abcdef
which leads to
svn: E020024: Error resolving case of \\abcd.aa.bb\aaa_b_c6$\abcdef\Abcdef\abcdef
Now i've tried reversing the slashes like this
svn export svnFilePath //abcd.aa.bb/aaa_b_c6$/abcdef/Abcdef/abcdef
or using single quotation and double quotation marks but the end result is the same. I believe it has something to do with the server \\abcd.aa.bb\ because the same command works if it's used on another server \\xyz.aa.bb\. I don't have access to these Servers, as they're managed by someone else, to check for any differences unfortunately. Is there any way to fix this problem?
There is a chance that the error svn: E020024: Error resolving case of indicates that the network share is inaccessible by the user account under which you run svn export. I suggest double-checking access permissions configured on the network share and the UNC path you enter.

Having trouble deleting client

I'm getting this error while trying to delete a client named 'test':
Client 'test' has files opened. To delete the client, revert any opened files and delete any pending changes first. An administrator may specify -f to force the delete of another user's client.
I try p4 opened and it shows:
//TestRepo/test/TestA.java#1 - edit default change (ktext)
//TestRepo/test/TestB.java#1 - edit default change (ktext)
How do I delete these files so that I'm able to delete the client?
Run p4 revert //TestRepo/test/TestA.java //TestRepo/test/TestB.java from within the client first.

How to set defaults for perforce client specs

I'm trying to discover how to change the default set of Client Spec options and submit-options.
set P4CLIENT=my_new_client_1
p4 client
Gives me the following spec default-spec:
Client: my_new_client_1
...
Options: noallwrite noclobber nocompress unlocked nomodtime normdir
SubmitOptions: submitunchanged
...
Now on my machine i want to always use revertunchanged, rmdir for example, but it seems like I need remember to manually set this everytime I create a new client.
Is there any way to achieve this? p4 set seems to only affect the things that can be set by environment variables.
You can't change the default client spec template (unless you're the Perforce system administrator) but you can set up and use your own template. You would first create a dummy client with a client spec that has the values that you want:
Client: my_template_client
...
Options: noallwrite noclobber nocompress unlocked nomodtime rmdir
SubmitOptions: revertunchanged
...
Then you just specify that the dummy client should be used as a template when creating new clients:
p4 client -t my_template_client my_new_client_1
The first response here was incorrect:
You CAN create a default clientspec in Perforce using triggers.
Essentially, you create a script that runs on the server and runs whenever someone does a form-out on the form client. This script would have to check to see if the clientspec already exists, and then substitute a sensible "default" if it doesn't (if it's a new clientspec).
Note that this works fine and well, and it's even in the P4 SysAdmin Guide (the exact example you're looking for is there!) but it can be a bit difficult to debug, as triggers run on the SERVER, not on the client!
Manual:
http://www.perforce.com/perforce/r10.1/manuals/p4sag/06_scripting.html
Specific Case Example:
http://www.perforce.com/perforce/r10.1/manuals/p4sag/06_scripting.html#1057213
The Perforce Server Deployment Package (SDP), a reference implementation with best practices for operating a Perforce Helix Core server, includes sample triggers for exactly this purpose. See:
SetWsOptions.py - https://swarm.workshop.perforce.com/projects/perforce-software-sdp/files/main/Server/Unix/p4/common/bin/triggers/SetWsOptions.py
SetWsOptionsAndView.py - https://swarm.workshop.perforce.com/projects/perforce-software-sdp/files/main/Server/Unix/p4/common/bin/triggers/SetWsOptionsAndView.py
Using the p4 client -t <template_client> is useful and is something a regular user can do, and has a P4V (graphical user interface) equivalent as well. Only Perforce super users can mess with triggers.
There is one other trick for a super user to be aware of: They can designate a client spec to be used as a default if the user doesn't specify one with -t <template_client>. That can be done by setting the configurable template.client. See: https://www.perforce.com/manuals/cmdref/Content/CmdRef/configurables.configurables.html#template.client
One other suggestion: I suggest changing the default from submitunchanged to leaveunchanged rather than revertunchanged (as in the sample triggers above). Using leaveunchanged is better because, if you still want the file checked out, using leaveunchanged rather than revertunchanged saves you from having to navigate to the file to check it out again. It's a small thing, but optimal to go with leaveunchanged. If you do want to revert the unmodified file, it's slightly easier to revert than to checkout again, which might require more navigating or typing.

Resources