1VCSTOOLS(1)                        vcstools                        VCSTOOLS(1)
2
3
4

NAME

6       vcstools - vcstools Documentation
7
8       The  vcstools module provides a Python API for interacting with differ‐
9       ent version control systems (VCS/SCMs).  The VcsClient  class  provides
10       an  API for seamless interacting with Git, Mercurial (Hg), Bzr and SVN.
11       The focus of the API is manipulating on-disk checkouts  of  source-con‐
12       trolled trees.  Its main use is to support the rosinstall tool.
13

GENERAL VCS/SCM API

15       The VcsClient class provides a generic API for
16
17       · Subversion (svn)
18
19       · Mercurial (hg)
20
21       · Git (git)
22
23       · Bazaar (bzr)
24
25       class vcstools.VcsClient(vcs_type, path)
26              API  for interacting with source-controlled paths independent of
27              actual version-control implementation.
28
29              Parameters
30
31                     · vcs_type – type of VCS to use (e.g. ‘svn’, ‘hg’, ‘bzr’,
32                       ‘git’), str
33
34                     · path  –  filesystem  path where code is/will be checked
35                       out , str
36
37              path_exists() -> bool
38
39                     Returns
40                            True if path exists on disk.
41
42              get_path() -> str
43
44                     Returns
45                            filesystem path this client is initialized with.
46
47              url_matches(self, url, url_or_shortcut) -> bool
48                     client can decide whether the url and the other  url  are
49                     equivalent.  Checks string equality by default
50
51                     Parameters
52                            url_or_shortcut   –  url  or  shortcut  (e.g.  bzr
53                            launchpad url)
54
55                     Returns
56                            bool if params are equivalent
57
58              get_version([spec=None]) -> str
59
60                     Parameters
61                            spec 
62
63                            token for identifying repository revision desired.
64                            Token  might be a tagname, branchname, version-id,
65                            or SHA-ID depending on the VCS implementation.
66
67                            · svn: anything accepted by svn info --help,  e.g.
68                              a  revnumber,  {date}, HEAD, BASE, PREV, or COM‐
69                              MITTED
70
71                            · git: anything accepted by git log, e.g.  a  tag‐
72                              name, branchname, or sha-id.
73
74                            · hg:  anything accepted by hg log -r, e.g. a tag‐
75                              name, sha-ID, revision-number
76
77                            · bzr: revisionspec as returned by bzr help  revi‐
78                              sionspec, e.g. a tagname or revno:<number>
79
80
81                     Returns
82                            current  revision number of the repository.  Or if
83                            spec is provided, the globally  unique  identifier
84                            (e.g.  revision  number,  or SHA-ID) of a revision
85                            specified by some token.
86
87              get_remote_version(self, fatch=False) -> str
88                     Find an identifier for the current  revision  on  remote.
89                     Token  spec  might  be  a  tagname, version-id, SHA-ID, …
90                     depending on the VCS implementation.
91
92                     Parameters
93                            fetch – if False, only local  information  may  be
94                            used
95
96                     Returns
97                            current revision number of the remote repository.
98
99              get_current_version_label() -> str
100                     Find an description for the current local version.  Token
101                     spec might be a branchname, version-id, SHA-ID, … depend‐
102                     ing on the VCS implementation.
103
104                        returns
105                               short   description   of  local  version  (e.g.
106                               branchname, tagename).
107
108              checkout(url[, version=''][, verbose=False][, shallow=False])
109                     Checkout the given URL to the path associated  with  this
110                     client.
111
112                     Parameters
113
114                            · url – URL of source control to check out
115
116                            · version – specific version to check out
117
118                            · verbose – flag to run verbosely
119
120                            · shallow  –  flag to create shallow clone without
121                              history
122
123              update(version)
124                     Update the local checkout from upstream source control.
125
126              detect_presence() -> bool
127
128                     Returns
129                            True if path has  a  checkout  with  matching  VCS
130                            type,  e.g.  if  the type of this client is ‘svn’,
131                            the checkout at the path is managed by Subversion.
132
133              get_vcs_type_name() -> str
134
135                     Returns
136                            type of VCS this client is initialized with.
137
138              get_url() -> str
139
140                     Returns
141                            Upstream URL that this code was checked out from.
142
143              get_branch_parent()
144                     (Git Only)
145
146                     Returns
147                            parent branch.
148
149              get_diff([basepath=None])
150
151                     Parameters
152                            basepath – compute diff relative to this path,  if
153                            provided
154
155                     Returns
156                            A string showing local differences
157
158              get_status([basepath=None[, untracked=False]])
159                     Calls scm status command. semantics of untracked are dif‐
160                     ficult to generalize. In SVN, this  would  be  new  files
161                     only.  In  git,  hg, bzr, this would be changes that have
162                     not been added for commit.
163
164                     Parameters
165
166                            · basepath – status path will be relative to this,
167                              if provided.
168
169                            · untracked  –  If  True,  also  show changes that
170                              would not commit
171
172                     Returns
173                            A string summarizing locally modified files
174
175       Example:
176
177          import vcstools
178
179          # interrogate an existing tree
180          client = vcstools.VcsClient('svn', '/path/to/checkout')
181
182          print client.get_url()
183          print client.get_version()
184          print client.get_diff()
185
186          # create a new tree
187          client = vcstools.VcsClient('hg', '/path/to/new/checkout')
188          client.checkout('https://bitbucket.org/foo/bar')
189
190       vcstools is available on pypi and can be installed via pip
191
192          pip install vcstools
193
194       or easy_install:
195
196          easy_install vcstools
197
198       The vcstools module is meant to be used  as  a  normal  Python  module.
199       After it has been installed, you can import it normally and do not need
200       to declare as a ROS package dependency.
201

DEVELOPER’S GUIDE

