0

I want to call 'svn update' programmatically using Python

I have implemented svn-checkout using the below code and is it is working fine.

cmd = svn_path + ' co ' + repopath + ' ' + directory_path

p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)

stdout, stderr = p.communicate()

For check-out used co command but, couldn't find commands for update the svn repository.

Please help to find the update command.

Vineesh TP
  • 7,755
  • 12
  • 66
  • 130
  • I don't have SVN set up on my machine to test... Perhaps you should just use `up`? Taken from [here](http://svnbook.red-bean.com/en/1.8/svn.ref.svn.c.update.html) – DevOpsFTW Apr 08 '20 at 14:31
  • You could try without python first. `svn update` (or `svn up`, just the same shorter) if you are in the right directory, or `svn up directory_path` from anywhere, either should work. Then just the same from python. – Keldorn Apr 10 '20 at 16:58

1 Answers1

0

These two posts helped me to solve this,

https://www.guyrutenberg.com/2007/10/29/creating-local-svn-repository-home-repository/comment-page-1/

Subprocess changing directory

cmd = svn_path + ' update'
p = subprocess.Popen(cmd,cwd="working direcroty path", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
Vineesh TP
  • 7,755
  • 12
  • 66
  • 130