Skip to content

Commit 8c635d0

Browse files
committed
2025.2 Code Drop
1 parent 5712c01 commit 8c635d0

29 files changed

+1229
-240
lines changed

LICENSE.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ commons-io-2.17.0.jar
6767
LicenseText: License Text Under Appendix
6868

6969
Copyrights:
70-
Copyright: Copyright 2002-2024 The Apache Software Foundation
71-
Reference: https://index.whitesourcesoftware.com/gri/app/reader/resource/content/asString/57a467f1-c18e-4293-807f-683b2ac78980
72-
Author: The Apache Software Foundation
73-
7470
Copyright: Copyright The Apache Software Foundation
7571
Reference: https://commons.apache.org/proper/commons-io/
7672

@@ -81,10 +77,6 @@ commons-lang3-3.12.0.jar
8177
LicenseText: License Text Under Appendix
8278

8379
Copyrights:
84-
Copyright: Copyright 2001-2021 The Apache Software Foundation
85-
Reference: https://index.whitesourcesoftware.com/gri/app/reader/resource/content/asString/11239b3a-f2b6-4016-bd0c-c0ce1d0fa09e
86-
Author: The Apache Software Foundation
87-
8880
Copyright: Copyright The Apache Software Foundation
8981
Reference: https://commons.apache.org/proper/commons-lang/
9082

RELEASE.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Release Notes for
22
P4Java, P4 API for Java
33

4-
Version 2025.1
4+
Version 2025.2
55

66
Introduction
77

@@ -33,7 +33,7 @@ Important Product Rebrand Notice
3333

3434
Requirements
3535

36-
* This release of P4Java supports the 2025.1 P4 Server. Older releases
36+
* This release of P4Java supports the 2025.2 P4 Server. Older releases
3737
might work but are not supported.
3838

3939
* Java: full standard JDK 11 or later. Implementation as
@@ -137,6 +137,21 @@ Known Limitations
137137
138138
* P4Java would not support file operations on altsync enabled clients.
139139

