##// END OF EJS Templates
subrepo: do not push mercurial subrepos whose store is clean...
Angel Ezquerra -
r18940:798bdb7f default
parent child Browse files
Show More
@@ -14,10 +14,19 b' propertycache = util.propertycache'
14
14
15 nullstate = ('', '', 'empty')
15 nullstate = ('', '', 'empty')
16
16
17 def _expandedabspath(path):
18 '''
19 get a path or url and if it is a path expand it and return an absolute path
20 '''
21 expandedpath = util.urllocalpath(util.expandpath(path))
22 u = util.url(expandedpath)
23 if not u.scheme:
24 path = util.normpath(os.path.abspath(u.path))
25 return path
17
26
18 def _getstorehashcachename(remotepath):
27 def _getstorehashcachename(remotepath):
19 '''get a unique filename for the store hash cache of a remote repository'''
28 '''get a unique filename for the store hash cache of a remote repository'''
20 return util.sha1(remotepath).hexdigest()[0:12]
29 return util.sha1(_expandedabspath(remotepath)).hexdigest()[0:12]
21
30
22 def _calcfilehash(filename):
31 def _calcfilehash(filename):
23 data = ''
32 data = ''
@@ -475,10 +484,10 b' class hgsubrepo(abstractsubrepo):'
475 require a push to a given remote path.'''
484 require a push to a given remote path.'''
476 # sort the files that will be hashed in increasing (likely) file size
485 # sort the files that will be hashed in increasing (likely) file size
477 filelist = ('bookmarks', 'store/phaseroots', 'store/00changelog.i')
486 filelist = ('bookmarks', 'store/phaseroots', 'store/00changelog.i')
478 yield '# %s\n' % remotepath
487 yield '# %s\n' % _expandedabspath(remotepath)
479 for relname in filelist:
488 for relname in filelist:
480 absname = os.path.normpath(self._repo.join(relname))
489 absname = os.path.normpath(self._repo.join(relname))
481 yield '%s = %s\n' % (absname, _calcfilehash(absname))
490 yield '%s = %s\n' % (relname, _calcfilehash(absname))
482
491
483 def _getstorehashcachepath(self, remotepath):
492 def _getstorehashcachepath(self, remotepath):
484 '''get a unique path for the store hash cache'''
493 '''get a unique path for the store hash cache'''
@@ -691,6 +700,12 b' class hgsubrepo(abstractsubrepo):'
691 return False
700 return False
692
701
693 dsturl = _abssource(self._repo, True)
702 dsturl = _abssource(self._repo, True)
703 if not force:
704 if self.storeclean(dsturl):
705 self._repo.ui.status(
706 _('no changes made to subrepo %s since last push to %s\n')
707 % (subrelpath(self), dsturl))
708 return None
694 self._repo.ui.status(_('pushing subrepo %s to %s\n') %
709 self._repo.ui.status(_('pushing subrepo %s to %s\n') %
695 (subrelpath(self), dsturl))
710 (subrelpath(self), dsturl))
696 other = hg.peer(self._repo, {'ssh': ssh}, dsturl)
711 other = hg.peer(self._repo, {'ssh': ssh}, dsturl)
General Comments 0
You need to be logged in to leave comments. Login now