Click or drag to resize

RepositoryDeleteCounter Method

Delete a Perforce counter from the repository.

Namespace:  Perforce.P4
Assembly:  p4api.net (in p4api.net.dll) Version: 2023.2.258.5793
Syntax
public Object DeleteCounter(
	string name,
	Options options
)

Parameters

name
Type: SystemString
options
Type: Perforce.P4Options

Return Value

Type: Object
Remarks

p4 help counter

counter -- Display, set, or delete a counter

p4 counter name
p4 counter [-f] name value
p4 counter [-f] -d name
p4 counter [-f] -i name
p4 counter [-f] -m [ pair list ]

The first form displays the value of the specified counter.

The second form sets the counter to the specified value.

The third form deletes the counter. This option usually has the
same effect as setting the counter to 0.

The -f flag sets or deletes counters used by Perforce, which are
listed by 'p4 help counters'. Important: Never set the 'change'
counter to a value that is lower than its current value.

The -i flag increments a counter by 1 and returns the new value.
This option is used instead of a value argument and can only be
used with numeric counters.

The fifth form allows multiple operations in one command.
With this, the list is pairs of arguments. Each pair is either
counter value or '-' counter. To set a counter use a name and value.
To delete a counter use a '-' followed by the name.

Counters can be assigned textual values as well as numeric ones,
despite the name 'counter'.

'p4 counter' requires 'review' access granted by 'p4 protect'.
The -f flag requires that the user be an operator or have 'super'
access.

Examples
To delete a counter named test:
Counter target = Repository.DeleteCounter("test", null);
To delete a counter named build using -f with a user with super access:
Options opts = new Options();
opts["-f"] = null;
Counter target = Repository.DeleteCounter("build", opts);
See Also