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.manager;
020
021import java.io.File;
022import java.util.Date;
023import java.util.List;
024import java.util.Optional;
025
026import org.apache.maven.scm.CommandParameters;
027import org.apache.maven.scm.ScmBranch;
028import org.apache.maven.scm.ScmException;
029import org.apache.maven.scm.ScmFileSet;
030import org.apache.maven.scm.ScmVersion;
031import org.apache.maven.scm.command.add.AddScmResult;
032import org.apache.maven.scm.command.blame.BlameScmRequest;
033import org.apache.maven.scm.command.blame.BlameScmResult;
034import org.apache.maven.scm.command.branch.BranchScmResult;
035import org.apache.maven.scm.command.changelog.ChangeLogScmRequest;
036import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
037import org.apache.maven.scm.command.checkin.CheckInScmResult;
038import org.apache.maven.scm.command.checkout.CheckOutScmResult;
039import org.apache.maven.scm.command.diff.DiffScmResult;
040import org.apache.maven.scm.command.edit.EditScmResult;
041import org.apache.maven.scm.command.export.ExportScmResult;
042import org.apache.maven.scm.command.list.ListScmResult;
043import org.apache.maven.scm.command.mkdir.MkdirScmResult;
044import org.apache.maven.scm.command.remove.RemoveScmResult;
045import org.apache.maven.scm.command.status.StatusScmResult;
046import org.apache.maven.scm.command.tag.TagScmResult;
047import org.apache.maven.scm.command.unedit.UnEditScmResult;
048import org.apache.maven.scm.command.update.UpdateScmResult;
049import org.apache.maven.scm.provider.ScmProvider;
050import org.apache.maven.scm.repository.ScmRepository;
051import org.apache.maven.scm.repository.ScmRepositoryException;
052import org.apache.maven.scm.repository.UnknownRepositoryStructure;
053
054/**
055 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
056 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
057 * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
058 * @author Olivier Lamy
059 */
060public interface ScmManager {
061    // ----------------------------------------------------------------------
062    // Repository
063    // ----------------------------------------------------------------------
064
065    /**
066     * Generate a {@link ScmRepository} from an SCM URL.
067     *
068     * @param scmUrl the scm url
069     * @return the scm repository (never {@code null})
070     * @throws NoSuchScmProviderException if the provider doesn't exist
071     * @throws ScmRepositoryException     if an error occurs in the scm repository construction
072     */
073    ScmRepository makeScmRepository(String scmUrl) throws ScmRepositoryException, NoSuchScmProviderException;
074
075    /**
076     * Generate a {@link ScmRepository} for a specific provider and a given checkout (working) directory
077     * @param providerType
078     * @param path the checkout (working) directory
079     * @return the SCM repository (never {@code null})
080     * @throws ScmRepositoryException if the provider does not recognize the directory
081     * @throws UnknownRepositoryStructure if the provider does not support this way of generating a {@link ScmRepository}
082     * @throws NoSuchScmProviderException if the given provider type does not have a provider implementation bound
083     */
084    ScmRepository makeProviderScmRepository(String providerType, File path)
085            throws ScmRepositoryException, UnknownRepositoryStructure, NoSuchScmProviderException;
086
087    /**
088     * Generate a {@link ScmRepository} for a given checkout (working) directory.
089     * Determines a suitable SCM provider for the directory by looking for SCM specific metadata files.
090     * @param path the checkout (working) directory
091     * @return the {@link ScmRepository} or empty if no suitable provider found
092     * @since 2.2.1
093     */
094    Optional<ScmRepository> makeProviderScmRepository(File path);
095
096    /**
097     * Validate a SCM URL.
098     *
099     * @param scmUrl the SCM URL to validate
100     * @return <code>List</code> of <code>String</code> objects with the messages returned by the SCM provider
101     */
102    List<String> validateScmRepository(String scmUrl);
103
104    ScmProvider getProviderByUrl(String scmUrl) throws ScmRepositoryException, NoSuchScmProviderException;
105
106    /**
107     * Returns the default provider registered for this providerType or a specific implementation if the
108     * 'maven.scm.provider.providerType.implementation' system property is defined. For example:
109     * maven.scm.provider.git.implementation=git.
110     *
111     * @param providerType the provider type (git, svn...)
112     * @return the scm provider
113     * @throws NoSuchScmProviderException if the provider doesn't exist
114     */
115    ScmProvider getProviderByType(String providerType) throws NoSuchScmProviderException;
116
117    ScmProvider getProviderByRepository(ScmRepository repository) throws NoSuchScmProviderException;
118
119    /**
120     * Set a provider to be used for a type of SCM. If there was already a designed provider for that type it will be
121     * replaced.
122     *
123     * @param providerType the type of SCM, e.g. <code>svn</code>, <code>git</code>
124     * @param provider     the provider that will be used for that SCM type
125     */
126    void setScmProvider(String providerType, ScmProvider provider);
127
128    /**
129     * Set the provider implementation.
130     *
131     * @param providerType           the provider type, e.g. <code>git</code>
132     * @param providerImplementation the provider implementation (the role-hint of the provider), e.g. <code>git</code>,
133     *                               <code>svn</code>
134     */
135    void setScmProviderImplementation(String providerType, String providerImplementation);
136
137    /**
138     * Adds the given files to the source control system.
139     *
140     * @param repository the source control system
141     * @param fileSet    the files to be added
142     * @return an {@link AddScmResult} that contains the file paths (relative to {@code fileSet.getBasedir()}) that
143     * have been added
144     * @throws ScmException if any
145     */
146    AddScmResult add(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
147
148    /**
149     * Adds the given files to the source control system.
150     *
151     * @param repository the source control system
152     * @param fileSet    the files to be added
153     * @param message    a string that is a comment on the new added file
154     * @return an {@link AddScmResult} that contains the file paths (relative to {@code fileSet.getBasedir()}) that
155     * have been added
156     * @throws ScmException if any
157     */
158    AddScmResult add(ScmRepository repository, ScmFileSet fileSet, String message) throws ScmException;
159
160    /**
161     * Branch (or label in some systems) will create a branch of the source file with a certain branch name.
162     *
163     * @param repository the source control system
164     * @param fileSet    the files to branch. Implementations can also give the changes from the
165     *                   {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
166     * @param branchName the branch name to apply to the files
167     * @return TODO
168     * @throws ScmException if any
169     */
170    BranchScmResult branch(ScmRepository repository, ScmFileSet fileSet, String branchName) throws ScmException;
171
172    /**
173     * Branch (or label in some systems) will create a branch of the source file with a certain branch name.
174     *
175     * @param repository the source control system
176     * @param fileSet    the files to branch. Implementations can also give the changes from the
177     *                   {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
178     * @param branchName the branch name to apply to the files
179     * @param message    the commit message used for the tag creation
180     * @return TODO
181     * @throws ScmException if any
182     */
183    BranchScmResult branch(ScmRepository repository, ScmFileSet fileSet, String branchName, String message)
184            throws ScmException;
185
186    /**
187     * Returns the changes that have happend in the source control system in a certain period of time. This can be
188     * adding, removing, updating, ... of files.
189     *
190     * @param repository the source control system
191     * @param fileSet    the files to know the changes about. Implementations can also give the changes from the
192     *                   {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
193     * @param startDate  the start date of the period
194     * @param endDate    the end date of the period
195     * @param numDays    the number days before the current time if startdate and enddate are null
196     * @param branch     the branch/tag
197     * @return the SCM result of the changelog command
198     * @throws ScmException if any
199     * @deprecated use {@link #changeLog(org.apache.maven.scm.command.changelog.ChangeLogScmRequest)} instead
200     */
201    @Deprecated
202    ChangeLogScmResult changeLog(
203            ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate, int numDays, ScmBranch branch)
204            throws ScmException;
205
206    /**
207     * Returns the changes that have happend in the source control system in a certain period of time. This can be
208     * adding, removing, updating, ... of files.
209     *
210     * @param repository  the source control system
211     * @param fileSet     the files to know the changes about. Implementations can also give the changes from the
212     *                    {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
213     * @param startDate   the start date of the period
214     * @param endDate     the end date of the period
215     * @param numDays     the number days before the current time if startdate and enddate are null
216     * @param branch      the branch/tag
217     * @param datePattern the date pattern use in changelog output returned by scm tool
218     * @return the SCM result of the changelog command
219     * @throws ScmException if any
220     * @deprecated use {@link #changeLog(org.apache.maven.scm.command.changelog.ChangeLogScmRequest)} instead
221     */
222    @Deprecated
223    ChangeLogScmResult changeLog(
224            ScmRepository repository,
225            ScmFileSet fileSet,
226            Date startDate,
227            Date endDate,
228            int numDays,
229            ScmBranch branch,
230            String datePattern)
231            throws ScmException;
232
233    /**
234     * Returns the changes that have happend in the source control system in a certain period of time. This can be
235     * adding, removing, updating, ... of files.
236     *
237     * @param scmRequest request wrapping detailed parameters for the changelog command
238     * @return the SCM result of the changelog command
239     * @throws ScmException if any
240     * @since 1.8
241     */
242    ChangeLogScmResult changeLog(ChangeLogScmRequest scmRequest) throws ScmException;
243
244    /**
245     * Returns the changes that have happend in the source control system between two tags. This can be adding,
246     * removing, updating, ... of files.
247     *
248     * @param repository   the source control system
249     * @param fileSet      the files to know the changes about. Implementations can also give the changes from the
250     *                     {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
251     * @param startVersion the start branch/tag/revision
252     * @param endVersion   the end branch/tag/revision
253     * @return the SCM result of the changelog command
254     * @throws ScmException if any
255     * @deprecated use {@link #changeLog(org.apache.maven.scm.command.changelog.ChangeLogScmRequest)} instead
256     */
257    @Deprecated
258    ChangeLogScmResult changeLog(
259            ScmRepository repository, ScmFileSet fileSet, ScmVersion startVersion, ScmVersion endVersion)
260            throws ScmException;
261
262    /**
263     * Returns the changes that have happend in the source control system between two tags. This can be adding,
264     * removing, updating, ... of files.
265     *
266     * @param repository    the source control system
267     * @param fileSet       the files to know the changes about. Implementations can also give the changes from the
268     *                      {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
269     * @param startRevision the start revision
270     * @param endRevision   the end revision
271     * @param datePattern   the date pattern use in changelog output returned by scm tool
272     * @return TODO
273     * @throws ScmException if any
274     * @deprecated use {@link #changeLog(org.apache.maven.scm.command.changelog.ChangeLogScmRequest)} instead
275     */
276    @Deprecated
277    ChangeLogScmResult changeLog(
278            ScmRepository repository,
279            ScmFileSet fileSet,
280            ScmVersion startRevision,
281            ScmVersion endRevision,
282            String datePattern)
283            throws ScmException;
284
285    /**
286     * Save the changes you have done into the repository. This will create a new version of the file or directory in
287     * the repository.
288     * <p>
289     * When the fileSet has no entries, the {@code fileSet.getBasedir()} is recursively committed. When the fileSet
290     * has entries, the commit is non-recursive and only the elements in the fileSet are committed.
291     *
292     * @param repository the source control system
293     * @param fileSet    the files to check in (sometimes called commit)
294     * @param message    a string that is a comment on the changes that where done
295     * @return a {@link CheckInScmResult} that contains the file paths (relative to {@code fileSet.getBasedir()}) that
296     * have been checked in
297     * @throws ScmException if any
298     */
299    CheckInScmResult checkIn(ScmRepository repository, ScmFileSet fileSet, String message) throws ScmException;
300
301    /**
302     * Save the changes you have done into the repository. This will create a new version of the file or directory in
303     * the repository.
304     * <p>
305     * When the fileSet has no entries, the {@code fileSet.getBasedir()} is recursively committed. When the fileSet
306     * has entries, the commit is non-recursive and only the elements in the fileSet are committed.
307     *
308     * @param repository the source control system
309     * @param fileSet    the files to check in (sometimes called commit)
310     * @param commandParameters parameters for the command, such as commit message and whether to sign the commit. {@link CommandParameters}
311     * @return a {@link CheckInScmResult} that contains the file paths (relative to {@code fileSet.getBasedir()}) that
312     * have been checked in
313     * @throws ScmException if any
314     */
315    CheckInScmResult checkIn(ScmRepository repository, ScmFileSet fileSet, CommandParameters commandParameters)
316            throws ScmException;
317
318    /**
319     * Save the changes you have done into the repository. This will create a new version of the file or directory in
320     * the repository.
321     * <p>
322     * When the fileSet has no entries, the {@code fileSet.getBasedir()} is recursively committed. When the fileSet
323     * has entries, the commit is non-recursive and only the elements in the fileSet are committed.
324     *
325     * @param repository the source control system
326     * @param fileSet    the files to check in (sometimes called commit)
327     * @param revision   branch/tag/revision
328     * @param message    a string that is a comment on the changes that where done
329     * @return a {@link CheckInScmResult} that contains the file paths (relative to {@code fileSet.getBasedir()}) that
330     * have been checked in
331     * @throws ScmException if any
332     */
333    CheckInScmResult checkIn(ScmRepository repository, ScmFileSet fileSet, ScmVersion revision, String message)
334            throws ScmException;
335
336    /**
337     * Create a copy of the repository on your local machine.
338     *
339     * @param repository the source control system
340     * @param fileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
341     * @return TODO
342     * @throws ScmException if any
343     */
344    CheckOutScmResult checkOut(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
345
346    /**
347     * Create a copy of the repository on your local machine.
348     *
349     * @param repository the source control system
350     * @param fileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
351     * @param version    get the version defined by the revision, branch or tag
352     * @return TODO
353     * @throws ScmException if any
354     */
355    CheckOutScmResult checkOut(ScmRepository repository, ScmFileSet fileSet, ScmVersion version) throws ScmException;
356
357    /**
358     * Create a copy of the repository on your local machine.
359     *
360     * @param scmRepository the source control system
361     * @param scmFileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
362     * @param recursive     whether to check out recursively
363     * @return TODO
364     * @throws ScmException if any
365     */
366    CheckOutScmResult checkOut(ScmRepository scmRepository, ScmFileSet scmFileSet, boolean recursive)
367            throws ScmException;
368
369    /**
370     * Create a copy of the repository on your local machine.
371     *
372     * @param scmRepository the source control system
373     * @param scmFileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
374     * @param version       get the version defined by the revision, branch or tag
375     * @param recursive     whether to check out recursively
376     * @return TODO
377     * @throws ScmException if any
378     */
379    CheckOutScmResult checkOut(
380            ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion version, boolean recursive)
381            throws ScmException;
382
383    /**
384     * Create a diff between two branch/tag/revision.
385     *
386     * @param scmRepository the source control system
387     * @param scmFileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
388     * @param startVersion  the start branch/tag/revision
389     * @param endVersion    the end branch/tag/revision
390     * @return TODO
391     * @throws ScmException if any
392     */
393    DiffScmResult diff(
394            ScmRepository scmRepository, ScmFileSet scmFileSet, ScmVersion startVersion, ScmVersion endVersion)
395            throws ScmException;
396
397    /**
398     * Make a file editable. This is used in source control systems where you look at read-only files, and you need to
399     * make them writable before you can edit them. This can also mean that no other user in the system can
400     * make the file writable.
401     *
402     * @param repository the source control system
403     * @param fileSet    the files to make editable
404     * @return TODO
405     * @throws ScmException if any
406     */
407    EditScmResult edit(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
408
409    /**
410     * Create an exported copy of the repository on your local machine.
411     *
412     * @param repository the source control system
413     * @param fileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
414     * @return TODO
415     * @throws ScmException if any
416     */
417    ExportScmResult export(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
418
419    /**
420     * Create an exported copy of the repository on your local machine.
421     *
422     * @param repository the source control system
423     * @param fileSet    the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
424     * @param version    get the version defined by the branch/tag/revision
425     * @return TODO
426     * @throws ScmException if any
427     */
428    ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, ScmVersion version) throws ScmException;
429
430    /**
431     * Create an exported copy of the repository on your local machine.
432     *
433     * @param repository      the source control system
434     * @param fileSet         the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
435     * @param outputDirectory the directory where the export will be stored
436     * @return TODO
437     * @throws ScmException if any
438     */
439    ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, String outputDirectory) throws ScmException;
440
441    /**
442     * Create an exported copy of the repository on your local machine.
443     *
444     * @param repository      the source control system
445     * @param fileSet         the files are copied to the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} location
446     * @param version         get the version defined by the branch/tag/revision
447     * @param outputDirectory the directory where the export will be stored
448     * @return TODO
449     * @throws ScmException if any
450     */
451    ExportScmResult export(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, String outputDirectory)
452            throws ScmException;
453
454    /**
455     * List each element (files and directories) of <B>fileSet</B> as they exist in the repository.
456     *
457     * @param repository the source control system
458     * @param fileSet    the files to list
459     * @param recursive  descend recursively
460     * @param version    use the version defined by the branch/tag/revision
461     * @return the list of files in the repository
462     * @throws ScmException if any
463     */
464    ListScmResult list(ScmRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion version)
465            throws ScmException;
466
467    /**
468     * Create new directory/directories in the repository.
469     *
470     * @param repository TODO
471     * @param fileSet TODO
472     * @param message TODO
473     * @param createInLocal TODO
474     * @return TODO
475     * @throws ScmException if any
476     */
477    MkdirScmResult mkdir(ScmRepository repository, ScmFileSet fileSet, String message, boolean createInLocal)
478            throws ScmException;
479
480    /**
481     * Removes the given files from the source control system.
482     *
483     * @param repository the source control system
484     * @param fileSet    the files to be removed
485     * @param message TODO
486     * @return a {@link RemoveScmResult} that contains the file paths (relative to {@code fileSet.getBasedir()}) that
487     * have been removed
488     * @throws ScmException if any
489     */
490    RemoveScmResult remove(ScmRepository repository, ScmFileSet fileSet, String message) throws ScmException;
491
492    /**
493     * Returns the status of the files in the source control system. The state of each file can be one of the
494     * {@link org.apache.maven.scm.ScmFileStatus} flags.
495     *
496     * @param repository the source control system
497     * @param fileSet    the files to know the status about. Implementations can also give the changes from the
498     *                   {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
499     * @return TODO
500     * @throws ScmException if any
501     */
502    StatusScmResult status(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
503
504    /**
505     * Tag (or label in some systems) will tag the source file with a certain tag.
506     *
507     * @param repository the source control system
508     * @param fileSet    the files to tag. Implementations can also give the changes from the
509     *                   {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
510     * @param tagName    the tag name to apply to the files
511     * @return TODO
512     * @throws ScmException if any
513     */
514    TagScmResult tag(ScmRepository repository, ScmFileSet fileSet, String tagName) throws ScmException;
515
516    /**
517     * Tag (or label in some systems) will tag the source file with a certain tag.
518     *
519     * @param repository the source control system
520     * @param fileSet    the files to tag. Implementations can also give the changes from the
521     *                   {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
522     * @param tagName    the tag name to apply to the files
523     * @param message    the commit message used for the tag creation
524     * @return TODO
525     * @throws ScmException if any
526     */
527    TagScmResult tag(ScmRepository repository, ScmFileSet fileSet, String tagName, String message) throws ScmException;
528
529    /**
530     * Make a file no longer editable. This is the conterpart of
531     * {@link #edit(org.apache.maven.scm.repository.ScmRepository, org.apache.maven.scm.ScmFileSet)}. It makes the file
532     * read-only again.
533     *
534     * @param repository the source control system
535     * @param fileSet    the files to make uneditable
536     * @return TODO
537     * @throws ScmException if any
538     */
539    UnEditScmResult unedit(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
540
541    /**
542     * Updates the copy on the local machine with the changes in the repository.
543     *
544     * @param repository the source control system
545     * @param fileSet    location of your local copy
546     * @return TODO
547     * @throws ScmException if any
548     */
549    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet) throws ScmException;
550
551    /**
552     * Updates the copy on the local machine with the changes in the repository.
553     *
554     * @param repository the source control system
555     * @param fileSet    location of your local copy
556     * @param version    use the version defined by the branch/tag/revision
557     * @return TODO
558     * @throws ScmException if any
559     */
560    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version) throws ScmException;
561
562    /**
563     * Updates the copy on the local machine with the changes in the repository.
564     *
565     * @param repository   the source control system
566     * @param fileSet      location of your local copy
567     * @param runChangelog run the changelog command after the update
568     * @return TODO
569     * @throws ScmException if any
570     */
571    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, boolean runChangelog) throws ScmException;
572
573    /**
574     * Updates the copy on the local machine with the changes in the repository.
575     *
576     * @param repository   the source control system
577     * @param fileSet      location of your local copy
578     * @param version      use the version defined by the branch/tag/revision
579     * @param runChangelog run the changelog command after the update
580     * @return TODO
581     * @throws ScmException if any
582     */
583    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, boolean runChangelog)
584            throws ScmException;
585
586    /**
587     * Updates the copy on the local machine with the changes in the repository.
588     *
589     * @param repository  the source control system
590     * @param fileSet     location of your local copy
591     * @param datePattern the date pattern use in changelog output returned by scm tool
592     * @return TODO
593     * @throws ScmException if any
594     */
595    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, String datePattern) throws ScmException;
596
597    /**
598     * Updates the copy on the local machine with the changes in the repository.
599     *
600     * @param repository  the source control system
601     * @param fileSet     location of your local copy
602     * @param version     use the version defined by the branch/tag/revision
603     * @param datePattern the date pattern use in changelog output returned by scm tool
604     * @return TODO
605     * @throws ScmException if any
606     */
607    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, String datePattern)
608            throws ScmException;
609
610    /**
611     * Updates the copy on the local machine with the changes in the repository.
612     *
613     * @param repository the source control system
614     * @param fileSet    location of your local copy
615     * @param lastUpdate TODO
616     * @return TODO
617     * @throws ScmException if any
618     */
619    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, Date lastUpdate) throws ScmException;
620
621    /**
622     * Updates the copy on the local machine with the changes in the repository.
623     *
624     * @param repository the source control system
625     * @param fileSet    location of your local copy
626     * @param version    use the version defined by the branch/tag/revision
627     * @param lastUpdate TODO
628     * @return TODO
629     * @throws ScmException if any
630     */
631    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate)
632            throws ScmException;
633
634    /**
635     * Updates the copy on the local machine with the changes in the repository.
636     *
637     * @param repository  the source control system
638     * @param fileSet     location of your local copy
639     * @param lastUpdate  date of last update
640     * @param datePattern the date pattern use in changelog output returned by scm tool
641     * @return TODO
642     * @throws ScmException if any
643     */
644    UpdateScmResult update(ScmRepository repository, ScmFileSet fileSet, Date lastUpdate, String datePattern)
645            throws ScmException;
646
647    /**
648     * Updates the copy on the local machine with the changes in the repository.
649     *
650     * @param repository  the source control system
651     * @param fileSet     location of your local copy
652     * @param version     use the version defined by the branch/tag/revision
653     * @param lastUpdate  date of last update
654     * @param datePattern the date pattern use in changelog output returned by scm tool
655     * @return TODO
656     * @throws ScmException if any
657     */
658    UpdateScmResult update(
659            ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate, String datePattern)
660            throws ScmException;
661
662    /**
663     * Returns the blame of specified file.
664     *
665     * @param repository the source control system
666     * @param fileSet    location of your local copy
667     * @param filename   file
668     * @return blame for specified file
669     * @throws ScmException if any
670     * @since 1.4
671     */
672    BlameScmResult blame(ScmRepository repository, ScmFileSet fileSet, String filename) throws ScmException;
673
674    /**
675     * @param blameScmRequest TODO
676     * @return blame for specified file
677     * @throws ScmException if any
678     * @since 1.4
679     */
680    BlameScmResult blame(BlameScmRequest blameScmRequest) throws ScmException;
681}