@@ -87,3 +87,40 @@ def create_repo_from_pip_url(
87
87
return SubversionRepo .from_pip_url (pip_url , ** kwargs )
88
88
else :
89
89
raise InvalidPipURL (pip_url )
90
+
91
+
92
+ def create_repo_legacy (
93
+ url , vcs , progress_callback = None , * args , ** kwargs
94
+ ) -> Union [GitRepo , MercurialRepo , SubversionRepo ]:
95
+ r"""Return a object representation of a VCS repository.
96
+
97
+ Examples
98
+ --------
99
+ >>> from libvcs.shortcuts import create_repo_legacy
100
+ >>>
101
+ >>> r = create_repo(
102
+ ... url='https://www.github.com/you/myrepo',
103
+ ... vcs='git',
104
+ ... repo_dir='/tmp/myrepo'
105
+ ... )
106
+
107
+ >>> r.update_repo()
108
+ |myrepo| (git) Repo directory for myrepo (git) does not exist @ \
109
+ /tmp/myrepo
110
+ |myrepo| (git) Cloning.
111
+ |myrepo| (git) git clone https://www.github.com/tony/myrepo \
112
+ /tmp/myrepo
113
+ Cloning into '/tmp/myrepo'...
114
+ Checking connectivity... done.
115
+ |myrepo| (git) git fetch
116
+ |myrepo| (git) git pull
117
+ Already up-to-date.
118
+ """
119
+ if vcs == "git" :
120
+ return GitRepo (url , progress_callback = progress_callback , * args , ** kwargs )
121
+ elif vcs == "hg" :
122
+ return MercurialRepo (url , progress_callback = progress_callback , * args , ** kwargs )
123
+ elif vcs == "svn" :
124
+ return SubversionRepo (url , progress_callback = progress_callback , * args , ** kwargs )
125
+ else :
126
+ raise InvalidVCS ("VCS %s is not a valid VCS" % vcs )
0 commit comments