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
229              export_repository(version, basepath)
230
231              get_affected_files(revision)
232
233              get_branches(local_only=False)
234
235              get_current_version_label()
236
237              get_diff(basepath=None)
238
239              static get_environment_metadata()
240
241              get_log(relpath=None, limit=None)
242
243              get_remote_version(fetch=False)
244
245              get_status(basepath=None, untracked=False)
246
247              get_url()
248
249                     Returns
250                            BZR URL of the branch (output  of  bzr  info  com‐
251                            mand),
252
253                     or None if it cannot be determined
254
255              get_version(spec=None)
256
257                     Parameters
258                            spec  --  (optional)  revisionspec of desired ver‐
259                            sion.  May be any revisionspec as returned by 'bzr
260                            help revisionspec', e.g. a tagname or 'revno:<num‐
261                            ber>'
262
263                     Returns
264                            the current revision number of the repository.  Or
265                            if  spec  is  provided,  the  number of a revision
266                            specified by some token.
267
268              static static_detect_presence(path)
269
270              update(version=u'', verbose=False, timeout=None)
271
272              url_matches(url, url_or_shortcut)
273
274       vcstools.bzr._get_bzr_version()
275              Looks up bzr version by calling bzr --version.  :raises:  VcsEr‐
276              ror if bzr is not installed
277
278   git Module
279       git vcs support.
280
281       refnames  in  git  can be branchnames, hashes, partial hashes, tags. On
282       checkout, git will disambiguate by checking them in that order,  taking
283       the first that applies
284
285       This  class  aims to provide git for linear centralized workflows. This
286       means in case of ambiguity, we assume that the only relevant remote  is
287       the  one  named  "origin",  and  we  assume that commits once on origin
288       remain on origin.
289
290       A challenge with git is that it has strong reasonable conventions,  but
291       is very allowing for breaking them. E.g. it is possible to name remotes
292       and branches with names like  "refs/heads/master",  give  branches  and
293       tags  the  same  name,  or  a valid SHA-ID as name, etc.  Similarly git
294       allows plenty of ways to reference any object, in case of  ambiguities,
295       git  attempts  to  take the most reasonable disambiguation, and in some
296       cases warns.
297
298       vcstools.git.GITClient
299              alias of vcstools.git.GitClient
300
301       class vcstools.git.GitClient(path)
302              Bases: vcstools.vcs_base.VcsClientBase
303
304              __init__(path)
305
306                     Raises VcsError if git not detected
307
308              _do_checkout(refname, fetch=True, verbose=False)
309                     meaning git checkout, not vcstools checkout.  This  works
310                     for  local  branches,  remote branches, tagnames, hashes,
311                     etc.  git will create local branch of same name  when  no
312                     such  local  branch  exists, and also setup tracking. Git
313                     decides with own rules whether local changes would  cause
314                     conflicts, and refuses to checkout else.
315
316                     Raises GitError -- when checkout fails
317
318              _do_fast_forward(branch_parent, fetch=True, verbose=False)
319                     Execute   git   fetch   if   necessary,  and  if  we  can
320                     fast-foward, do so to the last fetched version using  git
321                     rebase.
322
323                     Parameters
324
325                            · branch_parent -- name of branch we track
326
327                            · fetch  -- whether fetch should be done first for
328                              remote refs
329
330                     Returns
331                            True if up-to-date or after succesful fast-forward
332
333                     Raises GitError when git fetch fails
334
335              _do_fetch(timeout=None)
336                     calls git fetch :raises: GitError when call fails
337
338              _do_update(refname=None, verbose=False, fast_foward=True,  time‐
339              out=None, update_submodules=True)
340                     updates  without  fetching,  thus  any necessary fetching
341                     must be done before allows arguments to  reduce  unneces‐
342                     sary steps after checkout
343
344                     Parameters
345
346                            · fast_foward   --  if  false,  does  not  perform
347                              fast-forward
348
349                            · update_submodules -- if false, does not  attempt
350                              to update submodules
351
352              _get_branch()
353
354              _get_branch_parent(fetch=False, current_branch=None)
355
356                     Parameters
357
358                            · fetch -- if true, performs git fetch first
359
360                            · current_branch  --  if not None, this is used as
361                              current branch (else extra shell call)
362
363                     Returns
364                            (branch, remote)  the  name  of  the  branch  this
365                            branch tracks and its remote
366
367                     Raises GitError if fetch fails
368
369              _get_default_remote()
370                     in  order  to support users who name their default origin
371                     something else than origin, read remote name.
372
373              _is_commit_in_orphaned_subtree(version,         mask_self=False,
374              fetch=True)
375                     checks  git log --all (the list of all commits reached by
376                     references, meaning branches or tags) for version. If  it
377                     shows  up,  that  means  git  garbage collection will not
378                     remove the commit. Else it would eventually be deleted.
379
380                     Parameters
381
382                            · version  --  SHA  IDs  (if  partial,  caller  is
383                              responsible for mismatch)
384
385                            · mask_self  --  whether to consider direct refer‐
386                              ences to this commit (rather  than  only  refer‐
387                              ences on descendants) as well
388
389                            · fetch  -- whether fetch should be done first for
390                              remote refs
391
392                     Returns
393                            True if version is not recursively referenced by a
394                            branch or tag
395
396                     Raises GitError if git fetch fails
397
398              _is_local_branch(branch_name)
399
400              _is_remote_branch(branch_name, remote_name=None, fetch=True)
401                     checks  list  of  remote branches for match. Set fetch to
402                     False if you just fetched already.
403
404                     Returns
405                            True   if   branch_name    exists    for    remote
406                            <remote_name> (or 'origin' if None)
407
408                     Raises GitError when git fetch fails
409
410              _rev_list_contains(refname, version, fetch=True)
411                     calls  git rev-list with refname and returns True if ver‐
412                     sion can be found in rev-list result
413
414                     Parameters
415
416                            · refname -- a git refname
417
418                            · version -- an SHA IDs  (if  partial,  caller  is
419                              responsible for mismatch)
420
421                     Returns
422                            True if version is an ancestor commit from refname
423
424                     Raises GitError when call to git fetch fails
425
426              _update_submodules(verbose=False, timeout=None)
427
428              checkout(url,  version=None, verbose=False, shallow=False, time‐
429              out=None)
430                     calls  git  clone  and  then,  if  version   was   given,
431                     update(version)
432
433              export_repository(version, basepath)
434
435              get_affected_files(revision)
436
437              get_branches(local_only=False)
438
439              get_current_version_label()
440                     For  git  we change the label to clarify when a different
441                     remote is configured.
442
443              get_default_remote_version_label()
444
445              get_diff(basepath=None)
446
447              static get_environment_metadata()
448
449              get_log(relpath=None, limit=None)
450
451              get_remote_version(fetch=False)
452
453              get_status(basepath=None, untracked=False, porcelain=False)
454
455              get_url()
456
457                     Returns
458                            git URL of the directory path (output of git  info
459                            command), or None if it cannot be determined
460
461              get_version(spec=None)
462
463                     Parameters
464
465                            · spec  --  (optional)  token  to identify desired
466                              version. For git, this may be anything  accepted
467                              by  git  log,  e.g.  a  tagname,  branchname, or
468                              sha-id.
469
470                            · fetch -- When spec is given, can be used to sup‐
471                              press git fetch call
472
473                     Returns
474                            current  SHA-ID  of  the repository. Or if spec is
475                            provided, the SHA-ID of a commit specified by some
476                            token if found, else None
477
478              is_tag(tag_name, fetch=True)
479                     checks list of tags for match.  Set fetch to False if you
480                     just fetched already.
481
482                     Returns
483                            True if tag_name among known tags
484
485                     Raises GitError when call to git fetch fails
486
487              static static_detect_presence(path)
488
489              update(version=None,  verbose=False,  force_fetch=False,   time‐
490              out=None)
491                     if  version  is  None,  attempts  fast-forwarding current
492                     branch, if any.
493
494                     Else interprets version as a local branch, remote branch,
495                     tagname, hash, etc.
496
497                     If  it is a branch, attempts to move to it unless already
498                     on it, and to fast-forward, unless not a tracking branch.
499                     Else go untracked on tag or whatever version is. Does not
500                     leave if current commit would become dangling.
501
502                     Returns
503                            True if already up-to-date with  remote  or  after
504                            successful fast_foward
505
506       exception vcstools.git.GitError
507              Bases: exceptions.Exception
508
509       vcstools.git._get_git_version()
510              Looks up git version by calling git --version.
511
512              Raises VcsError if git is not installed or returns
513
514              something unexpected
515
516       vcstools.git._git_diff_path_submodule_change(diff, rel_path_prefix)
517              Parses git diff result and changes the filename prefixes.
518
519   hg Module
520       hg vcs support.
521
522       using ui object to redirect output into a string
523
524       vcstools.hg.HGClient
525              alias of vcstools.hg.HgClient
526
527       class vcstools.hg.HgClient(path)
528              Bases: vcstools.vcs_base.VcsClientBase
529
530              __init__(path)
531
532                     Raises VcsError if hg not detected
533
534              _do_pull(filter=False)
535
536              checkout(url,  version=u'',  verbose=False, shallow=False, time‐
537              out=None)
538
539              export_repository(version, basepath)
540
541              get_affected_files(revision)
542
543              get_branch()
544
545              get_branches(local_only=False)
546
547              get_current_version_label()
548
549                     Parameters
550                            spec -- (optional) spec  can  be  what  'svn  info
551                            --help' allows, meaning a revnumber, {date}, HEAD,
552                            BASE, PREV, or COMMITTED.
553
554                     Returns
555                            current revision number of the repository.  Or  if
556                            spec  provided, the number of a revision specified
557                            by some token.
558
559              get_diff(basepath=None)
560
561              static get_environment_metadata()
562
563              get_log(relpath=None, limit=None)
564
565              get_remote_version(fetch=False)
566
567              get_status(basepath=None, untracked=False)
568
569              get_url()
570
571                     Returns
572                            HG URL of the directory path. (output of hg paths
573
574                     command), or None if it cannot be determined
575
576              get_version(spec=None)
577
578                     Parameters
579                            spec -- (optional) token for identifying  version.
580                            spec  can be a whatever is allowed by 'hg log -r',
581                            e.g. a tagname, sha-ID, revision-number
582
583                     Returns
584                            the current SHA-ID of the repository. Or  if  spec
585                            is provided, the SHA-ID of a revision specified by
586                            some token.
587
588              static static_detect_presence(path)
589
590              update(version=u'', verbose=False, timeout=None)
591
592       vcstools.hg._get_hg_version()
593              Looks up hg version by calling hg --version.  :raises:  VcsError
594              if hg is not installed
595
596       vcstools.hg._hg_diff_path_change(diff, path)
597              Parses hg diff result and changes the filename prefixes.
598
599   svn Module
600       svn vcs support.
601
602       vcstools.svn.SVNClient
603              alias of vcstools.svn.SvnClient
604
605       class vcstools.svn.SvnClient(path)
606              Bases: vcstools.vcs_base.VcsClientBase
607
608              __init__(path)
609
610                     Raises VcsError if python-svn not detected
611
612              _get_version_from_path(spec=None, path=None)
613
614                     Parameters
615
616                            · spec  --  (optional)  spec can be what 'svn info
617                              --help' allows,  meaning  a  revnumber,  {date},
618                              HEAD, BASE, PREV, or COMMITTED.
619
620                            · path -- the url to use, default is for this repo
621
622                     Returns
623                            current  revision  number of the repository. Or if
624                            spec provided, the number of a revision  specified
625                            by some token.
626
627              checkout(url,  version=u'',  verbose=False, shallow=False, time‐
628              out=None)
629
630              export_repository(version, basepath)
631
632              get_affected_files(revision)
633
634              get_branches(local_only=False)
635
636              get_current_version_label()
637
638              get_diff(basepath=None)
639
640              static get_environment_metadata()
641
642              get_log(relpath=None, limit=None)
643
644              get_remote_version(fetch=False)
645
646              get_status(basepath=None, untracked=False)
647
648              get_url()
649
650                     Returns
651                            SVN URL of the directory path (output of svn  info
652                            command), or None if it cannot be determined
653
654              get_version(spec=None)
655
656                     Parameters
657
658                            · spec  --  (optional)  spec can be what 'svn info
659                              --help' allows,  meaning  a  revnumber,  {date},
660                              HEAD, BASE, PREV, or COMMITTED.
661
662                            · path -- the url to use, default is for this repo
663
664                     Returns
665                            current  revision  number of the repository. Or if
666                            spec provided, the number of a revision  specified
667                            by some token.
668
669              static static_detect_presence(path)
670
671              update(version=None, verbose=False, timeout=None)
672
673       vcstools.svn._get_svn_version()
674              Looks  up svn version by calling svn --version.  :raises: VcsEr‐
675              ror if svn is not installed
676
677       vcstools.svn.canonical_svn_url_split(url)
678              checks url for traces of canonical  svn  structure,  and  return
679              root,  type, name (of tag or branch), subfolder, query and frag‐
680              ment (see urllib urlparse) This should allow creating a  differ‐
681              ent url for switching to a different tag or branch
682
683              Parameters
684                     url -- location of central repo, str
685
686              Returns
687                     dict {root, type, name, subfolder, query, fragment}
688
689              with type one of "trunk", "tags", "branches"
690
691       vcstools.svn.get_remote_contents(url)
692
693   tar Module
694       tar vcs support.
695
696       The  implementation uses the "version" argument to indicate a subfolder
697       within a tarfile.  Hence one  can  organize  sources  by  creating  one
698       tarfile with a folder inside for each version.
699
700       vcstools.tar.TARClient
701              alias of vcstools.tar.TarClient
702
703       class vcstools.tar.TarClient(path)
704              Bases: vcstools.vcs_base.VcsClientBase
705
706              __init__(path)
707                     @raise VcsError if tar not detected
708
709              checkout(url,  version=u'',  verbose=False, shallow=False, time‐
710              out=None)
711                     untars tar at url to self.path.  If  version  was  given,
712                     only the subdirectory 'version' of the tar will end up in
713                     self.path.  Also creates a  file  next  to  the  checkout
714                     named
715                     *
716                     .tar  which is a yaml file listing origin url and version
717                     arguments.
718
719              export_repository(version, basepath)
720
721              get_current_version_label()
722
723              get_diff(basepath=None)
724
725              static get_environment_metadata()
726
727              get_remote_version(fetch=False)
728
729              get_status(basepath=None, untracked=False)
730
731              get_url()
732
733                     Returns
734                            TAR URL of the directory path (output of tar info
735
736                     command), or None if it cannot be determined
737
738              get_version(spec=None)
739
740              static static_detect_presence(path)
741
742              update(version=u'', verbose=False, timeout=None)
743                     Does nothing except returning true if tar exists in  same
744                     "version" as checked out with vcstools.
745
746   vcs_abstraction Module
747       undoc-members
748
749       show-inheritance
750
751       vcstools.vcs_abstraction.VCSClient
752              alias of vcstools.vcs_abstraction.VcsClient
753
754       class vcstools.vcs_abstraction.VcsClient(vcs_type, path)
755              Bases: object
756
757              DEPRECATED  API  for  interacting  with  source-controlled paths
758              independent of actual version-control implementation.
759
760              __init__(vcs_type, path)
761                     x.__init__(...) initializes x; see help(type(x)) for sig‐
762                     nature
763
764       vcstools.vcs_abstraction.get_registered_vcs_types()
765
766              Returns
767                     list of valid key to use as vcs_type
768
769       vcstools.vcs_abstraction.get_vcs(vcs_type)
770              Returns the class interfacing with vcs of given type
771
772              Parameters
773                     vcs_type -- id of the tpye, e.g. git, svn, hg, bzr
774
775              Returns
776                     class extending VcsClientBase
777
778              Raises ValueError for unknown vcs_type
779
780       vcstools.vcs_abstraction.get_vcs_client(vcs_type, path)
781              Returns  a  client  with which to interact with the vcs at given
782              path
783
784              Parameters
785                     vcs_type -- id of the tpye, e.g. git, svn, hg, bzr
786
787              Returns
788                     instance of VcsClientBase
789
790              Raises ValueError for unknown vcs_type
791
792       vcstools.vcs_abstraction.register_vcs(vcs_type, clazz)
793
794              Parameters
795
796                     · vcs_type -- id, str
797
798                     · clazz -- class extending VcsClientBase
799
800   vcs_base Module
801       vcs support library base class.
802
803       undoc-members
804
805       show-inheritance
806
807       class vcstools.vcs_base.VcsClientBase(vcs_type_name, path)
808              Bases: object
809
810              parent class for all vcs clients, provides their public API
811
812              __init__(vcs_type_name, path)
813                     subclasses may raise VcsError when a dependency is  miss‐
814                     ing
815
816              checkout(url,  version=None, verbose=False, shallow=False, time‐
817              out=None)
818                     Attempts to create a local repository given a remote url.
819                     Fails  if  a  target  path  exists,  unless it's an empty
820                     directory.  If a version is provided, the  local  reposi‐
821                     tory  will  be  updated  to that revision. It is possible
822                     that after a failed call to checkout, a repository  still
823                     exists,  e.g. if an invalid revision was given.  If shal‐
824                     low is provided, the scm client may  checkout  less  than
825                     the  full  repository  history to save time / disk space.
826                     If a timeout is specified,  any  pending  operation  will
827                     fail  after the specified amount (in seconds). NOTE: this
828                     parameter might or might not be honored, depending on VCS
829                     client  implementation.   :param  url:  where to checkout
830                     from :type url: str :param version: token for identifying
831                     repository  revision  :type  version: str :param shallow:
832                     hint to checkout less than a full repository :type  shal‐
833                     low:  bool :param timeout: maximum allocated time to per‐
834                     form operation :type shallow: int :returns: True if  suc‐
835                     cessful
836
837              detect_presence()
838                     For auto detection
839
840              export_repository(version, basepath)
841                     Calls  scm  equivalent  to  svn export, removing scm meta
842                     information and tar gzip'ing the repository  at  a  given
843                     version to the given basepath.
844
845                     Parameters
846                            version  --  version  of the repository to export.
847                            This can
848
849                     be a branch, tag, or path  (svn).   When  specifying  the
850                     version as a path for svn, the path should be relative to
851                     the  root  of  the  svn  repository,  i.e.  'trunk',   or
852                     'tags/1.2.3',  or  './'  for  the root.  :param basepath:
853                     this is the path to the tar gzip, excluding the extension
854                     which  will  be  .tar.gz :returns: True on success, False
855                     otherwise.
856
857              get_affected_files(revision)
858                     Get the files that were affected by a  specific  revision
859                     :param  revision:  SHA  or  revision number.  :returns: A
860                     list of strings with the files  affected  by  a  specific
861                     commit
862
863              get_branches(local_only=False)
864                     Returns a list of all branches in the vcs repository.
865
866                     Parameters
867                            local_only  --  if  True  it  will only list local
868                            branches
869
870                     Returns
871                            list of branches in the  repository,  []  if  none
872                            exist
873
874              get_current_version_label()
875                     Find an description for the current local version.  Token
876                     spec might  be  a  branchname,  version-id,  SHA-ID,  ...
877                     depending on the VCS implementation.
878
879                     Returns
880                            short  description  of local version (e.g. branch‐
881                            name, tagename).
882
883                     Return type
884                            str
885
886              get_default_remote_version_label()
887                     Find a label for the default branch  on  remote,  meaning
888                     the one that would be checked out on a clean checkout.
889
890                     Returns
891                            a label or None (if not applicable)
892
893                     Return type
894                            str
895
896              get_diff(basepath=None)
897
898                     Parameters
899                            basepath  --  diff paths will be relative to this,
900                            if any
901
902                     Returns
903                            A string showing local differences
904
905                     Return type
906                            str
907
908              static get_environment_metadata()
909                     For debugging purposes, returns a dict containing  infor‐
910                     mation about the environment, like the version of the SCM
911                     client, or version of libraries involved.   Suggest  con‐
912                     sidering  keywords  "version",  "dependency",  "features"
913                     first.  :returns: a dict containing relevant  information
914                     :rtype: dict
915
916              get_log(relpath=None, limit=None)
917                     Calls scm log command.
918
919                     This  returns  a  list of dictionaries with the following
920                     fields:
921
922                            · id: the commit SHA or revision number
923
924                            · date: the date the commit was made (python date‐
925                              time)
926
927                            · author: the name of the author of the commit, if
928                              available
929
930                            · email: the e-mail address of the author  of  the
931                              commit
932
933                            · message: the commit message, if any
934
935                     Parameters
936                            relpath  --  (optional) restrict logs to events on
937                            this
938
939                     resource path (folder or file) relative to  the  root  of
940                     the  repository.  If  None (default), this is the root of
941                     the repository.  :param  limit:  (optional)  the  maximum
942                     number  of  log entries that should be retrieved. If None
943                     (default), there is no limit.
944
945              get_path()
946                     returns the path this client was configured for
947
948              get_remote_version(fetch=False)
949                     Find an identifier for the current  revision  on  remote.
950                     Token  spec  might  be a tagname, version-id, SHA-ID, ...
951                     depending on the VCS implementation.
952
953                     Parameters
954                            fetch -- if False, only local information  may  be
955                            used
956
957                     Returns
958                            current revision number of the remote repository.
959
960                     Return type
961                            str
962
963              get_status(basepath=None, untracked=False, **kwargs)
964                     Calls  scm  status  command. Output must be terminated by
965                     newline unless empty.
966
967                     Semantics of untracked are difficult to  generalize.   In
968                     SVN,  this would be new files only. In git, hg, bzr, this
969                     would be changes that have not been added for commit.
970
971                     Extra keyword arguments are passed along to the  underly‐
972                     ing  vcs  code.   See  the  specific  implementations  of
973                     get_status() for extra options.
974
975                     Parameters
976
977                            · basepath -- status  path  will  be  relative  to
978                              this, if any
979
980                            · untracked  --  whether to also show changes that
981                              would not commit
982
983                     Returns
984                            A string summarizing locally modified files
985
986                     Return type
987                            str
988
989              get_url()
990
991                     Returns
992                            The source control url for the path or None if not
993                            set
994
995                     Return type
996                            str
997
998              get_vcs_type_name()
999                     used when auto detected
1000
1001              get_version(spec=None)
1002                     Find an identifier for a the current or a specified revi‐
1003                     sion. Token spec might be  a  tagname,  branchname,  ver‐
1004                     sion-id, SHA-ID, ... depending on the VCS implementation.
1005
1006                     Parameters
1007                            spec  (str)  --  token  for identifying repository
1008                            revision
1009
1010                     Returns
1011                            current revision number of the repository.  Or  if
1012                            spec is provided, the respective revision number.
1013
1014                     Return type
1015                            str
1016
1017              path_exists()
1018                     helper function
1019
1020              static static_detect_presence(path)
1021                     For auto detection
1022
1023              update(version=None, verbose=False, timeout=None)
1024                     Sets the local copy of the repository to a version match‐
1025                     ing the version parameter. Fails when  there  are  uncom‐
1026                     mited  changes.   On failures (also e.g. network failure)
1027                     grants the checked out files are in  the  same  state  as
1028                     before  the call.  If a timeout is specified, any pending
1029                     operation will fail after the specified amount  (in  sec‐
1030                     onds)
1031
1032                     Parameters
1033
1034                            · version  --  token  for  identifying  repository
1035                              revision desired.  Token  might  be  a  tagname,
1036                              branchname, version-id, SHA-ID, ... depending on
1037                              the VCS implementation.
1038
1039                            · timeout -- maximum  allocated  time  to  perform
1040                              operation
1041
1042                     Returns
1043                            True on success, False else
1044
1045              url_matches(url, url_or_shortcut)
1046                     client  can  decide whether the url and the other url are
1047                     equivalent.  Checks string  equality  by  default  :param
1048                     url_or_shortcut: url or shortcut (e.g. bzr launchpad url)
1049                     :returns: bool if params are equivalent
1050
1051       exception vcstools.vcs_base.VcsError(value)
1052              Bases: exceptions.Exception
1053
1054              To be thrown when an SCM Client faces a situation because  of  a
1055              violated assumption
1056
1057              __init__(value)
1058                     x.__init__(...) initializes x; see help(type(x)) for sig‐
1059                     nature
1060
1061              __str__() <==> str(x)
1062
1063   Changelog
1064   Changelog
1065   0.1
1066   0.1.40
1067       · Trivial style and testing changes
1068
1069   0.1.39
1070       · Added support for git submodule in export_repository
1071
1072       · Add Wily Xenial Yakkety
1073
1074       · Add get_affected_files for all vcss
1075
1076   0.1.38
1077       · Fixed test failures due to SVN 1.9.
1078
1079       · Added the get_default_remote_version_label() API  method  to  support
1080         changes in wstool.
1081
1082       · Renamed  some internal functions to have a leading _ to indicate that
1083         they are private.
1084
1085   0.1.37
1086       · Fix an issue where log were restricted to the named branch (hg).
1087
1088       · Fixed svn to use a global revision number rather than a  branch-local
1089         revision.
1090
1091       · Added  the  get_remote_version()  and get_current_version_label() API
1092         calls.
1093
1094       · Enhanced use of no_warn in run_shell_command().
1095
1096       · Fix get_version() to catch stderr.
1097
1098       · Added get_branches() API call.
1099
1100       · Fix some errors and warnings to output to stderr.
1101
1102       · Fix output to avoid extra newlines when show_stdout=True.
1103
1104   0.1.36
1105       · Updates to the release platforms (-lucid +utopic +vivid)
1106
1107       · Fix an issue with updating branches on git, see vcstools/wstool#25
1108
1109   0.1.31
1110       · Fix submodule support on checkout #71
1111
1112   0.1.30
1113       · use netrc to download tars from private repos,  also  will  work  for
1114         private rosinstall files
1115
1116       · Fix checks for empty repository #62
1117
1118   0.1.29
1119       · fix #57 shallow checkout of non-master breaks with git >= 1.8.0
1120
1121       · unit test fixes
1122
1123   0.1.28
1124       · test of new upload method
1125
1126   0.1.27
1127       · fix #51 hg status and diff dont work if workspace is inside hg repo
1128
1129       · fix  #47  several  performance  improvements  by  removing unecessary
1130         update actions after checkout
1131
1132       · fix #46 https tar download fails behind proxy
1133
1134       · fix #45 sometimes commands run forever
1135
1136       · fix #44 minor bug when checking out from repo with default branch not
1137         master
1138
1139       · fix #41 improvedAPI, get_vcs_client function part of vcstools module
1140
1141   0.1.26
1142       · fix  #38  git  commands  fail in local repositories with many (>2000)
1143         references
1144
1145       · fix #31 get_log() svn xml not available on Ubuntu Lucid (hg 1.4.2)
1146
1147       · fix #37 update() returns True even when fetch failed
1148
1149   0.1.25
1150       · minor bugfixes
1151
1152       · travis-ci config file
1153
1154       · fix unit tests for svn diff&status ordering changes
1155
1156       · deprecated VcsClient Class
1157
1158       · added get_log function
1159
1160   0.1.24
1161       · fix git update return value to False when fast-forward  not  possible
1162         due to diverge
1163
1164       · fix. svn certificate prompt invisible, svn checkout and update become
1165         verbose due to this
1166
1167   0.1.22
1168       · Changed the way that git implements detect_presence to fix a bug with
1169         submodules in newer versions of git
1170
1171       · fix for git single quotes on Windows
1172
1173       · minor internal api bug where a git function always returned True
1174
1175       · fix gub in svn export_repository
1176
1177   0.1.21
1178       · bugfix #66: hg http username prompt hidden
1179
1180       · add export_repository method to vcs_base and all implementations with
1181         tests
1182
1183       · bugfix #64: unicode decoding problems
1184
1185   0.1.20
1186       · rosws update –verbose for git prints small message when rebasing
1187
1188       · improved python3 compatibility
1189
1190   0.1.19
1191       · more python3 compatibility
1192
1193       · code style improved
1194
1195       · match_url to compare bzr shortcuts to real urls
1196
1197       · more unit tests
1198
1199       · get_status required to end with newline, to fix #55
1200
1201   0.1.18
1202       · added shallow flag to API, implemented for git
1203
1204   0.1.17
1205       · svn stdout output on get_version removed
1206
1207   0.1.16
1208       · All SCMs show some output when update caused changes
1209
1210       · All SCMs have verbose option to show all changes done on update
1211
1212       · bugfix for bazaar getUrl() being a joined abspath
1213
1214       · bugfix for not all output being shown when requested
1215
1216   0.1.15
1217       · Added pyyaml as a proper dependency, removed detection code.
1218
1219       · remove use of tar entirely, switch to tarfile module
1220
1221       · fix #36 allowing for tar being bsdtar on OSX
1222
1223   0.1.14
1224       · Added tarball uncompression.
1225
1226   0.1.13
1227       · added this changelog
1228
1229       · git get-version fetches only when local lookup fails
1230
1231       · hg get-version pulls if label not found
1232
1233       · Popen error message incudes cwd path
1234
1235   0.1.12
1236       · py_checker clean after all refactorings since 0.1.0
1237
1238   0.1.11
1239       · svn and hg update without user interaction
1240
1241       · bugfix #30
1242
1243       · minor bugfixes
1244
1245   0.1.10
1246       · minor bugs
1247
1248   0.1.9
1249       · safer sanitization of shell params
1250
1251       · git diff and stat recurse for submodules
1252
1253       · base class manages all calls to Popen
1254
1255   0.1.8
1256       · several bugfixes
1257
1258       · reverted using shell commands instead of bazaar API
1259
1260   0.1.7
1261       · reverted using shell commands instaed of pysvn and mercurial APIs
1262
1263       · protection against shell incection attempts
1264
1265   0.1.6
1266       · bugfixes to svn and bzr
1267
1268       · unified all calls through Popen
1269
1270   0.1.5
1271       · missing dependency to dateutil added
1272
1273   0.1.4
1274       switched shell calls to calls  to  python  API  of  mercurial,  bazaar,
1275       py-svn
1276
1277   0.1.3
1278       · fix #6
1279
1280   0.1.2
1281       · fix #15
1282
1283   0.1.1
1284       · more unit tests
1285
1286       · diverse bugfixes
1287
1288       · major   change   to   git   client   behavior,   based   around   git
1289         https://kforge.ros.org/vcstools/trac/ticket/1
1290
1291   0.1.0
1292       · documentation fixes
1293
1294   0.0.3
1295       · import from svn
1296
1297   Bug reports and feature requests
1298       · Submit a bug report
1299
1300   Developer Setup
1301       vcstools uses setuptools, which you will need to download  and  install
1302       in  order to run the packaging.  We use setuptools instead of distutils
1303       in order to be able use setup() keys like install_requires.
1304          cd vcstools python setup.py develop
1305
1306   Testing
1307       Install test dependencies
1308
1309          pip install nose
1310          pip install mock
1311
1312       vcstools uses Python nose for testing, which is  a  fairly  simple  and
1313       straightfoward  test  framework.   The  vcstools mainly use unittest to
1314       construct test fixtures, but with nose you can also just write a  func‐
1315       tion that starts with the name test and use normal assert statements.
1316
1317       vcstools also uses mock to create mocks for testing.
1318
1319       You can run the tests, including coverage, as follows:
1320
1321          cd vcstools
1322          make test
1323
1324   Documentation
1325       Sphinx  is  used  to provide API documentation for vcstools.  The docu‐
1326       ments are stored in the doc subdirectory.
1327
1328       · genindex
1329
1330       · modindex
1331
1332       · search
1333

AUTHOR

1335       Tully Foote, Thibault Kruse, Ken Conley
1336
1338       2010, Willow Garage
1339
1340
1341
1342
13430.1.40                           Feb 13, 2019                      VCSTOOLS(1)
Impressum