Skip to content

Commit cc9ca87

Browse files
Merge pull request #1428 from salesforcecli/sl/W-18681384
Add a warning in PDR-W-18681384
2 parents 21440ad + c703dd9 commit cc9ca87

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

messages/deploy.metadata.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,8 @@ The `pushPackageDirectoriesSequentially` property is not respected by this comma
257257
# apiVersionMsgDetailed
258258

259259
%s %s metadata to %s using the v%s %s API.
260+
261+
# noSourceTrackingWarning
262+
263+
Starting in December 2025, this command will require that the target org use source tracking.
264+
Specifically, to use this command with a production org, scratch org created with the `--no-track-source` flag, or other non-source-tracking org, you must specify the metadata you want to deploy with either the `--metadata`, `--source-dir`, or `--manifest` flag.

messages/retrieve.start.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,8 @@ This command expects the org to support source tracking. If it doesn't, you must
199199
- Use the `--source-dir`, `--manifest` or `--package-name` flags to retrieve metadata in source format.
200200

201201
- Use the `--target-metadata-dir` flag to retrieve metadata in metadata format to a directory.
202+
203+
# noSourceTrackingWarning
204+
205+
Starting in December 2025, this command will require that the target org use source tracking.
206+
Specifically, to use this command with a production org, scratch org created with the `--no-track-source` flag, or other non-source-tracking org, you must specify the metadata you want to retrieve with either the `--metadata`, `--source-dir`, or `--manifest` flag.

src/commands/project/deploy/start.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
199199
throw messages.createError('error.NoTestsSpecified');
200200
}
201201

202+
const noDeployFlags = !flags['source-dir'] && !flags.manifest && !flags.metadata && !flags['metadata-dir'];
203+
204+
if (noDeployFlags && !(await flags['target-org'].tracksSource())) {
205+
this.warn(messages.getMessage('noSourceTrackingWarning'));
206+
}
207+
202208
const api = await resolveApi(this.configAggregator);
203209
const username = flags['target-org'].getUsername();
204210
const title = flags['dry-run'] ? 'Deploying Metadata (dry-run)' : 'Deploying Metadata';

src/commands/project/retrieve/start.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,19 @@ export default class RetrieveMetadata extends SfCommand<RetrieveResultJson> {
176176
// eslint-disable-next-line complexity
177177
public async run(): Promise<RetrieveResultJson> {
178178
const { flags } = await this.parse(RetrieveMetadata);
179+
180+
// Add warning for non-source-tracking orgs when using default behavior
181+
const isChanges =
182+
!flags['source-dir'] &&
183+
!flags['manifest'] &&
184+
!flags['metadata'] &&
185+
!flags['target-metadata-dir'] &&
186+
!flags['package-name']?.length;
187+
188+
if (isChanges && !(await flags['target-org'].tracksSource())) {
189+
this.warn(messages.getMessage('noSourceTrackingWarning'));
190+
}
191+
179192
let resolvedTargetDir: string | undefined;
180193
if (flags['output-dir']) {
181194
resolvedTargetDir = resolve(flags['output-dir']);
@@ -518,6 +531,7 @@ const buildRetrieveOptions = async (
518531
output: string | undefined
519532
): Promise<RetrieveSetOptions> => {
520533
const apiVersion = await resolveApiVersion(flags);
534+
521535
return {
522536
usernameOrConnection: flags['target-org'].getUsername() ?? flags['target-org'].getConnection(flags['api-version']),
523537
merge: true,

test/nuts/retrieve/noTracking.nut.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ describe('retrieve mdapi format without project', () => {
4949
expect(result?.files).to.not.be.empty;
5050
});
5151

52+
it('should fail when retrieving changes from a non-tracking org', () => {
53+
const result = execCmd<RetrieveResultJson>(`project:retrieve:start -o ${session.hubOrg.username} --json`, {
54+
ensureExitCode: 1,
55+
});
56+
57+
expect(result.jsonOutput?.name).to.equal('noSourceTracking');
58+
expect(result.jsonOutput?.message).to.include('Unable to track changes in your source files');
59+
});
60+
5261
after(async () => {
5362
await session?.clean();
5463
});

0 commit comments

Comments
 (0)