203   Code API
204   Packages
205   vcstools Package
206   vcstools Package
207       Library for tools that need to interact with ROS-support  version  con‐
208       trol systems.
209
210       vcstools.setup_logger()
211              creates a logger 'vcstools'
212
213   bzr Module
214       bzr vcs support.
215
216       vcstools.bzr.BZRClient
217              alias of vcstools.bzr.BzrClient
218
219       class vcstools.bzr.BzrClient(path)
220              Bases: vcstools.vcs_base.VcsClientBase
221
222              __init__(path)
223
224                     Raises VcsError if bzr not detected
225
226              checkout(url,  version=None, verbose=False, shallow=False, time‐
227              out=None)
228                     Attempts to create a local repository given a remote url.
229                     Fails  if  a  target  path  exists,  unless it's an empty
230                     directory.  If a version is provided, the  local  reposi‐
231                     tory  will  be  updated  to that revision. It is possible
232                     that after a failed call to checkout, a repository  still
233                     exists,  e.g. if an invalid revision was given.  If shal‐
234                     low is provided, the scm client may  checkout  less  than
235                     the  full  repository  history to save time / disk space.
236                     If a timeout is specified,  any  pending  operation  will
237                     fail  after the specified amount (in seconds). NOTE: this
238                     parameter might or might not be honored, depending on VCS
239                     client  implementation.   :param  url:  where to checkout
240                     from :type url: str :param version: token for identifying
241                     repository  revision  :type  version: str :param shallow:
242                     hint to checkout less than a full repository :type  shal‐
243                     low:  bool :param timeout: maximum allocated time to per‐
244                     form operation :type shallow: int :returns: True if  suc‐
245                     cessful
246
247              export_repository(version, basepath)
248                     Calls  scm  equivalent  to  svn export, removing scm meta
249                     information and tar gzip'ing the repository  at  a  given
250                     version to the given basepath.
251
252                     Parameters
253                            version  --  version  of the repository to export.
254                            This can
255
256                     be a branch, tag, or path  (svn).   When  specifying  the
257                     version as a path for svn, the path should be relative to
258                     the  root  of  the  svn  repository,  i.e.  'trunk',   or
259                     'tags/1.2.3',  or  './'  for  the root.  :param basepath:
260                     this is the path to the tar gzip, excluding the extension
261                     which  will  be  .tar.gz :returns: True on success, False
262                     otherwise.
263
264              get_affected_files(revision)
265                     Get the files that were affected by a  specific  revision
266                     :param  revision:  SHA  or  revision number.  :returns: A
267                     list of strings with the files  affected  by  a  specific
268                     commit
269
270              get_branches(local_only=False)
271                     Returns a list of all branches in the vcs repository.
272
273                     Parameters
274                            local_only  --  if  True  it  will only list local
275                            branches
276
277                     Returns
278                            list of branches in the  repository,  []  if  none
279                            exist
280
281              get_current_version_label()
282                     Find an description for the current local version.  Token
283                     spec might  be  a  branchname,  version-id,  SHA-ID,  ...
284                     depending on the VCS implementation.
285
286                     Returns
287                            short  description  of local version (e.g. branch‐
288                            name, tagename).
289
290                     Return type
291                            str
292
293              get_diff(basepath=None)
294
295                     Parameters
296                            basepath -- diff paths will be relative  to  this,
297                            if any
298
299                     Returns
300                            A string showing local differences
301
302                     Return type
303                            str
304
305              static get_environment_metadata()
306                     For  debugging purposes, returns a dict containing infor‐
307                     mation about the environment, like the version of the SCM
308                     client,  or  version of libraries involved.  Suggest con‐
309                     sidering  keywords  "version",  "dependency",  "features"
310                     first.   :returns: a dict containing relevant information
311                     :rtype: dict
312
313              get_log(relpath=None, limit=None)
314                     Calls scm log command.
315
316                     This returns a list of dictionaries  with  the  following
317                     fields:
318
319                            · id: the commit SHA or revision number
320
321                            · date: the date the commit was made (python date‐
322                              time)
323
324                            · author: the name of the author of the commit, if
325                              available
326
327                            · email:  the  e-mail address of the author of the
328                              commit
329
330                            · message: the commit message, if any
331
332                     Parameters
333                            relpath -- (optional) restrict logs to  events  on
334                            this
335
336                     resource  path  (folder  or file) relative to the root of
337                     the repository. If None (default), this is  the  root  of
338                     the  repository.   :param  limit:  (optional) the maximum
339                     number of log entries that should be retrieved.  If  None
340                     (default), there is no limit.
341
342              get_remote_version(fetch=False)
343                     Find  an  identifier  for the current revision on remote.
344                     Token spec might be a tagname,  version-id,  SHA-ID,  ...
345                     depending on the VCS implementation.
346
347                     Parameters
348                            fetch  --  if False, only local information may be
349                            used
350
351                     Returns
352                            current revision number of the remote repository.
353
354                     Return type
355                            str
356
357              get_status(basepath=None, untracked=False)
358                     Calls scm status command. Output must  be  terminated  by
359                     newline unless empty.
360
361                     Semantics  of  untracked are difficult to generalize.  In
362                     SVN, this would be new files only. In git, hg, bzr,  this
363                     would be changes that have not been added for commit.
364
365                     Extra  keyword arguments are passed along to the underly‐
366                     ing  vcs  code.   See  the  specific  implementations  of
367                     get_status() for extra options.
368
369                     Parameters
370
371                            · basepath  --  status  path  will  be relative to
372                              this, if any
373
374                            · untracked -- whether to also show  changes  that
375                              would not commit
376
377                     Returns
378                            A string summarizing locally modified files
379
380                     Return type
381                            str
382
383              get_url()
384
385                     Returns
386                            BZR  URL  of  the  branch (output of bzr info com‐
387                            mand),
388
389                     or None if it cannot be determined
390
391              get_version(spec=None)
392
393                     Parameters
394                            spec -- (optional) revisionspec  of  desired  ver‐
395                            sion.  May be any revisionspec as returned by 'bzr
396                            help revisionspec', e.g. a tagname or 'revno:<num‐
397                            ber>'
398
399                     Returns
400                            the  current revision number of the repository. Or
401                            if spec is provided,  the  number  of  a  revision
402                            specified by some token.
403
404              static static_detect_presence(path)
405                     For auto detection
406
407              update(version='', verbose=False, timeout=None)
408                     Sets the local copy of the repository to a version match‐
409                     ing the version parameter. Fails when  there  are  uncom‐
410                     mited  changes.   On failures (also e.g. network failure)
411                     grants the checked out files are in  the  same  state  as
412                     before  the call.  If a timeout is specified, any pending
413                     operation will fail after the specified amount  (in  sec‐
414                     onds)
415
416                     Parameters
417
418                            · version  --  token  for  identifying  repository
419                              revision desired.  Token  might  be  a  tagname,
420                              branchname, version-id, SHA-ID, ... depending on
421                              the VCS implementation.
422
423                            · timeout -- maximum  allocated  time  to  perform
424                              operation
425
426                     Returns
427                            True on success, False else
428
429              url_matches(url, url_or_shortcut)
430                     client  can  decide whether the url and the other url are
431                     equivalent.  Checks string  equality  by  default  :param
432                     url_or_shortcut: url or shortcut (e.g. bzr launchpad url)
433                     :returns: bool if params are equivalent
434
435       vcstools.bzr._get_bzr_version()
436              Looks up bzr version by calling bzr --version.  :raises:  VcsEr‐
437              ror if bzr is not installed
438
439   git Module
440       git vcs support.
441
442       refnames  in  git  can be branchnames, hashes, partial hashes, tags. On
443       checkout, git will disambiguate by checking them in that order,  taking
444       the first that applies
445
446       This  class  aims to provide git for linear centralized workflows. This
447       means in case of ambiguity, we assume that the only relevant remote  is
448       the  one  named  "origin",  and  we  assume that commits once on origin
449       remain on origin.
450
451       A challenge with git is that it has strong reasonable conventions,  but
452       is very allowing for breaking them. E.g. it is possible to name remotes
453       and branches with names like  "refs/heads/master",  give  branches  and
454       tags  the  same  name,  or  a valid SHA-ID as name, etc.  Similarly git
455       allows plenty of ways to reference any object, in case of  ambiguities,
456       git  attempts  to  take the most reasonable disambiguation, and in some
457       cases warns.
458
459       vcstools.git.GITClient
460              alias of vcstools.git.GitClient
461
462       class vcstools.git.GitClient(path)
463              Bases: vcstools.vcs_base.VcsClientBase
464
465              __init__(path)
466
467                     Raises VcsError if git not detected
468
469              _do_checkout(refname, fetch=True, verbose=False)
470                     meaning git checkout, not vcstools checkout.  This  works
471                     for  local  branches,  remote branches, tagnames, hashes,
472                     etc.  git will create local branch of same name  when  no
473                     such  local  branch  exists, and also setup tracking. Git
474                     decides with own rules whether local changes would  cause
475                     conflicts, and refuses to checkout else.
476
477                     Raises GitError -- when checkout fails
478
479              _do_fast_forward(branch_parent, fetch=True, verbose=False)
480                     Execute   git   fetch   if   necessary,  and  if  we  can
481                     fast-foward, do so to the last fetched version using  git
482                     rebase.
483
484                     Parameters
485
486                            · branch_parent -- name of branch we track
487
488                            · fetch  -- whether fetch should be done first for
489                              remote refs
490
491                     Returns
492                            True if up-to-date or after succesful fast-forward
493
494                     Raises GitError when git fetch fails
495
496              _do_fetch(timeout=None)
497                     calls git fetch :raises: GitError when call fails
498
499              _do_update(refname=None, verbose=False, fast_foward=True,  time‐
500              out=None, update_submodules=True)
501                     updates  without  fetching,  thus  any necessary fetching
502                     must be done before allows arguments to  reduce  unneces‐
503                     sary steps after checkout
504
505                     Parameters
506
507                            · fast_foward   --  if  false,  does  not  perform
508                              fast-forward
509
510                            · update_submodules -- if false, does not  attempt
511                              to update submodules
512
513              _get_branch()
514
515              _get_branch_parent(fetch=False, current_branch=None)
516
517                     Parameters
518
519                            · fetch -- if true, performs git fetch first
520
521                            · current_branch  --  if not None, this is used as
522                              current branch (else extra shell call)
523
524                     Returns
525                            (branch, remote)  the  name  of  the  branch  this
526                            branch tracks and its remote
527
528                     Raises GitError if fetch fails
529
530              _get_default_remote()
531                     in  order  to support users who name their default origin
532                     something else than origin, read remote name.
533
534              _is_commit_in_orphaned_subtree(version,         mask_self=False,
535              fetch=True)
536                     checks  git log --all (the list of all commits reached by
537                     references, meaning branches or tags) for version. If  it
538                     shows  up,  that  means  git  garbage collection will not
539                     remove the commit. Else it would eventually be deleted.
540
541                     Parameters
542
543                            · version  --  SHA  IDs  (if  partial,  caller  is
544                              responsible for mismatch)
545
546                            · mask_self  --  whether to consider direct refer‐
547                              ences to this commit (rather  than  only  refer‐
548                              ences on descendants) as well
549
550                            · fetch  -- whether fetch should be done first for
551                              remote refs
552
553                     Returns
554                            True if version is not recursively referenced by a
555                            branch or tag
556
557                     Raises GitError if git fetch fails
558
559              _is_local_branch(branch_name)
560
561              _is_remote_branch(branch_name, remote_name=None, fetch=True)
562                     checks  list  of  remote branches for match. Set fetch to
563                     False if you just fetched already.
564
565                     Returns
566                            True   if   branch_name    exists    for    remote
567                            <remote_name> (or 'origin' if None)
568
569                     Raises GitError when git fetch fails
570
571              _rev_list_contains(refname, version, fetch=True)
572                     calls  git rev-list with refname and returns True if ver‐
573                     sion can be found in rev-list result
574
575                     Parameters
576
577                            · refname -- a git refname
578
579                            · version -- an SHA IDs  (if  partial,  caller  is
580                              responsible for mismatch)
581
582                     Returns
583                            True if version is an ancestor commit from refname
584
585                     Raises GitError when call to git fetch fails
586
587              _update_submodules(verbose=False, timeout=None)
588
589              checkout(url,  version=None, verbose=False, shallow=False, time‐
590              out=None)
591                     calls  git  clone  and  then,  if  version   was   given,
592                     update(version)
593
594              export_repository(version, basepath)
595                     Calls  scm  equivalent  to  svn export, removing scm meta
596                     information and tar gzip'ing the repository  at  a  given
597                     version to the given basepath.
598
599                     Parameters
600                            version  --  version  of the repository to export.
601                            This can
602
603                     be a branch, tag, or path  (svn).   When  specifying  the
604                     version as a path for svn, the path should be relative to
605                     the  root  of  the  svn  repository,  i.e.  'trunk',   or
606                     'tags/1.2.3',  or  './'  for  the root.  :param basepath:
607                     this is the path to the tar gzip, excluding the extension
608                     which  will  be  .tar.gz :returns: True on success, False
609                     otherwise.
610
611              get_affected_files(revision)
612                     Get the files that were affected by a  specific  revision
613                     :param  revision:  SHA  or  revision number.  :returns: A
614                     list of strings with the files  affected  by  a  specific
615                     commit
616
617              get_branches(local_only=False)
618                     Returns a list of all branches in the vcs repository.
619
620                     Parameters
621                            local_only  --  if  True  it  will only list local
622                            branches
623
624                     Returns
625                            list of branches in the  repository,  []  if  none
626                            exist
627
628              get_current_version_label()
629                     For  git  we change the label to clarify when a different
630                     remote is configured.
631
632              get_default_remote_version_label()
633                     Find a label for the default branch  on  remote,  meaning
634                     the one that would be checked out on a clean checkout.
635
636                     Returns
637                            a label or None (if not applicable)
638
639                     Return type
640                            str
641
642              get_diff(basepath=None)
643
644                     Parameters
645                            basepath  --  diff paths will be relative to this,
646                            if any
647
648                     Returns
649                            A string showing local differences
650
651                     Return type
652                            str
653
654              static get_environment_metadata()
655                     For debugging purposes, returns a dict containing  infor‐
656                     mation about the environment, like the version of the SCM
657                     client, or version of libraries involved.   Suggest  con‐
658                     sidering  keywords  "version",  "dependency",  "features"
659                     first.  :returns: a dict containing relevant  information
660                     :rtype: dict
661
662              get_log(relpath=None, limit=None)
663                     Calls scm log command.
664
665                     This  returns  a  list of dictionaries with the following
666                     fields:
667
668                            · id: the commit SHA or revision number
669
670                            · date: the date the commit was made (python date‐
671                              time)
672
673                            · author: the name of the author of the commit, if
674                              available
675
676                            · email: the e-mail address of the author  of  the
677                              commit
678
679                            · message: the commit message, if any
680
681                     Parameters
682                            relpath  --  (optional) restrict logs to events on
683                            this
684
685                     resource path (folder or file) relative to  the  root  of
686                     the  repository.  If  None (default), this is the root of
687                     the repository.  :param  limit:  (optional)  the  maximum
688                     number  of  log entries that should be retrieved. If None
689                     (default), there is no limit.
690
691              get_remote_version(fetch=False)
692                     Find an identifier for the current  revision  on  remote.
693                     Token  spec  might  be a tagname, version-id, SHA-ID, ...
694                     depending on the VCS implementation.
695
696                     Parameters
697                            fetch -- if False, only local information  may  be
698                            used
699
700                     Returns
701                            current revision number of the remote repository.
702
703                     Return type
704                            str
705
706              get_status(basepath=None, untracked=False, porcelain=False)
707                     Calls  scm  status  command. Output must be terminated by
708                     newline unless empty.
709
710                     Semantics of untracked are difficult to  generalize.   In
711                     SVN,  this would be new files only. In git, hg, bzr, this
712                     would be changes that have not been added for commit.
713
714                     Extra keyword arguments are passed along to the  underly‐
715                     ing  vcs  code.   See  the  specific  implementations  of
716                     get_status() for extra options.
717
718                     Parameters
719
720                            · basepath -- status  path  will  be  relative  to
721                              this, if any
722
723                            · untracked  --  whether to also show changes that
724                              would not commit
725
726                     Returns
727                            A string summarizing locally modified files
728
729                     Return type
730                            str
731
732              get_url()
733
734                     Returns
735                            git URL of the directory path (output of git  info
736                            command), or None if it cannot be determined
737
738              get_version(spec=None)
739
740                     Parameters
741
742                            · spec  --  (optional)  token  to identify desired
743                              version. For git, this may be anything  accepted
744                              by  git  log,  e.g.  a  tagname,  branchname, or
745                              sha-id.
746
747                            · fetch -- When spec is given, can be used to sup‐
748                              press git fetch call
749
750                     Returns
751                            current  SHA-ID  of  the repository. Or if spec is
752                            provided, the SHA-ID of a commit specified by some
753                            token if found, else None
754
755              is_tag(tag_name, fetch=True)
756                     checks list of tags for match.  Set fetch to False if you
757                     just fetched already.
758
759                     Returns
760                            True if tag_name among known tags
761
762                     Raises GitError when call to git fetch fails
763
764              static static_detect_presence(path)
765                     For auto detection
766
767              update(version=None,  verbose=False,  force_fetch=False,   time‐
768              out=None)
769                     if  version  is  None,  attempts  fast-forwarding current
770                     branch, if any.
771
772                     Else interprets version as a local branch, remote branch,
773                     tagname, hash, etc.
774
775                     If  it is a branch, attempts to move to it unless already
776                     on it, and to fast-forward, unless not a tracking branch.
777                     Else go untracked on tag or whatever version is. Does not
778                     leave if current commit would become dangling.
779
780                     Returns
781                            True if already up-to-date with  remote  or  after
782                            successful fast_foward
783
784       exception vcstools.git.GitError
785              Bases: Exception
786
787       vcstools.git._get_git_version()
788              Looks up git version by calling git --version.
789
790              Raises VcsError if git is not installed or returns
791
792              something unexpected
793
794       vcstools.git._git_diff_path_submodule_change(diff, rel_path_prefix)
795              Parses git diff result and changes the filename prefixes.
796
797   hg Module
798       hg vcs support.
799
800       using ui object to redirect output into a string
801
802       vcstools.hg.HGClient
803              alias of vcstools.hg.HgClient
804
805       class vcstools.hg.HgClient(path)
806              Bases: vcstools.vcs_base.VcsClientBase
807
808              __init__(path)
809
810                     Raises VcsError if hg not detected
811
812              _do_pull(filter=False)
813
814              checkout(url,  version='',  verbose=False,  shallow=False, time‐
815              out=None)
816                     Attempts to create a local repository given a remote url.
817                     Fails  if  a  target  path  exists,  unless it's an empty
818                     directory.  If a version is provided, the  local  reposi‐
819                     tory  will  be  updated  to that revision. It is possible
820                     that after a failed call to checkout, a repository  still
821                     exists,  e.g. if an invalid revision was given.  If shal‐
822                     low is provided, the scm client may  checkout  less  than
823                     the  full  repository  history to save time / disk space.
824                     If a timeout is specified,  any  pending  operation  will
825                     fail  after the specified amount (in seconds). NOTE: this
826                     parameter might or might not be honored, depending on VCS
827                     client  implementation.   :param  url:  where to checkout
828                     from :type url: str :param version: token for identifying
829                     repository  revision  :type  version: str :param shallow:
830                     hint to checkout less than a full repository :type  shal‐
831                     low:  bool :param timeout: maximum allocated time to per‐
832                     form operation :type shallow: int :returns: True if  suc‐
833                     cessful
834
835              export_repository(version, basepath)
836                     Calls  scm  equivalent  to  svn export, removing scm meta
837                     information and tar gzip'ing the repository  at  a  given
838                     version to the given basepath.
839
840                     Parameters
841                            version  --  version  of the repository to export.
842                            This can
843
844                     be a branch, tag, or path  (svn).   When  specifying  the
845                     version as a path for svn, the path should be relative to
846                     the  root  of  the  svn  repository,  i.e.  'trunk',   or
847                     'tags/1.2.3',  or  './'  for  the root.  :param basepath:
848                     this is the path to the tar gzip, excluding the extension
849                     which  will  be  .tar.gz :returns: True on success, False
850                     otherwise.
851
852              get_affected_files(revision)
853                     Get the files that were affected by a  specific  revision
854                     :param  revision:  SHA  or  revision number.  :returns: A
855                     list of strings with the files  affected  by  a  specific
856                     commit
857
858              get_branch()
859
860              get_branches(local_only=False)
861                     Returns a list of all branches in the vcs repository.
862
863                     Parameters
864                            local_only  --  if  True  it  will only list local
865                            branches
866
867                     Returns
868                            list of branches in the  repository,  []  if  none
869                            exist
870
871              get_current_version_label()
872
873                     Parameters
874                            spec  --  (optional)  spec  can  be what 'svn info
875                            --help' allows, meaning a revnumber, {date}, HEAD,
876                            BASE, PREV, or COMMITTED.
877
878                     Returns
879                            current  revision  number of the repository. Or if
880                            spec provided, the number of a revision  specified
881                            by some token.
882
883              get_diff(basepath=None)
884
885                     Parameters
886                            basepath  --  diff paths will be relative to this,
887                            if any
888
889                     Returns
890                            A string showing local differences
891
892                     Return type
893                            str
894
895              static get_environment_metadata()
896                     For debugging purposes, returns a dict containing  infor‐
897                     mation about the environment, like the version of the SCM
898                     client, or version of libraries involved.   Suggest  con‐
899                     sidering  keywords  "version",  "dependency",  "features"
900                     first.  :returns: a dict containing relevant  information
901                     :rtype: dict
902
903              get_log(relpath=None, limit=None)
904                     Calls scm log command.
905
906                     This  returns  a  list of dictionaries with the following
907                     fields:
908
909                            · id: the commit SHA or revision number
910
911                            · date: the date the commit was made (python date‐
912                              time)
913
914                            · author: the name of the author of the commit, if
915                              available
916
917                            · email: the e-mail address of the author  of  the
918                              commit
919
920                            · message: the commit message, if any
921
922                     Parameters
923                            relpath  --  (optional) restrict logs to events on
924                            this
925
926                     resource path (folder or file) relative to  the  root  of
927                     the  repository.  If  None (default), this is the root of
928                     the repository.  :param  limit:  (optional)  the  maximum
929                     number  of  log entries that should be retrieved. If None
930                     (default), there is no limit.
931
932              get_remote_version(fetch=False)
933                     Find an identifier for the current  revision  on  remote.
934                     Token  spec  might  be a tagname, version-id, SHA-ID, ...
935                     depending on the VCS implementation.
936
937                     Parameters
938                            fetch -- if False, only local information  may  be
939                            used
940
941                     Returns
942                            current revision number of the remote repository.
943
944                     Return type
945                            str
946
947              get_status(basepath=None, untracked=False)
948                     Calls  scm  status  command. Output must be terminated by
949                     newline unless empty.
950
951                     Semantics of untracked are difficult to  generalize.   In
952                     SVN,  this would be new files only. In git, hg, bzr, this
953                     would be changes that have not been added for commit.
954
955                     Extra keyword arguments are passed along to the  underly‐
956                     ing  vcs  code.   See  the  specific  implementations  of
957                     get_status() for extra options.
958
959                     Parameters
960
961                            · basepath -- status  path  will  be  relative  to
962                              this, if any
963
964                            · untracked  --  whether to also show changes that
965                              would not commit
966
967                     Returns
968                            A string summarizing locally modified files
969
970                     Return type
971                            str
972
973              get_url()
974
975                     Returns
976                            HG URL of the directory path. (output of hg paths
977
978                     command), or None if it cannot be determined
979
980              get_version(spec=None)
981
982                     Parameters
983                            spec -- (optional) token for identifying  version.
984                            spec  can be a whatever is allowed by 'hg log -r',
985                            e.g. a tagname, sha-ID, revision-number
986
987                     Returns
988                            the current SHA-ID of the repository. Or  if  spec
989                            is provided, the SHA-ID of a revision specified by
990                            some token.
991
992              static static_detect_presence(path)
993                     For auto detection
994
995              update(version='', verbose=False, timeout=None)
996                     Sets the local copy of the repository to a version match‐
997                     ing  the  version  parameter. Fails when there are uncom‐
998                     mited changes.  On failures (also e.g.  network  failure)
999                     grants  the  checked  out  files are in the same state as
1000                     before the call.  If a timeout is specified, any  pending
1001                     operation  will  fail after the specified amount (in sec‐
1002                     onds)
1003
1004                     Parameters
1005
1006                            · version  --  token  for  identifying  repository
1007                              revision  desired.   Token  might  be a tagname,
1008                              branchname, version-id, SHA-ID, ... depending on
1009                              the VCS implementation.
1010
1011                            · timeout  --  maximum  allocated  time to perform
1012                              operation
1013
1014                     Returns
1015                            True on success, False else
1016
1017       vcstools.hg._get_hg_version()
1018              Looks up hg version by calling hg --version.  :raises:  VcsError
1019              if hg is not installed
1020
1021       vcstools.hg._hg_diff_path_change(diff, path)
1022              Parses hg diff result and changes the filename prefixes.
1023
1024   svn Module
1025       svn vcs support.
1026
1027       vcstools.svn.SVNClient
1028              alias of vcstools.svn.SvnClient
1029
1030       class vcstools.svn.SvnClient(path)
1031              Bases: vcstools.vcs_base.VcsClientBase
1032
1033              __init__(path)
1034
1035                     Raises VcsError if python-svn not detected
1036
1037              _get_version_from_path(spec=None, path=None)
1038
1039                     Parameters
1040
1041                            · spec  --  (optional)  spec can be what 'svn info
1042                              --help' allows,  meaning  a  revnumber,  {date},
1043                              HEAD, BASE, PREV, or COMMITTED.
1044
1045                            · path -- the url to use, default is for this repo
1046
1047                     Returns
1048                            current  revision  number of the repository. Or if
1049                            spec provided, the number of a revision  specified
1050                            by some token.
1051
1052              checkout(url,  version='',  verbose=False,  shallow=False, time‐
1053              out=None)
1054                     Attempts to create a local repository given a remote url.
1055                     Fails  if  a  target  path  exists,  unless it's an empty
1056                     directory.  If a version is provided, the  local  reposi‐
1057                     tory  will  be  updated  to that revision. It is possible
1058                     that after a failed call to checkout, a repository  still
1059                     exists,  e.g. if an invalid revision was given.  If shal‐
1060                     low is provided, the scm client may  checkout  less  than
1061                     the  full  repository  history to save time / disk space.
1062                     If a timeout is specified,  any  pending  operation  will
1063                     fail  after the specified amount (in seconds). NOTE: this
1064                     parameter might or might not be honored, depending on VCS
1065                     client  implementation.   :param  url:  where to checkout
1066                     from :type url: str :param version: token for identifying
1067                     repository  revision  :type  version: str :param shallow:
1068                     hint to checkout less than a full repository :type  shal‐
1069                     low:  bool :param timeout: maximum allocated time to per‐
1070                     form operation :type shallow: int :returns: True if  suc‐
1071                     cessful
1072
1073              export_repository(version, basepath)
1074                     Calls  scm  equivalent  to  svn export, removing scm meta
1075                     information and tar gzip'ing the repository  at  a  given
1076                     version to the given basepath.
1077
1078                     Parameters
1079                            version  --  version  of the repository to export.
1080                            This can
1081
1082                     be a branch, tag, or path  (svn).   When  specifying  the
1083                     version as a path for svn, the path should be relative to
1084                     the  root  of  the  svn  repository,  i.e.  'trunk',   or
1085                     'tags/1.2.3',  or  './'  for  the root.  :param basepath:
1086                     this is the path to the tar gzip, excluding the extension
1087                     which  will  be  .tar.gz :returns: True on success, False
1088                     otherwise.
1089
1090              get_affected_files(revision)
1091                     Get the files that were affected by a  specific  revision
1092                     :param  revision:  SHA  or  revision number.  :returns: A
1093                     list of strings with the files  affected  by  a  specific
1094                     commit
1095
1096              get_branches(local_only=False)
1097                     Returns a list of all branches in the vcs repository.
1098
1099                     Parameters
1100                            local_only  --  if  True  it  will only list local
1101                            branches
1102
1103                     Returns
1104                            list of branches in the  repository,  []  if  none
1105                            exist
1106
1107              get_current_version_label()
1108                     Find an description for the current local version.  Token
1109                     spec might  be  a  branchname,  version-id,  SHA-ID,  ...
1110                     depending on the VCS implementation.
1111
1112                     Returns
1113                            short  description  of local version (e.g. branch‐
1114                            name, tagename).
1115
1116                     Return type
1117                            str
1118
1119              get_diff(basepath=None)
1120
1121                     Parameters
1122                            basepath -- diff paths will be relative  to  this,
1123                            if any
1124
1125                     Returns
1126                            A string showing local differences
1127
1128                     Return type
1129                            str
1130
1131              static get_environment_metadata()
1132                     For  debugging purposes, returns a dict containing infor‐
1133                     mation about the environment, like the version of the SCM
1134                     client,  or  version of libraries involved.  Suggest con‐
1135                     sidering  keywords  "version",  "dependency",  "features"
1136                     first.   :returns: a dict containing relevant information
1137                     :rtype: dict
1138
1139              get_log(relpath=None, limit=None)
1140                     Calls scm log command.
1141
1142                     This returns a list of dictionaries  with  the  following
1143                     fields:
1144
1145                            · id: the commit SHA or revision number
1146
1147                            · date: the date the commit was made (python date‐
1148                              time)
1149
1150                            · author: the name of the author of the commit, if
1151                              available
1152
1153                            · email:  the  e-mail address of the author of the
1154                              commit
1155
1156                            · message: the commit message, if any
1157
1158                     Parameters
1159                            relpath -- (optional) restrict logs to  events  on
1160                            this
1161
1162                     resource  path  (folder  or file) relative to the root of
1163                     the repository. If None (default), this is  the  root  of
1164                     the  repository.   :param  limit:  (optional) the maximum
1165                     number of log entries that should be retrieved.  If  None
1166                     (default), there is no limit.
1167
1168              get_remote_version(fetch=False)
1169                     Find  an  identifier  for the current revision on remote.
1170                     Token spec might be a tagname,  version-id,  SHA-ID,  ...
1171                     depending on the VCS implementation.
1172
1173                     Parameters
1174                            fetch  --  if False, only local information may be
1175                            used
1176
1177                     Returns
1178                            current revision number of the remote repository.
1179
1180                     Return type
1181                            str
1182
1183              get_status(basepath=None, untracked=False)
1184                     Calls scm status command. Output must  be  terminated  by
1185                     newline unless empty.
1186
1187                     Semantics  of  untracked are difficult to generalize.  In
1188                     SVN, this would be new files only. In git, hg, bzr,  this
1189                     would be changes that have not been added for commit.
1190
1191                     Extra  keyword arguments are passed along to the underly‐
1192                     ing  vcs  code.   See  the  specific  implementations  of
1193                     get_status() for extra options.
1194
1195                     Parameters
1196
1197                            · basepath  --  status  path  will  be relative to
1198                              this, if any
1199
1200                            · untracked -- whether to also show  changes  that
1201                              would not commit
1202
1203                     Returns
1204                            A string summarizing locally modified files
1205
1206                     Return type
1207                            str
1208
1209              get_url()
1210
1211                     Returns
1212                            SVN  URL of the directory path (output of svn info
1213                            command), or None if it cannot be determined
1214
1215              get_version(spec=None)
1216
1217                     Parameters
1218
1219                            · spec -- (optional) spec can be  what  'svn  info
1220                              --help'  allows,  meaning  a  revnumber, {date},
1221                              HEAD, BASE, PREV, or COMMITTED.
1222
1223                            · path -- the url to use, default is for this repo
1224
1225                     Returns
1226                            current revision number of the repository.  Or  if
1227                            spec  provided, the number of a revision specified
1228                            by some token.
1229
1230              static static_detect_presence(path)
1231                     For auto detection
1232
1233              update(version=None, verbose=False, timeout=None)
1234                     Sets the local copy of the repository to a version match‐
1235                     ing  the  version  parameter. Fails when there are uncom‐
1236                     mited changes.  On failures (also e.g.  network  failure)
1237                     grants  the  checked  out  files are in the same state as
1238                     before the call.  If a timeout is specified, any  pending
1239                     operation  will  fail after the specified amount (in sec‐
1240                     onds)
1241
1242                     Parameters
1243
1244                            · version  --  token  for  identifying  repository
1245                              revision  desired.   Token  might  be a tagname,
1246                              branchname, version-id, SHA-ID, ... depending on
1247                              the VCS implementation.
1248
1249                            · timeout  --  maximum  allocated  time to perform
1250                              operation
1251
1252                     Returns
1253                            True on success, False else
1254
1255       vcstools.svn._get_svn_version()
1256              Looks up svn version by calling svn --version.  :raises:  VcsEr‐
1257              ror if svn is not installed
1258
1259       vcstools.svn.canonical_svn_url_split(url)
1260              checks  url  for  traces  of canonical svn structure, and return
1261              root, type, name (of tag or branch), subfolder, query and  frag‐
1262              ment  (see urllib urlparse) This should allow creating a differ‐
1263              ent url for switching to a different tag or branch
1264
1265              Parameters
1266                     url -- location of central repo, str
1267
1268              Returns
1269                     dict {root, type, name, subfolder, query, fragment}
1270
1271              with type one of "trunk", "tags", "branches"
1272
1273       vcstools.svn.get_remote_contents(url)
1274
1275   tar Module
1276       tar vcs support.
1277
1278       The implementation uses the "version" argument to indicate a  subfolder
1279       within  a  tarfile.   Hence  one  can  organize sources by creating one
1280       tarfile with a folder inside for each version.
1281
1282       vcstools.tar.TARClient
1283              alias of vcstools.tar.TarClient
1284
1285       class vcstools.tar.TarClient(path)
1286              Bases: vcstools.vcs_base.VcsClientBase
1287
1288              __init__(path)
1289                     @raise VcsError if tar not detected
1290
1291              checkout(url, version='',  verbose=False,  shallow=False,  time‐
1292              out=None)
1293                     untars  tar  at  url to self.path.  If version was given,
1294                     only the subdirectory 'version' of the tar will end up in
1295                     self.path.   Also  creates  a  file  next to the checkout
1296                     named
1297                     *
1298                     .tar which is a yaml file listing origin url and  version
1299                     arguments.
1300
1301              export_repository(version, basepath)
1302                     Calls  scm  equivalent  to  svn export, removing scm meta
1303                     information and tar gzip'ing the repository  at  a  given
1304                     version to the given basepath.
1305
1306                     Parameters
1307                            version  --  version  of the repository to export.
1308                            This can
1309
1310                     be a branch, tag, or path  (svn).   When  specifying  the
1311                     version as a path for svn, the path should be relative to
1312                     the  root  of  the  svn  repository,  i.e.  'trunk',   or
1313                     'tags/1.2.3',  or  './'  for  the root.  :param basepath:
1314                     this is the path to the tar gzip, excluding the extension
1315                     which  will  be  .tar.gz :returns: True on success, False
1316                     otherwise.
1317
1318              get_current_version_label()
1319                     Find an description for the current local version.  Token
1320                     spec  might  be  a  branchname,  version-id,  SHA-ID, ...
1321                     depending on the VCS implementation.
1322
1323                     Returns
1324                            short description of local version  (e.g.  branch‐
1325                            name, tagename).
1326
1327                     Return type
1328                            str
1329
1330              get_diff(basepath=None)
1331
1332                     Parameters
1333                            basepath  --  diff paths will be relative to this,
1334                            if any
1335
1336                     Returns
1337                            A string showing local differences
1338
1339                     Return type
1340                            str
1341
1342              static get_environment_metadata()
1343                     For debugging purposes, returns a dict containing  infor‐
1344                     mation about the environment, like the version of the SCM
1345                     client, or version of libraries involved.   Suggest  con‐
1346                     sidering  keywords  "version",  "dependency",  "features"
1347                     first.  :returns: a dict containing relevant  information
1348                     :rtype: dict
1349
1350              get_remote_version(fetch=False)
1351                     Find  an  identifier  for the current revision on remote.
1352                     Token spec might be a tagname,  version-id,  SHA-ID,  ...
1353                     depending on the VCS implementation.
1354
1355                     Parameters
1356                            fetch  --  if False, only local information may be
1357                            used
1358
1359                     Returns
1360                            current revision number of the remote repository.
1361
1362                     Return type
1363                            str
1364
1365              get_status(basepath=None, untracked=False)
1366                     Calls scm status command. Output must  be  terminated  by
1367                     newline unless empty.
1368
1369                     Semantics  of  untracked are difficult to generalize.  In
1370                     SVN, this would be new files only. In git, hg, bzr,  this
1371                     would be changes that have not been added for commit.
1372
1373                     Extra  keyword arguments are passed along to the underly‐
1374                     ing  vcs  code.   See  the  specific  implementations  of
1375                     get_status() for extra options.
1376
1377                     Parameters
1378
1379                            · basepath  --  status  path  will  be relative to
1380                              this, if any
1381
1382                            · untracked -- whether to also show  changes  that
1383                              would not commit
1384
1385                     Returns
1386                            A string summarizing locally modified files
1387
1388                     Return type
1389                            str
1390
1391              get_url()
1392
1393                     Returns
1394                            TAR URL of the directory path (output of tar info
1395
1396                     command), or None if it cannot be determined
1397
1398              get_version(spec=None)
1399                     Find an identifier for a the current or a specified revi‐
1400                     sion. Token spec might be  a  tagname,  branchname,  ver‐
1401                     sion-id, SHA-ID, ... depending on the VCS implementation.
1402
1403                     Parameters
1404                            spec  (str)  --  token  for identifying repository
1405                            revision
1406
1407                     Returns
1408                            current revision number of the repository.  Or  if
1409                            spec is provided, the respective revision number.
1410
1411                     Return type
1412                            str
1413
1414              static static_detect_presence(path)
1415                     For auto detection
1416
1417              update(version='', verbose=False, timeout=None)
1418                     Does  nothing except returning true if tar exists in same
1419                     "version" as checked out with vcstools.
1420
1421   vcs_abstraction Module
1422       undoc-members
1423
1424       show-inheritance
1425
1426       vcstools.vcs_abstraction.VCSClient
1427              alias of vcstools.vcs_abstraction.VcsClient
1428
1429       class vcstools.vcs_abstraction.VcsClient(vcs_type, path)
1430              Bases: object
1431
1432              DEPRECATED API  for  interacting  with  source-controlled  paths
1433              independent of actual version-control implementation.
1434
1435              __init__(vcs_type, path)
1436                     Initialize  self.  See help(type(self)) for accurate sig‐
1437                     nature.
1438
1439       vcstools.vcs_abstraction.get_registered_vcs_types()
1440
1441              Returns
1442                     list of valid key to use as vcs_type
1443
1444       vcstools.vcs_abstraction.get_vcs(vcs_type)
1445              Returns the class interfacing with vcs of given type
1446
1447              Parameters
1448                     vcs_type -- id of the tpye, e.g. git, svn, hg, bzr
1449
1450              Returns
1451                     class extending VcsClientBase
1452
1453              Raises ValueError for unknown vcs_type
1454
1455       vcstools.vcs_abstraction.get_vcs_client(vcs_type, path)
1456              Returns a client with which to interact with the  vcs  at  given
1457              path
1458
1459              Parameters
1460                     vcs_type -- id of the tpye, e.g. git, svn, hg, bzr
1461
1462              Returns
1463                     instance of VcsClientBase
1464
1465              Raises ValueError for unknown vcs_type
1466
1467       vcstools.vcs_abstraction.register_vcs(vcs_type, clazz)
1468
1469              Parameters
1470
1471                     · vcs_type -- id, str
1472
1473                     · clazz -- class extending VcsClientBase
1474
1475   vcs_base Module
1476       vcs support library base class.
1477
1478       undoc-members
1479
1480       show-inheritance
1481
1482       class vcstools.vcs_base.VcsClientBase(vcs_type_name, path)
1483              Bases: object
1484
1485              parent class for all vcs clients, provides their public API
1486
1487              __init__(vcs_type_name, path)
1488                     subclasses  may raise VcsError when a dependency is miss‐
1489                     ing
1490
1491              checkout(url, version=None, verbose=False, shallow=False,  time‐
1492              out=None)
1493                     Attempts to create a local repository given a remote url.
1494                     Fails if a target  path  exists,  unless  it's  an  empty
1495                     directory.   If  a version is provided, the local reposi‐
1496                     tory will be updated to that  revision.  It  is  possible
1497                     that  after a failed call to checkout, a repository still
1498                     exists, e.g. if an invalid revision was given.  If  shal‐
1499                     low  is  provided,  the scm client may checkout less than
1500                     the full repository history to save time  /  disk  space.
1501                     If  a  timeout  is  specified, any pending operation will
1502                     fail after the specified amount (in seconds). NOTE:  this
1503                     parameter might or might not be honored, depending on VCS
1504                     client implementation.  :param  url:  where  to  checkout
1505                     from :type url: str :param version: token for identifying
1506                     repository revision :type version:  str  :param  shallow:
1507                     hint  to checkout less than a full repository :type shal‐
1508                     low: bool :param timeout: maximum allocated time to  per‐
1509                     form  operation :type shallow: int :returns: True if suc‐
1510                     cessful
1511
1512              detect_presence()
1513                     For auto detection
1514
1515              export_repository(version, basepath)
1516                     Calls scm equivalent to svn  export,  removing  scm  meta
1517                     information  and  tar  gzip'ing the repository at a given
1518                     version to the given basepath.
1519
1520                     Parameters
1521                            version -- version of the  repository  to  export.
1522                            This can
1523
1524                     be  a  branch,  tag,  or path (svn).  When specifying the
1525                     version as a path for svn, the path should be relative to
1526                     the   root  of  the  svn  repository,  i.e.  'trunk',  or
1527                     'tags/1.2.3', or './' for  the  root.   :param  basepath:
1528                     this is the path to the tar gzip, excluding the extension
1529                     which will be .tar.gz :returns: True  on  success,  False
1530                     otherwise.
1531
1532              get_affected_files(revision)
1533                     Get  the  files that were affected by a specific revision
1534                     :param revision: SHA or  revision  number.   :returns:  A
1535                     list  of  strings  with  the files affected by a specific
1536                     commit
1537
1538              get_branches(local_only=False)
1539                     Returns a list of all branches in the vcs repository.
1540
1541                     Parameters
1542                            local_only -- if True  it  will  only  list  local
1543                            branches
1544
1545                     Returns
1546                            list  of  branches  in  the repository, [] if none
1547                            exist
1548
1549              get_current_version_label()
1550                     Find an description for the current local version.  Token
1551                     spec  might  be  a  branchname,  version-id,  SHA-ID, ...
1552                     depending on the VCS implementation.
1553
1554                     Returns
1555                            short description of local version  (e.g.  branch‐
1556                            name, tagename).
1557
1558                     Return type
1559                            str
1560
1561              get_default_remote_version_label()
1562                     Find  a  label  for the default branch on remote, meaning
1563                     the one that would be checked out on a clean checkout.
1564
1565                     Returns
1566                            a label or None (if not applicable)
1567
1568                     Return type
1569                            str
1570
1571              get_diff(basepath=None)
1572
1573                     Parameters
1574                            basepath -- diff paths will be relative  to  this,
1575                            if any
1576
1577                     Returns
1578                            A string showing local differences
1579
1580                     Return type
1581                            str
1582
1583              static get_environment_metadata()
1584                     For  debugging purposes, returns a dict containing infor‐
1585                     mation about the environment, like the version of the SCM
1586                     client,  or  version of libraries involved.  Suggest con‐
1587                     sidering  keywords  "version",  "dependency",  "features"
1588                     first.   :returns: a dict containing relevant information
1589                     :rtype: dict
1590
1591              get_log(relpath=None, limit=None)
1592                     Calls scm log command.
1593
1594                     This returns a list of dictionaries  with  the  following
1595                     fields:
1596
1597                            · id: the commit SHA or revision number
1598
1599                            · date: the date the commit was made (python date‐
1600                              time)
1601
1602                            · author: the name of the author of the commit, if
1603                              available
1604
1605                            · email:  the  e-mail address of the author of the
1606                              commit
1607
1608                            · message: the commit message, if any
1609
1610                     Parameters
1611                            relpath -- (optional) restrict logs to  events  on
1612                            this
1613
1614                     resource  path  (folder  or file) relative to the root of
1615                     the repository. If None (default), this is  the  root  of
1616                     the  repository.   :param  limit:  (optional) the maximum
1617                     number of log entries that should be retrieved.  If  None
1618                     (default), there is no limit.
1619
1620              get_path()
1621                     returns the path this client was configured for
1622
1623              get_remote_version(fetch=False)
1624                     Find  an  identifier  for the current revision on remote.
1625                     Token spec might be a tagname,  version-id,  SHA-ID,  ...
1626                     depending on the VCS implementation.
1627
1628                     Parameters
1629                            fetch  --  if False, only local information may be
1630                            used
1631
1632                     Returns
1633                            current revision number of the remote repository.
1634
1635                     Return type
1636                            str
1637
1638              get_status(basepath=None, untracked=False, **kwargs)
1639                     Calls scm status command. Output must  be  terminated  by
1640                     newline unless empty.
1641
1642                     Semantics  of  untracked are difficult to generalize.  In
1643                     SVN, this would be new files only. In git, hg, bzr,  this
1644                     would be changes that have not been added for commit.
1645
1646                     Extra  keyword arguments are passed along to the underly‐
1647                     ing  vcs  code.   See  the  specific  implementations  of
1648                     get_status() for extra options.
1649
1650                     Parameters
1651
1652                            · basepath  --  status  path  will  be relative to
1653                              this, if any
1654
1655                            · untracked -- whether to also show  changes  that
1656                              would not commit
1657
1658                     Returns
1659                            A string summarizing locally modified files
1660
1661                     Return type
1662                            str
1663
1664              get_url()
1665
1666                     Returns
1667                            The source control url for the path or None if not
1668                            set
1669
1670                     Return type
1671                            str
1672
1673              get_vcs_type_name()
1674                     used when auto detected
1675
1676              get_version(spec=None)
1677                     Find an identifier for a the current or a specified revi‐
1678                     sion.  Token  spec  might  be a tagname, branchname, ver‐
1679                     sion-id, SHA-ID, ... depending on the VCS implementation.
1680
1681                     Parameters
1682                            spec (str) --  token  for  identifying  repository
1683                            revision
1684
1685                     Returns
1686                            current  revision number of the repository.  Or if
1687                            spec is provided, the respective revision number.
1688
1689                     Return type
1690                            str
1691
1692              path_exists()
1693                     helper function
1694
1695              static static_detect_presence(path)
1696                     For auto detection
1697
1698              update(version=None, verbose=False, timeout=None)
1699                     Sets the local copy of the repository to a version match‐
1700                     ing  the  version  parameter. Fails when there are uncom‐
1701                     mited changes.  On failures (also e.g.  network  failure)
1702                     grants  the  checked  out  files are in the same state as
1703                     before the call.  If a timeout is specified, any  pending
1704                     operation  will  fail after the specified amount (in sec‐
1705                     onds)
1706
1707                     Parameters
1708
1709                            · version  --  token  for  identifying  repository
1710                              revision  desired.   Token  might  be a tagname,
1711                              branchname, version-id, SHA-ID, ... depending on
1712                              the VCS implementation.
1713
1714                            · timeout  --  maximum  allocated  time to perform
1715                              operation
1716
1717                     Returns
1718                            True on success, False else
1719
1720              url_matches(url, url_or_shortcut)
1721                     client can decide whether the url and the other  url  are
1722                     equivalent.   Checks  string  equality  by default :param
1723                     url_or_shortcut: url or shortcut (e.g. bzr launchpad url)
1724                     :returns: bool if params are equivalent
1725
1726       exception vcstools.vcs_base.VcsError(value)
1727              Bases: Exception
1728
1729              To  be  thrown when an SCM Client faces a situation because of a
1730              violated assumption
1731
1732              __init__(value)
1733                     Initialize self.  See help(type(self)) for accurate  sig‐
1734                     nature.
1735
1736              __str__()
1737                     Return str(self).
1738
1739   Changelog
1740   Changelog
1741   0.1
1742   0.1.42
1743       · remove cosmic and disco until we have hosting for it
1744
1745   0.1.41
1746       · fix git submodule error due to lack of quoting
1747
1748       · Fix git update failure by refreshing git index before fast-forward
1749
1750       · Fix python3 incompatibility due to wrong use of urlopen
1751
1752       · Updating get_affected_files function by removing single quotes cover‐
1753         ing format (#129)
1754
1755       · Fix export_upstream for git submodules with relative urls. (#130)
1756
1757   0.1.40
1758       · Trivial style and testing changes
1759
1760   0.1.39
1761       · Added support for git submodule in export_repository
1762
1763       · Add Wily Xenial Yakkety
1764
1765       · Add get_affected_files for all vcss
1766
1767   0.1.38
1768       · Fixed test failures due to SVN 1.9.
1769
1770       · Added the get_default_remote_version_label() API  method  to  support
1771         changes in wstool.
1772
1773       · Renamed  some internal functions to have a leading _ to indicate that
1774         they are private.
1775
1776   0.1.37
1777       · Fix an issue where log were restricted to the named branch (hg).
1778
1779       · Fixed svn to use a global revision number rather than a  branch-local
1780         revision.
1781
1782       · Added  the  get_remote_version()  and get_current_version_label() API
1783         calls.
1784
1785       · Enhanced use of no_warn in run_shell_command().
1786
1787       · Fix get_version() to catch stderr.
1788
1789       · Added get_branches() API call.
1790
1791       · Fix some errors and warnings to output to stderr.
1792
1793       · Fix output to avoid extra newlines when show_stdout=True.
1794
1795   0.1.36
1796       · Updates to the release platforms (-lucid +utopic +vivid)
1797
1798       · Fix an issue with updating branches on git, see vcstools/wstool#25
1799
1800   0.1.31
1801       · Fix submodule support on checkout #71
1802
1803   0.1.30
1804       · use netrc to download tars from private repos,  also  will  work  for
1805         private rosinstall files
1806
1807       · Fix checks for empty repository #62
1808
1809   0.1.29
1810       · fix #57 shallow checkout of non-master breaks with git >= 1.8.0
1811
1812       · unit test fixes
1813
1814   0.1.28
1815       · test of new upload method
1816
1817   0.1.27
1818       · fix #51 hg status and diff dont work if workspace is inside hg repo
1819
1820       · fix  #47  several  performance  improvements  by  removing unecessary
1821         update actions after checkout
1822
1823       · fix #46 https tar download fails behind proxy
1824
1825       · fix #45 sometimes commands run forever
1826
1827       · fix #44 minor bug when checking out from repo with default branch not
1828         master
1829
1830       · fix #41 improvedAPI, get_vcs_client function part of vcstools module
1831
1832   0.1.26
1833       · fix  #38  git  commands  fail in local repositories with many (>2000)
1834         references
1835
1836       · fix #31 get_log() svn xml not available on Ubuntu Lucid (hg 1.4.2)
1837
1838       · fix #37 update() returns True even when fetch failed
1839
1840   0.1.25
1841       · minor bugfixes
1842
1843       · travis-ci config file
1844
1845       · fix unit tests for svn diff&status ordering changes
1846
1847       · deprecated VcsClient Class
1848
1849       · added get_log function
1850
1851   0.1.24
1852       · fix git update return value to False when fast-forward  not  possible
1853         due to diverge
1854
1855       · fix. svn certificate prompt invisible, svn checkout and update become
1856         verbose due to this
1857
1858   0.1.22
1859       · Changed the way that git implements detect_presence to fix a bug with
1860         submodules in newer versions of git
1861
1862       · fix for git single quotes on Windows
1863
1864       · minor internal api bug where a git function always returned True
1865
1866       · fix gub in svn export_repository
1867
1868   0.1.21
1869       · bugfix #66: hg http username prompt hidden
1870
1871       · add export_repository method to vcs_base and all implementations with
1872         tests
1873
1874       · bugfix #64: unicode decoding problems
1875
1876   0.1.20
1877       · rosws update –verbose for git prints small message when rebasing
1878
1879       · improved python3 compatibility
1880
1881   0.1.19
1882       · more python3 compatibility
1883
1884       · code style improved
1885
1886       · match_url to compare bzr shortcuts to real urls
1887
1888       · more unit tests
1889
1890       · get_status required to end with newline, to fix #55
1891
1892   0.1.18
1893       · added shallow flag to API, implemented for git
1894
1895   0.1.17
1896       · svn stdout output on get_version removed
1897
1898   0.1.16
1899       · All SCMs show some output when update caused changes
1900
1901       · All SCMs have verbose option to show all changes done on update
1902
1903       · bugfix for bazaar getUrl() being a joined abspath
1904
1905       · bugfix for not all output being shown when requested
1906
1907   0.1.15
1908       · Added pyyaml as a proper dependency, removed detection code.
1909
1910       · remove use of tar entirely, switch to tarfile module
1911
1912       · fix #36 allowing for tar being bsdtar on OSX
1913
1914   0.1.14
1915       · Added tarball uncompression.
1916
1917   0.1.13
1918       · added this changelog
1919
1920       · git get-version fetches only when local lookup fails
1921
1922       · hg get-version pulls if label not found
1923
1924       · Popen error message incudes cwd path
1925
1926   0.1.12
1927       · py_checker clean after all refactorings since 0.1.0
1928
1929   0.1.11
1930       · svn and hg update without user interaction
1931
1932       · bugfix #30
1933
1934       · minor bugfixes
1935
1936   0.1.10
1937       · minor bugs
1938
1939   0.1.9
1940       · safer sanitization of shell params
1941
1942       · git diff and stat recurse for submodules
1943
1944       · base class manages all calls to Popen
1945
1946   0.1.8
1947       · several bugfixes
1948
1949       · reverted using shell commands instead of bazaar API
1950
1951   0.1.7
1952       · reverted using shell commands instaed of pysvn and mercurial APIs
1953
1954       · protection against shell incection attempts
1955
1956   0.1.6
1957       · bugfixes to svn and bzr
1958
1959       · unified all calls through Popen
1960
1961   0.1.5
1962       · missing dependency to dateutil added
1963
1964   0.1.4
1965       switched shell calls to calls  to  python  API  of  mercurial,  bazaar,
1966       py-svn
1967
1968   0.1.3
1969       · fix #6
1970
1971   0.1.2
1972       · fix #15
1973
1974   0.1.1
1975       · more unit tests
1976
1977       · diverse bugfixes
1978
1979       · major   change   to   git   client   behavior,   based   around   git
1980         https://kforge.ros.org/vcstools/trac/ticket/1
1981
1982   0.1.0
1983       · documentation fixes
1984
1985   0.0.3
1986       · import from svn
1987
1988   Bug reports and feature requests
1989       · Submit a bug report
1990
1991   Developer Setup
1992       vcstools uses setuptools, which you will need to download  and  install
1993       in  order to run the packaging.  We use setuptools instead of distutils
1994       in order to be able use setup() keys like install_requires.
1995          cd vcstools python setup.py develop
1996
1997   Testing
1998       Install test dependencies
1999
2000          pip install nose
2001          pip install mock
2002
2003       vcstools uses Python nose for testing, which is  a  fairly  simple  and
2004       straightfoward  test  framework.   The  vcstools mainly use unittest to
2005       construct test fixtures, but with nose you can also just write a  func‐
2006       tion that starts with the name test and use normal assert statements.
2007
2008       vcstools also uses mock to create mocks for testing.
2009
2010       You can run the tests, including coverage, as follows:
2011
2012          cd vcstools
2013          make test
2014
2015   Documentation
2016       Sphinx  is  used  to provide API documentation for vcstools.  The docu‐
2017       ments are stored in the doc subdirectory.
2018
2019       · genindex
2020
2021       · modindex
2022
2023       · search
2024

AUTHOR

2026       Tully Foote, Thibault Kruse, Ken Conley
2027
2029       2019, Willow Garage
2030
2031
2032
2033
20340.1.42                           Oct 03, 2019                      VCSTOOLS(1)
Impressum