comparison mercurial/subrepo.py @ 13182:2537bd17421d

subrepo: basic support for status of git subrepos
author Eric Eisner <ede@mit.edu>
date Mon, 20 Dec 2010 13:59:33 -0500
parents 413bef846806
children a8cef95cea88
comparison
equal deleted inserted replaced
13181:413bef846806 13182:2537bd17421d
901 ui.progress(_('archiving (%s)') % relpath, i + 1, 901 ui.progress(_('archiving (%s)') % relpath, i + 1,
902 unit=_('files')) 902 unit=_('files'))
903 ui.progress(_('archiving (%s)') % relpath, None) 903 ui.progress(_('archiving (%s)') % relpath, None)
904 904
905 905
906 def status(self, rev2, **opts):
907 rev1 = self._state[1]
908 modified, added, removed = [], [], []
909 if rev2:
910 command = ['diff-tree', rev1, rev2]
911 else:
912 command = ['diff-index', rev1]
913 out = self._gitcommand(command)
914 for line in out.split('\n'):
915 tab = line.find('\t')
916 if tab == -1:
917 continue
918 status, f = line[tab - 1], line[tab + 1:]
919 if status == 'M':
920 modified.append(f)
921 elif status == 'A':
922 added.append(f)
923 elif status == 'D':
924 removed.append(f)
925
926 deleted = unknown = ignored = clean = []
927 return modified, added, removed, deleted, unknown, ignored, clean
928
906 types = { 929 types = {
907 'hg': hgsubrepo, 930 'hg': hgsubrepo,
908 'svn': svnsubrepo, 931 'svn': svnsubrepo,
909 'git': gitsubrepo, 932 'git': gitsubrepo,
910 } 933 }