Changeset 4645 for trunk/GSASIIpath.py
- Timestamp:
- Nov 3, 2020 6:19:08 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIpath.py
r4640 r4645 414 414 if verbose: print(u"Performing svn cleanup at "+fpath) 415 415 cmd = [svn,'cleanup',fpath] 416 if verbose: 417 s = 'subversion command:\n ' 418 for i in cmd: s += i + ' ' 419 print(s) 416 if verbose: showsvncmd(cmd) 420 417 s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE) 421 418 out,err = MakeByte2str(s.communicate()) … … 492 489 print(out) 493 490 491 def showsvncmd(cmd): 492 s = '\nsvn command: ' 493 for i in cmd: s += i + ' ' 494 print(s) 495 494 496 def svnChecksumPatch(svn,fpath,verstr): 495 497 '''This performs a fix when svn cannot finish an update because of … … 501 503 cmd = ['svn','update','--set-depth','empty', 502 504 os.path.join(fpath,'bindist')] 505 showsvncmd(cmd) 503 506 s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE) 504 507 out,err = MakeByte2str(s.communicate()) 505 508 #if err: print('error=',err) 509 cmd = ['svn','switch',g2home+'/trunk/bindist', 510 os.path.join(fpath,'bindist'), 511 '--non-interactive', '--trust-server-cert', '--accept', 512 'theirs-conflict', '--force', '-rHEAD', '--ignore-ancestry'] 513 showsvncmd(cmd) 514 s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE) 515 out,err = MakeByte2str(s.communicate()) 506 516 DownloadG2Binaries(g2home,verbose=True) 507 517 cmd = ['svn','update','--set-depth','infinity', 508 518 os.path.join(fpath,'bindist')] 519 showsvncmd(cmd) 509 520 s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE) 510 521 out,err = MakeByte2str(s.communicate()) … … 516 527 cmd += ['--trust-server-cert'] 517 528 if proxycmds: cmd += proxycmds 518 #print(cmd)529 showsvncmd(cmd) 519 530 s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE) 520 531 out,err = MakeByte2str(s.communicate()) … … 660 671 print ("Files installed at: "+loadpath) 661 672 return True 673 674 def svnGetFileStatus(fpath=os.path.split(__file__)[0],version=None): 675 '''Compare file status to repository (svn status -u) 676 677 :returns: updatecount,modcount,locked where 678 updatecount is the number of files waiting to be updated from 679 repository 680 modcount is the number of files that have been modified locally 681 locked is the number of files tagged as locked 682 ''' 683 import xml.etree.ElementTree as ET 684 svn = whichsvn() 685 if version is not None: 686 vstr = '-r'+str(version) 687 else: 688 vstr = '-rHEAD' 689 cmd = [svn,'st',fpath,'--xml','-u',vstr] 690 if proxycmds: cmd += proxycmds 691 s = subprocess.Popen(cmd, 692 stdout=subprocess.PIPE,stderr=subprocess.PIPE) 693 out,err = MakeByte2str(s.communicate()) 694 if err: 695 print ('out=%s'%out) 696 print ('err=%s'%err) 697 s = '\nsvn command: ' 698 for i in cmd: s += i + ' ' 699 print(s) 700 return None 701 702 locked = 0 703 updatecount = 0 704 modcount = 0 705 x = ET.fromstring(out) 706 for i0 in x.iter('entry'): 707 filename = i0.attrib.get('path','?') 708 wc_rev = '' 709 status = '' 710 switched = '' 711 for i1 in i0.iter('wc-status'): 712 wc_rev = i1.attrib.get('revision','') 713 status = i1.attrib.get('item','') 714 switched = i1.attrib.get('switched','') 715 if i1.attrib.get('wc-locked',''): locked += 1 716 if status == "unversioned": continue 717 if switched == "true": continue 718 if status == "modified": 719 modcount += 1 720 elif status == "normal": 721 updatecount += 1 722 file_rev = '' 723 for i2 in i1.iter('commit'): 724 file_rev = i2.attrib.get('revision','') 725 local_status = '' 726 for i1 in i0.iter('repos-status'): 727 local_status = i1.attrib.get('item','') 728 #print(filename,wc_rev,file_rev,status,local_status,switched) 729 return updatecount,modcount,locked 662 730 663 731 def GetBinaryPrefix():
Note: See TracChangeset
for help on using the changeset viewer.