001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.maven.scm.provider;
020
021import java.io.File;
022import java.util.Date;
023import java.util.List;
024
025import org.apache.maven.scm.CommandParameters;
026import org.apache.maven.scm.ScmBranch;
027import org.apache.maven.scm.ScmBranchParameters;
028import org.apache.maven.scm.ScmException;
029import org.apache.maven.scm.ScmFileSet;
030import org.apache.maven.scm.ScmTagParameters;
031import org.apache.maven.scm.ScmVersion;
032import org.apache.maven.scm.command.add.AddScmResult;
033import org.apache.maven.scm.command.blame.BlameScmRequest;
034import org.apache.maven.scm.command.blame.BlameScmResult;
035import org.apache.maven.scm.command.branch.BranchScmResult;
036import org.apache.maven.scm.command.changelog.ChangeLogScmRequest;
037import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
038import org.apache.maven.scm.command.checkin.CheckInScmResult;
039import org.apache.maven.scm.command.checkout.CheckOutScmResult;
040import org.apache.maven.scm.command.diff.DiffScmResult;
041import org.apache.maven.scm.command.edit.EditScmResult;
042import org.apache.maven.scm.command.export.ExportScmResult;
043import org.apache.maven.scm.command.info.InfoScmResult;
044import org.apache.maven.scm.command.list.ListScmResult;
045import org.apache.maven.scm.command.mkdir.MkdirScmResult;
046import org.apache.maven.scm.command.remoteinfo.RemoteInfoScmResult;
047import org.apache.maven.scm.command.remove.RemoveScmResult;
048import org.apache.maven.scm.command.status.StatusScmResult;
049import org.apache.maven.scm.command.tag.TagScmResult;
050import org.apache.maven.scm.command.unedit.UnEditScmResult;
051import org.apache.maven.scm.command.untag.UntagScmResult;
052import org.apache.maven.scm.command.update.UpdateScmResult;
053import org.apache.maven.scm.repository.ScmRepository;
054import org.apache.maven.scm.repository.ScmRepositoryException;
055import org.apache.maven.scm.repository.UnknownRepositoryStructure;
056
057/**
058 * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
059 *
060 */
061public interface ScmProvider {
062    String getScmType();
063
064    boolean requiresEditMode();
065
066    ScmProviderRepository makeProviderScmRepository(String scmSpecificUrl, char delimiter)
067            throws ScmRepositoryException;
068
069    ScmProviderRepository makeProviderScmRepository(File path)
070            throws ScmRepositoryException, UnknownRepositoryStructure;
071
072    /**
073     * Sets the interactive mode, which by default (i.e. if not called) is assumed to be {@code true} by providers.
074     * As providers are usually singletons, this affects every usage of this provider.
075     *
076     * @param interactive either {@code true} in case user may be prompted for information, otherwise {@code false}. The default is {@code true}.
077     * @since 2.0.0-M2
078     */
079    default void setInteractive(boolean interactive) {}
080
081    /**
082     * Validate the scm url.
083     *
084     * @param scmSpecificUrl The SCM url
085     * @param delimiter      The delimiter used in the SCM url
086     * @return Returns a list of messages if the validation failed
087     */
088    List<String> validateScmUrl(String scmSpecificUrl, char delimiter);
089
090    /**
091     * Returns the scm reserved file name where the SCM stores information like '.git', '.svn'.
092     *
093     * @return the scm reserved file name
094     */
095    String getScmSpecificFilename();
096
097    /**
098     * Check if this tag is valid for this SCM provider.
099     *
100     * @param tag tag name to check
101     * @return true if tag is valid
102     */
103    boolean validateTagName(String tag);
104
105    /**
106     * Given a tag name, make it suitable for this SCM provider.
107     *
108     * @param tag input tag name
109     * @return sanitized tag name
110     */
111    String sanitizeTagName(String tag);
112
113    /**
114     * Adds the given files to the source control system
115     *
116     * @param repository the source control system
117     * @param fileSet    the files to be added
118     * @return an {@link AddScmResult} that contains the files that have been added
119     * @throws ScmException if any
120     */
121    AddScmResult add(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
122
123    /**
124     * Adds the given files to the source control system
125     *
126     * @param repository the source control system
127     * @param fileSet    the files to be added
128     * @param message    a string that is a comment on the new added file
129     * @return an {@link AddScmResult} that contains the files that have been added
130     * @throws ScmException if any
131     */
132    AddScmResult add(ScmRepository repository, ScmFileSet fileSet, String message) throws ScmException;
133
134    /**
135     * Adds the given files to the source control system
136     *
137     * @param repository        the source control system
138     * @param fileSet           the files to be added
139     * @param commandParameters {@link CommandParameters}
140     * @return an {@link AddScmResult} that contains the files that have been added
141     * @throws ScmException if any
142     */
143    AddScmResult add(ScmRepository repository, ScmFileSet fileSet, CommandParameters commandParameters)
144            throws ScmException;
145
146    /**
147     * Branch (or label in some systems) will create a branch of the source file with a certain branch name
148     *
149     * @param repository the source control system
150     * @param fileSet    the files to branch. Implementations can also give the changes
151     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
152     * @param branchName the branch name to apply to the files
153     * @return TODO
154     * @throws ScmException if any
155     * @deprecated use {@link #branch(ScmRepository, ScmFileSet, String, ScmBranchParameters)}
156     */
157    BranchScmResult branch(ScmRepository repository, ScmFileSet fileSet, String branchName) throws ScmException;
158
159    /**
160     * Branch (or label in some systems) will create a branch of the source file with a certain branch name
161     *
162     * @param repository the source control system
163     * @param fileSet    the files to branch. Implementations can also give the changes
164     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
165     * @param branchName the branch name to apply to the files
166     * @param message    the commit message used for the tag creation
167     * @return TODO
168     * @throws ScmException if any
169     * @deprecated use {@link #branch(ScmRepository, ScmFileSet, String, ScmBranchParameters)}
170     */
171    BranchScmResult branch(ScmRepository repository, ScmFileSet fileSet, String branchName, String message)
172            throws ScmException;
173
174    /**
175     * Branch (or label in some systems) will create a branch of the source file with a certain
176     * branch name
177     *
178     * @param repository the source control system
179     * @param fileSet    the files to branch. Implementations can also give the changes from the
180     *                   {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
181     * @param branchName the branch name to apply to the files
182     * @param scmBranchParameters TODO
183     * @return TODO
184     * @throws ScmException if any
185     * @since 1.3
186     */
187    BranchScmResult branch(
188            ScmRepository repository, ScmFileSet fileSet, String branchName, ScmBranchParameters scmBranchParameters)
189            throws ScmException;
190
191    /**
192     * Returns the changes that have happened in the source control system in a certain period of time.
193     * This can be adding, removing, updating, ... of files
194     *
195     * @param repository the source control system
196     * @param fileSet    the files to know the changes about. Implementations can also give the changes
197     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
198     * @param startDate  the start date of the period
199     * @param endDate    the end date of the period
200     * @param numDays    the number days before the current time if startdate and enddate are null
201     * @param branch     the branch/tag name
202     * @return The SCM result of the changelog command
203     * @throws ScmException if any
204     * @deprecated you must use {@link ScmProvider#changeLog(org.apache.maven.scm.repository.ScmRepository,
205     *             org.apache.maven.scm.ScmFileSet, java.util.Date, java.util.Date, int,
206     *             org.apache.maven.scm.ScmBranch)}
207     */
208    ChangeLogScmResult changeLog(
209            ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate, int numDays, String branch)
210            throws ScmException;
211
212    /**
213     * Returns the changes that have happened in the source control system in a certain period of time.
214     * This can be adding, removing, updating, ... of files
215     *
216     * @param repository the source control system
217     * @param fileSet    the files to know the changes about. Implementations can also give the changes
218     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
219     * @param startDate  the start date of the period
220     * @param endDate    the end date of the period
221     * @param numDays    the number days before the current time if startdate and enddate are null
222     * @param branch     the branch/tag
223     * @return The SCM result of the changelog command
224     * @throws ScmException if any
225     * @deprecated use {@link #changeLog(org.apache.maven.scm.command.changelog.ChangeLogScmRequest)} instead
226     */
227    @Deprecated
228    ChangeLogScmResult changeLog(
229            ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate, int numDays, ScmBranch branch)
230            throws ScmException;
231
232    /**
233     * Returns the changes that have happened in the source control system in a certain period of time.
234     * This can be adding, removing, updating, ... of files
235     *
236     * @param repository  the source control system
237     * @param fileSet     the files to know the changes about. Implementations can also give the changes
238     *                    from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
239     * @param startDate   the start date of the period
240     * @param endDate     the end date of the period
241     * @param numDays     the number days before the current time if startdate and enddate are null
242     * @param branch      the branch/tag name
243     * @param datePattern the date pattern use in changelog output returned by scm tool
244     * @return The SCM result of the changelog command
245     * @throws ScmException if any
246     * @deprecated use {@link #changeLog(org.apache.maven.scm.command.changelog.ChangeLogScmRequest)} instead
247     */
248    @Deprecated
249    ChangeLogScmResult changeLog(
250            ScmRepository repository,
251            ScmFileSet fileSet,
252            Date startDate,
253            Date endDate,
254            int numDays,
255            String branch,
256            String datePattern)
257            throws ScmException;
258
259    /**
260     * Returns the changes that have happened in the source control system in a certain period of time.
261     * This can be adding, removing, updating, ... of files
262     *
263     * @param repository  the source control system
264     * @param fileSet     the files to know the changes about. Implementations can also give the changes
265     *                    from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
266     * @param startDate   the start date of the period
267     * @param endDate     the end date of the period
268     * @param numDays     the number days before the current time if startDate and endDate are null
269     * @param branch      the branch/tag
270     * @param datePattern the date pattern use in changelog output returned by scm tool
271     * @return The SCM result of the changelog command
272     * @throws ScmException if any
273     * @deprecated use {@link #changeLog(org.apache.maven.scm.command.changelog.ChangeLogScmRequest)} instead
274     */
275    ChangeLogScmResult changeLog(
276            ScmRepository repository,
277            ScmFileSet fileSet,
278            Date startDate,
279            Date endDate,
280            int numDays,
281            ScmBranch branch,
282            String datePattern)
283            throws ScmException;
284
285    /**
286     * Returns the changes that have happened in the source control system in a certain period of time.
287     * This can be adding, removing, updating, ... of files
288     *
289     * @param scmRequest request wrapping detailed parameters for the changelog command
290     * @return The SCM result of the changelog command
291     * @throws ScmException if any
292     * @since 1.8
293     */
294    ChangeLogScmResult changeLog(ChangeLogScmRequest scmRequest) throws ScmException;
295
296    /**
297     * Returns the changes that have happened in the source control system between two tags.
298     * This can be adding, removing, updating, ... of files
299     *
300     * @param repository the source control system
301     * @param fileSet    the files to know the changes about. Implementations can also give the changes
302     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
303     * @param startTag   the start tag
304     * @param endTag     the end tag
305     * @return The SCM result of the changelog command
306     * @throws ScmException if any
307     * @deprecated use {@link #changeLog(org.apache.maven.scm.command.changelog.ChangeLogScmRequest)} instead
308     */
309    @Deprecated
310    ChangeLogScmResult changeLog(ScmRepository repository, ScmFileSet fileSet, String startTag, String endTag)
311            throws ScmException;
312
313    /**
314     * Returns the changes that have happened in the source control system between two tags.
315     * This can be adding, removing, updating, ... of files
316     *
317     * @param repository   the source control system
318     * @param fileSet      the files to know the changes about. Implementations can also give the changes
319     *                     from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
320     * @param startVersion the start branch/tag/revision
321     * @param endVersion   the end branch/tag/revision
322     * @return The SCM result of the changelog command
323     * @throws ScmException if any
324     * @deprecated use {@link #changeLog(org.apache.maven.scm.command.changelog.ChangeLogScmRequest)} instead
325     */
326    @Deprecated
327    ChangeLogScmResult changeLog(
328            ScmRepository repository, ScmFileSet fileSet, ScmVersion startVersion, ScmVersion endVersion)
329            throws ScmException;
330
331    /**
332     * Returns the changes that have happened in the source control system between two tags.
333     * This can be adding, removing, updating, ... of files
334     *
335     * @param repository  the source control system
336     * @param fileSet     the files to know the changes about. Implementations can also give the changes
337     *                    from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
338     * @param startTag    the start tag
339     * @param endTag      the end tag
340     * @param datePattern the date pattern use in changelog output returned by scm tool
341     * @return TODO
342     * @throws ScmException if any
343     * @deprecated use {@link #changeLog(org.apache.maven.scm.command.changelog.ChangeLogScmRequest)} instead
344     */
345    @Deprecated
346    ChangeLogScmResult changeLog(
347            ScmRepository repository, ScmFileSet fileSet, String startTag, String endTag, String datePattern)
348            throws ScmException;
349
350    /**
351     * Returns the changes that have happened in the source control system between two tags.
352     * This can be adding, removing, updating, ... of files
353     *
354     * @param repository    the source control system
355     * @param fileSet       the files to know the changes about. Implementations can also give the changes
356     *                      from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
357     * @param startRevision the start revision
358     * @param endRevision   the end revision
359     * @param datePattern   the date pattern use in changelog output returned by scm tool
360     * @return TODO
361     * @throws ScmException if any
362     * @deprecated use {@link #changeLog(org.apache.maven.scm.command.changelog.ChangeLogScmRequest)} instead
363     */
364    @Deprecated
365    ChangeLogScmResult changeLog(
366            ScmRepository repository,
367            ScmFileSet fileSet,
368            ScmVersion startRevision,
369            ScmVersion endRevision,
370            String datePattern)
371            throws ScmException;
372
373    /**
374     * Save the changes you have done into the repository. This will create a new version of the file or
375     * directory in the repository.
376     * <p>
377     * When the fileSet has no entries, the fileSet.getBaseDir() is recursively committed.
378     * When the fileSet has entries, the commit is non-recursive and only the elements in the fileSet
379     * are committed.
380     *
381     * @param repository the source control system
382     * @param fileSet    the files to check in (sometimes called commit)
383     * @param tag        tag or revision
384     * @param message    a string that is a comment on the changes that where done
385     * @return TODO
386     * @throws ScmException if any
387     * @deprecated you must use {@link ScmProvider#checkIn(org.apache.maven.scm.repository.ScmRepository,
388     *             org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion, String)}
389     */
390    CheckInScmResult checkIn(ScmRepository repository, ScmFileSet fileSet, String tag, String message)
391            throws ScmException;
392
393    /**
394     * Save the changes you have done into the repository. This will create a new version of the file or
395     * directory in the repository.
396     * <p>
397     * When the fileSet has no entries, the fileSet.getBaseDir() is recursively committed.
398     * When the fileSet has entries, the commit is non-recursive and only the elements in the fileSet
399     * are committed.
400     *
401     * @param repository the source control system
402     * @param fileSet    the files to check in (sometimes called commit)
403     * @param message    a string that is a comment on the changes that where done
404     * @return TODO
405     * @throws ScmException if any
406     */
407    CheckInScmResult checkIn(ScmRepository repository, ScmFileSet fileSet, String message) throws ScmException;
408
409    /**
410     * Save the changes you have done into the repository. This will create a new version of the file or
411     * directory in the repository.
412     * <p>
413     * When the fileSet has no entries, the fileSet.getBaseDir() is recursively committed.
414     * When the fileSet has entries, the commit is non-recursive and only the elements in the fileSet
415     * are committed.
416     *
417     * @param repository  the source control system
418     * @param fileSet     the files to check in (sometimes called commit)
419     * @param parameters  {@link CommandParameters}
420     * @return TODO
421     * @throws ScmException if any
422     */
423    CheckInScmResult checkIn(ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters)
424            throws ScmException;
425
426    /**
427     * Save the changes you have done into the repository. This will create a new version of the file or
428     * directory in the repository.
429     * <p>
430     * When the fileSet has no entries, the fileSet.getBaseDir() is recursively committed.
431     * When the fileSet has entries, the commit is non-recursive and only the elements in the fileSet
432     * are committed.
433     *
434     * @param repository the source control system
435     * @param fileSet    the files to check in (sometimes called commit)
436     * @param revision   branch/tag/revision
437     * @param message    a string that is a comment on the changes that where done
438     * @return TODO
439     * @throws ScmException if any
440     */
441    CheckInScmResult checkIn(ScmRepository repository, ScmFileSet fileSet, ScmVersion revision, String message)
442            throws ScmException;
443
444    /**
445     * Create a copy of the repository on your local machine
446     *
447     * @param repository the source control system
448     * @param fileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
449     * @param tag        get the version defined by the tag
450     * @return TODO
451     * @throws ScmException if any
452     * @deprecated you must use {@link ScmProvider#checkOut(org.apache.maven.scm.repository.ScmRepository,
453     *             org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion)}
454     */
455    CheckOutScmResult checkOut(ScmRepository repository, ScmFileSet fileSet, String tag) throws ScmException;
456
457    /**
458     * Create a copy of the repository on your local machine
459     *
460     * @param repository the source control system
461     * @param fileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
462     * @return TODO
463     * @throws ScmException if any
464     */
465    CheckOutScmResult checkOut(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
466
467    /**
468     * Create a copy of the repository on your local machine
469     *
470     * @param repository the source control system
471     * @param fileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
472     * @param version    get the version defined by the revision, branch or tag
473     * @return TODO
474     * @throws ScmException if any
475     */
476    CheckOutScmResult checkOut(ScmRepository repository, ScmFileSet fileSet, ScmVersion version) throws ScmException;
477
478    /**
479     * Create a copy of the repository on your local machine.
480     *
481     * @param scmRepository the source control system
482     * @param scmFileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
483     * @param tag           tag or revision
484     * @param recursive     whether to check out recursively
485     * @return TODO
486     * @throws ScmException if any
487     * @deprecated you must use {@link ScmProvider#checkOut(org.apache.maven.scm.repository.ScmRepository,
488     *             org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion, boolean)}
489     */
490    CheckOutScmResult checkOut(ScmRepository scmRepository, ScmFileSet scmFileSet, String tag, boolean recursive)
491            throws ScmException;
492
493    /**
494     * Create a copy of the repository on your local machine.
495     *
496     * @param scmRepository the source control system
497     * @param scmFileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
498     * @param recursive     whether to check out recursively
499     * @return TODO
500     * @throws ScmException if any
501     */
502    CheckOutScmResult checkOut(ScmRepository scmRepository, ScmFileSet scmFileSet, boolean recursive)
503            throws ScmException;
504
505    /**
506     * Create a copy of the repository on your local machine.
507     *
508     * @param scmRepository the source control system
509     * @param scmFileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
510     * @param version       get the version defined by the revision, branch or tag
511     * @param recursive     whether to check out recursively
512     * @return TODO
513     * @throws ScmException if any
514     */
515    CheckOutScmResult checkOut(
516            ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion version, boolean recursive)
517            throws ScmException;
518
519    /**
520     * Create a copy of the repository on your local machine.
521     *
522     * @param scmRepository     the source control system
523     * @param scmFileSet        the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()}
524     *                          location
525     * @param version           get the version defined by the revision, branch or tag
526     * @param commandParameters parameters
527     * @return TODO
528     * @throws ScmException if any
529     * @since 1.9.6
530     */
531    CheckOutScmResult checkOut(
532            ScmRepository scmRepository,
533            ScmFileSet scmFileSet,
534            ScmVersion version, //
535            CommandParameters commandParameters)
536            throws ScmException;
537
538    /**
539     * Create a diff between two branch/tag/revision.
540     *
541     * @param scmRepository the source control system
542     * @param scmFileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
543     * @param startRevision the start revision
544     * @param endRevision   the end revision
545     * @return TODO
546     * @throws ScmException if any
547     * @deprecated you must use {@link ScmProvider#diff(org.apache.maven.scm.repository.ScmRepository,
548     *             org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion, org.apache.maven.scm.ScmVersion)}
549     */
550    DiffScmResult diff(ScmRepository scmRepository, ScmFileSet scmFileSet, String startRevision, String endRevision)
551            throws ScmException;
552
553    /**
554     * Create a diff between two branch/tag/revision.
555     *
556     * @param scmRepository the source control system
557     * @param scmFileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
558     * @param startVersion  the start branch/tag/revision
559     * @param endVersion    the end branch/tag/revision
560     * @return TODO
561     * @throws ScmException if any
562     */
563    DiffScmResult diff(
564            ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion startVersion, ScmVersion endVersion)
565            throws ScmException;
566
567    /**
568     * Create an exported copy of the repository on your local machine
569     *
570     * @param repository the source control system
571     * @param fileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
572     * @param tag        get the version defined by the tag
573     * @return TODO
574     * @throws ScmException if any
575     * @deprecated you must use {@link ScmProvider#export(org.apache.maven.scm.repository.ScmRepository,
576     *             org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion)}
577     */
578    ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, String tag) throws ScmException;
579
580    /**
581     * Create an exported copy of the repository on your local machine
582     *
583     * @param repository the source control system
584     * @param fileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
585     * @return TODO
586     * @throws ScmException if any
587     */
588    ExportScmResult export(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
589
590    /**
591     * Create an exported copy of the repository on your local machine
592     *
593     * @param repository the source control system
594     * @param fileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
595     * @param version    get the version defined by the branch/tag/revision
596     * @return TODO
597     * @throws ScmException if any
598     */
599    ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, ScmVersion version) throws ScmException;
600
601    /**
602     * Create an exported copy of the repository on your local machine
603     *
604     * @param repository      the source control system
605     * @param fileSet         the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
606     * @param tag             get the version defined by the tag
607     * @param outputDirectory the directory where the export will be stored
608     * @return TODO
609     * @throws ScmException if any
610     * @deprecated you must use {@link ScmProvider#export(org.apache.maven.scm.repository.ScmRepository,
611     *             org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion, String)}
612     */
613    ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, String tag, String outputDirectory)
614            throws ScmException;
615
616    /**
617     * Create an exported copy of the repository on your local machine
618     *
619     * @param repository      the source control system
620     * @param fileSet         the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
621     * @param version         get the version defined by the branch/tag/revision
622     * @param outputDirectory the directory where the export will be stored
623     * @return TODO
624     * @throws ScmException if any
625     */
626    ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, String outputDirectory)
627            throws ScmException;
628
629    /**
630     * Removes the given files from the source control system
631     *
632     * @param repository the source control system
633     * @param fileSet    the files to be removed
634     * @param message TODO
635     * @return TODO
636     * @throws ScmException if any
637     */
638    RemoveScmResult remove(ScmRepository repository, ScmFileSet fileSet, String message) throws ScmException;
639
640    /**
641     * Returns the status of the files in the source control system. The state of each file can be one
642     * of the {@link org.apache.maven.scm.ScmFileStatus} flags.
643     *
644     * @param repository the source control system
645     * @param fileSet    the files to know the status about. Implementations can also give the changes
646     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
647     * @return TODO
648     * @throws ScmException if any
649     */
650    StatusScmResult status(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
651
652    /**
653     * Tag (or label in some systems) will tag the source file with a certain tag
654     *
655     * @param repository the source control system
656     * @param fileSet    the files to tag. Implementations can also give the changes
657     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
658     * @param tagName    the tag name to apply to the files
659     * @return TODO
660     * @throws ScmException if any
661     * @deprecated use {@link #tag(ScmRepository, ScmFileSet, String, ScmTagParameters)}
662     */
663    TagScmResult tag(ScmRepository repository, ScmFileSet fileSet, String tagName) throws ScmException;
664
665    /**
666     * Deletes a tag.
667     *
668     * @param repository the source control system
669     * @param fileSet    a fileset with the relevant working directory as basedir
670     * @param parameters TODO
671     * @return TODO
672     * @throws ScmException if any
673     */
674    UntagScmResult untag(ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters)
675            throws ScmException;
676
677    /**
678     * Tag (or label in some systems) will tag the source file with a certain tag
679     *
680     * @param repository the source control system
681     * @param fileSet    the files to tag. Implementations can also give the changes
682     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
683     * @param tagName    the tag name to apply to the files
684     * @param message    the commit message used for the tag creation
685     * @return TODO
686     * @throws ScmException if any
687     * @deprecated use {@link #tag(ScmRepository, ScmFileSet, String, ScmTagParameters)}
688     */
689    TagScmResult tag(ScmRepository repository, ScmFileSet fileSet, String tagName, String message) throws ScmException;
690
691    /**
692     * Tag (or label in some systems) will tag the source file with a certain tag
693     *
694     * @param repository       the source control system
695     * @param fileSet          the files to tag. Implementations can also give the changes
696     *                         from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
697     * @param tagName          the tag name to apply to the files
698     * @param scmTagParameters bean to pass some paramters for tagging {@link ScmTagParameters}
699     * @return TODO
700     * @throws ScmException if any
701     * @since 1.2
702     */
703    TagScmResult tag(ScmRepository repository, ScmFileSet fileSet, String tagName, ScmTagParameters scmTagParameters)
704            throws ScmException;
705
706    /**
707     * Updates the copy on the local machine with the changes in the repository
708     *
709     * @param repository the source control system
710     * @param fileSet    location of your local copy
711     * @return TODO
712     * @throws ScmException if any
713     */
714    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
715
716    /**
717     * Updates the copy on the local machine with the changes in the repository
718     *
719     * @param repository the source control system
720     * @param fileSet    location of your local copy
721     * @param tag        use the version defined by the tag
722     * @return TODO
723     * @throws ScmException if any
724     * @deprecated you must use {@link ScmProvider#update(org.apache.maven.scm.repository.ScmRepository,
725     *             org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion)}
726     */
727    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag) throws ScmException;
728
729    /**
730     * Updates the copy on the local machine with the changes in the repository
731     *
732     * @param repository the source control system
733     * @param fileSet    location of your local copy
734     * @param version    use the version defined by the branch/tag/revision
735     * @return TODO
736     * @throws ScmException if any
737     */
738    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version) throws ScmException;
739
740    /**
741     * Updates the copy on the local machine with the changes in the repository
742     *
743     * @param repository   the source control system
744     * @param fileSet      location of your local copy
745     * @param tag          use the version defined by the tag
746     * @param runChangelog Run the changelog command after the update
747     * @return TODO
748     * @throws ScmException if any
749     * @deprecated you must use {@link ScmProvider#update(org.apache.maven.scm.repository.ScmRepository,
750     *             org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion, boolean)}
751     */
752    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag, boolean runChangelog)
753            throws ScmException;
754
755    /**
756     * Updates the copy on the local machine with the changes in the repository
757     *
758     * @param repository   the source control system
759     * @param fileSet      location of your local copy
760     * @param runChangelog Run the changelog command after the update
761     * @return TODO
762     * @throws ScmException if any
763     */
764    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, boolean runChangelog) throws ScmException;
765
766    /**
767     * Updates the copy on the local machine with the changes in the repository
768     *
769     * @param repository   the source control system
770     * @param fileSet      location of your local copy
771     * @param version      use the version defined by the branch/tag/revision
772     * @param runChangelog Run the changelog command after the update
773     * @return TODO
774     * @throws ScmException if any
775     */
776    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, boolean runChangelog)
777            throws ScmException;
778
779    /**
780     * Updates the copy on the local machine with the changes in the repository
781     *
782     * @param repository  the source control system
783     * @param fileSet     location of your local copy
784     * @param tag         use the version defined by the tag
785     * @param datePattern the date pattern use in changelog output returned by scm tool
786     * @return TODO
787     * @throws ScmException if any
788     * @deprecated you must use {@link ScmProvider#update(org.apache.maven.scm.repository.ScmRepository,
789     *             org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion, String)}
790     */
791    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag, String datePattern)
792            throws ScmException;
793
794    /**
795     * Updates the copy on the local machine with the changes in the repository
796     *
797     * @param repository  the source control system
798     * @param fileSet     location of your local copy
799     * @param version     use the version defined by the branch/tag/revision
800     * @param datePattern the date pattern use in changelog output returned by scm tool
801     * @return TODO
802     * @throws ScmException if any
803     */
804    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, String datePattern)
805            throws ScmException;
806
807    /**
808     * Updates the copy on the local machine with the changes in the repository
809     *
810     * @param repository the source control system
811     * @param fileSet    location of your local copy
812     * @param tag        use the version defined by the tag
813     * @param lastUpdate TODO
814     * @return TODO
815     * @throws ScmException if any
816     * @deprecated you must use {@link ScmProvider#update(org.apache.maven.scm.repository.ScmRepository,
817     *             org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion, java.util.Date)}
818     */
819    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate)
820            throws ScmException;
821
822    /**
823     * Updates the copy on the local machine with the changes in the repository
824     *
825     * @param repository the source control system
826     * @param fileSet    location of your local copy
827     * @param version    use the version defined by the branch/tag/revision
828     * @param lastUpdate TODO
829     * @return TODO
830     * @throws ScmException if any
831     */
832    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate)
833            throws ScmException;
834
835    /**
836     * Updates the copy on the local machine with the changes in the repository
837     *
838     * @param repository  the source control system
839     * @param fileSet     location of your local copy
840     * @param tag         use the version defined by the tag
841     * @param lastUpdate  Date of last update
842     * @param datePattern the date pattern use in changelog output returned by scm tool
843     * @return TODO
844     * @throws ScmException if any
845     * @deprecated you must use {@link ScmProvider#update(org.apache.maven.scm.repository.ScmRepository,
846     *             org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion, java.util.Date, String)}
847     */
848    UpdateScmResult update(
849            ScmRepository repository, ScmFileSet fileSet, String tag, Date lastUpdate, String datePattern)
850            throws ScmException;
851
852    /**
853     * Updates the copy on the local machine with the changes in the repository
854     *
855     * @param repository  the source control system
856     * @param fileSet     location of your local copy
857     * @param version     use the version defined by the branch/tag/revision
858     * @param lastUpdate  Date of last update
859     * @param datePattern the date pattern use in changelog output returned by scm tool
860     * @return TODO
861     * @throws ScmException if any
862     */
863    UpdateScmResult update(
864            ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate, String datePattern)
865            throws ScmException;
866
867    /**
868     * Make a file editable. This is used in source control systems where you look at read-only files
869     * and you need to make them not read-only anymore before you can edit them. This can also mean
870     * that no other user in the system can make the file not read-only anymore.
871     *
872     * @param repository the source control system
873     * @param fileSet    the files to make editable
874     * @return TODO
875     * @throws ScmException if any
876     */
877    EditScmResult edit(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
878
879    /**
880     * Make a file no longer editable. This is the conterpart of {@link #edit(
881     *org.apache.maven.scm.repository.ScmRepository, org.apache.maven.scm.ScmFileSet)}.
882     * It makes the file read-only again.
883     *
884     * @param repository the source control system
885     * @param fileSet    the files to make uneditable
886     * @return TODO
887     * @throws ScmException if any
888     */
889    UnEditScmResult unedit(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
890
891    /**
892     * List each element (files and directories) of <B>fileSet</B> as they exist in the repository.
893     *
894     * @param repository the source control system
895     * @param fileSet    the files to list
896     * @param recursive  descend recursively
897     * @param tag        use the version defined by the tag
898     * @return the list of files in the repository
899     * @throws ScmException if any
900     * @deprecated you must use {@link ScmProvider#list(org.apache.maven.scm.repository.ScmRepository,
901     *             org.apache.maven.scm.ScmFileSet, boolean, org.apache.maven.scm.ScmVersion)}
902     */
903    ListScmResult list(ScmRepository repository, ScmFileSet fileSet, boolean recursive, String tag) throws ScmException;
904
905    /**
906     * List each element (files and directories) of <B>fileSet</B> as they exist in the repository.
907     *
908     * @param repository the source control system
909     * @param fileSet    the files to list
910     * @param recursive  descend recursively
911     * @param version    use the version defined by the branch/tag/revision
912     * @return the list of files in the repository
913     * @throws ScmException if any
914     */
915    ListScmResult list(ScmRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion version)
916            throws ScmException;
917
918    /**
919     * Returns the blame of specified file
920     *
921     * @param repository the source control system
922     * @param fileSet    location of your local copy
923     * @param filename   file
924     * @return blame for specified file
925     * @throws ScmException if any
926     * @since 1.4
927     * @deprecated use blame with {@link BlameScmRequest} parameter
928     */
929    BlameScmResult blame(ScmRepository repository, ScmFileSet fileSet, String filename) throws ScmException;
930
931    /**
932     *
933     * @param blameScmRequest TODO
934     * @return blame for the file specified in the request
935     * @throws ScmException if any
936     * @since 1.8
937     */
938    BlameScmResult blame(BlameScmRequest blameScmRequest) throws ScmException;
939
940    /**
941     * Create directory/directories in the repository.
942     *
943     * @param repository TODO
944     * @param fileSet TODO
945     * @param createInLocal TODO
946     * @param message TODO
947     * @return TODO
948     * @throws ScmException if any
949     */
950    MkdirScmResult mkdir(ScmRepository repository, ScmFileSet fileSet, String message, boolean createInLocal)
951            throws ScmException;
952
953    /**
954     * @param repository the source control system
955     * @param fileSet    location of your local copy
956     * @param parameters some parameters (not use currently but for future use)
957     * @return if the scm implementation doesn't support "info" result will <code>null</code>
958     * @throws ScmException if any
959     * @since 1.5
960     */
961    InfoScmResult info(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters)
962            throws ScmException;
963
964    /**
965     * @param repository the source control system
966     * @param fileSet    not use currently but for future use
967     * @param parameters some parameters (not use currently but for future use)
968     * @return if the scm implementation doesn't support "info" result will <code>null</code>
969     * @throws ScmException if any
970     * @since 1.6
971     */
972    RemoteInfoScmResult remoteInfo(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters)
973            throws ScmException;
974}