140+
-------------------------------------------
141+
Updates in 2025.2 (2025.2/2872146) (2025/12/18)
142+
143+
#2860533 (Job #129866)
144+
Add support for new LimitView field in p4 client spec.
145+
146+
#2860878 (Job #129860)
147+
Add support for '-m' option with "p4 key" command.
148+
149+
#2860121 (Job #121997)
150+
Add retries option for commands if the network times out.
151+
152+
#2867620 (Job #127869)
153+
Added support for client progress callback.
154+
140155
-------------------------------------------
141156
Updates in 2025.1 (2025.1/2785811) (2025/06/24)
142157

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
package com.perforce.p4java.client;
2+
3+
import com.perforce.p4java.server.callback.progress.ProgressUnit;
4+
5+
/**
6+
* Base implementation of IProgressReport with state tracking.
7+
* Uses boolean flags instead of bitwise operations.
8+
* Corresponds to ProgressReport class in C++.
9+
*/
10+
public abstract class BaseProgressReport implements IProgressReport {
11+
12+
// ========== Boolean Change Flags ==========
13+
protected boolean descriptionChanged;
14+
protected boolean unitsChanged;
15+
protected boolean totalChanged;
16+
protected boolean positionChanged;
17+
protected boolean isNewProgress;
18+
19+
20+
// ========== Instance Variables ==========
21+
protected String description;
22+
protected ProgressUnit units;
23+
protected long total;
24+
25+
protected long position;
26+
protected boolean needFinal;
27+
protected long lastUpdateTime;
28+
29+
30+
public BaseProgressReport() {
31+
this.descriptionChanged = false;
32+
this.unitsChanged = false;
33+
this.totalChanged = false;
34+
this.positionChanged = false;
35+
this.isNewProgress = true;
36+
this.description = "";
37+
this.units = ProgressUnit.UNSPECIFIED;
38+
this.total = 0;
39+
this.position = 0;
40+
this.needFinal = false;
41+
this.lastUpdateTime = System.currentTimeMillis();
42+
}
43+
44+
45+
// ========== Interface Implementation ==========
46+
47+
@Override
48+
public void description(String description) {
49+
this.description = description;
50+
this.descriptionChanged = true;
51+
}
52+
53+
@Override
54+
public void units(ProgressUnit units) {
55+
this.units = units;
56+
this.unitsChanged = true;
57+
}
58+
59+
@Override
60+
public void total(long total) {
61+
this.total = total;
62+
this.totalChanged = true;
63+
}
64+
65+
@Override
66+
public void position(long position) {
67+
position(position, CPP_NORMAL);
68+
}
69+
70+
@Override
71+
public void position(long position, int flag) {
72+
if (this.position != position) {
73+
this.position = position;
74+
this.positionChanged = true;
75+
}
76+
considerReport(flag);
77+
}
78+
79+
@Override
80+
public void increment() {
81+
increment(1, CPP_NORMAL);
82+
}
83+
84+
@Override
85+
public void increment(long amount) {
86+
increment(amount, CPP_NORMAL);
87+
}
88+
89+
@Override
90+
public void increment(long amount, int flag) {
91+
if (amount != 0) {
92+
this.position += amount;
93+
this.positionChanged = true;
94+
}
95+
considerReport(flag);
96+
}
97+
98+
@Override
99+
public long getPosition() {
100+
return position;
101+
}
102+
103+
@Override
104+
public long getTotal() {
105+
return total;
106+
}
107+
108+
@Override
109+
public String getDescription() {
110+
return description;
111+
}
112+
113+
@Override
114+
public ProgressUnit getUnits() {
115+
return units;
116+
}
117+
118+
119+
protected void considerReport(int flag) {
120+
121+
/* if (flag == CPP_NORMAL) {
122+
long now = System.currentTimeMillis();
123+
long elapsed = now - lastUpdateTime;
124+
if (elapsed < 1) {
125+
lastUpdateTime = System.currentTimeMillis();
126+
return;
127+
}
128+
}*/
129+
doReport(flag);
130+
}
131+
132+
protected void clearChangeFlags() {
133+
descriptionChanged = false;
134+
unitsChanged = false;
135+
totalChanged = false;
136+
positionChanged = false;
137+
isNewProgress = false;
138+
}
139+
140+
protected abstract void doReport(int flag);
141+
142+
143+
@Override
144+
protected void finalize() throws Throwable {
145+
try {
146+
if (needFinal) {
147+
doReport(CPP_FAILDONE);
148+
}
149+
} finally {
150+
super.finalize();
151+
}
152+
}
153+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package com.perforce.p4java.client;
2+
3+
import com.perforce.p4java.server.callback.progress.IProgress;
4+
5+
6+
public class ClientProgressReport extends BaseProgressReport {
7+
8+
9+
protected IProgress cp;
10+
11+
public ClientProgressReport(IProgress cp) {
12+
super();
13+
if (cp == null) {
14+
throw new IllegalArgumentException("ClientProgress cannot be null");
15+
}
16+
this.cp = cp;
17+
}
18+
19+
20+
@Override
21+
public void doReport(int flag) {
22+
if (cp == null) {
23+
return;
24+
}
25+
26+
if (descriptionChanged || unitsChanged) {
27+
cp.description(description, units);
28+
}
29+
30+
31+
if (totalChanged) {
32+
cp.total(total);
33+
}
34+
35+
36+
if (positionChanged) {
37+
cp.update(position);
38+
}
39+
40+
41+
clearChangeFlags();
42+
43+
44+
if (flag == CPP_DONE || flag == CPP_FAILDONE) {
45+
if (flag == CPP_FAILDONE)
46+
cp.done(1);
47+
else
48+
cp.done(0);
49+
needFinal = false;
50+
}
51+
}
52+
53+
54+
public IProgress getClientProgress() {
55+
return cp;
56+
}
57+
58+
public void close() {
59+
if (needFinal) {
60+
doReport(CPP_FAILDONE);
61+
}
62+
}
63+
64+
@Override
65+
public boolean isComplete() {
66+
return total > 0 && position == total;
67+
}
68+
69+
@Override
70+
protected void finalize() throws Throwable {
71+
try {
72+
if (needFinal) {
73+
doReport(CPP_FAILDONE);
74+
}
75+
76+
} finally {
77+
super.finalize();
78+
}
79+
}
80+
}

src/main/java/com/perforce/p4java/client/IClient.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,21 @@ public interface IClient extends IClientSummary, IWhereDelegator {
9393
*/
9494
void setChangeView(ArrayList<String> changeView);
9595

96+
/**
97+
* Get the Perforce limit view associated with this client, if any.
98+
*
99+
* @return the Perforce limit view associated with this client, if any;
100+
* null otherwise.
101+
* */
102+
ArrayList<String> getLimitView();
103+
104+
/**
105+
* Set the Perforce limit view associated with this client.
106+
*
107+
* @param limitView new List of limit views for the client.
108+
*/
109+
void setLimitView(ArrayList<String> limitView);
110+
96111
/**
97112
* Return the IServer object representing the Perforce server associated with this
98113
* Perforce client.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.perforce.p4java.client;
2+
3+
import com.perforce.p4java.server.callback.progress.ProgressUnit;
4+
5+
public interface IProgressReport {
6+
int CPP_NORMAL = 0;
7+
int CPP_DONE = 1;
8+
int CPP_FAILDONE = 2;
9+
int CPP_FLUSH = 3;
10+
11+
void description(String description);
12+
13+
void units(ProgressUnit units);
14+
15+
void total(long total);
16+
17+
void position(long position);
18+
19+
void position(long position, int flag);
20+
21+
void increment();
22+
23+
void increment(long amount);
24+
25+
void increment(long amount, int flag);
26+
27+
long getPosition();
28+
29+
long getTotal();
30+
31+
String getDescription();
32+
33+
ProgressUnit getUnits();
34+
35+
boolean isComplete();
36+
}

src/main/java/com/perforce/p4java/impl/generic/core/InputMapper.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,17 @@ public static Map<String, Object> map(IClient client) {
196196
}
197197
}
198198

199+
ArrayList<String> limitView = client.getLimitView();
200+
if (limitView != null && !limitView.isEmpty()) {
201+
int i = 0;
202+
203+
for (String changeEntry : limitView) {
204+
if (changeEntry != null) {
205+
clientMap.put("LimitView" + i++, changeEntry);
206+
}
207+
}
208+
}
209+
199210
if (opts != null) {
200211
String optStr = ""
201212
+ (opts.isAllWrite() ? "allwrite " : "noallwrite ")

src/main/java/com/perforce/p4java/impl/mapbased/MapKeys.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ public class MapKeys {
143143
public static final String VIEW_DEPOT_TYPE = "ViewDepotType";
144144

145145
public static final String CHANGE_VIEW_KEY = "ChangeView";
146+
public static final String LIMIT_VIEW_KEY = "LimitView";
146147
public static final String CLIENT_BACKUP_KEY = "Backup";
147148

148149
public static final String FIELDS_KEY = "Fields";

0 commit comments

Comments
 (0)