< prev index next >

vcs/src/main/resources/ext.py

Print this page

  6 # published by the Free Software Foundation.
  7 #
  8 # This code is distributed in the hope that it will be useful, but WITHOUT
  9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 10 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 11 # version 2 for more details (a copy is included in the LICENSE file that
 12 # accompanied this code).
 13 #
 14 # You should have received a copy of the GNU General Public License version
 15 # 2 along with this work; if not, write to the Free Software Foundation,
 16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 17 #
 18 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 19 # or visit www.oracle.com if you need additional information or have any
 20 # questions.
 21 
 22 import mercurial
 23 import mercurial.patch
 24 import mercurial.mdiff
 25 import mercurial.util


 26 import difflib
 27 import sys
 28 
 29 # space separated version list
 30 testedwith = '4.9.2 5.0.2'
 31 
 32 def mode(fctx):
 33     flags = fctx.flags()
 34     if flags == '': return '100644'
 35     if flags == 'x': return '100755'
 36     if flags == 'l': return '120000'
 37 
 38 def ratio(a, b, threshold):
 39     s = difflib.SequenceMatcher(None, a, b)
 40     if s.real_quick_ratio() < threshold:
 41         return 0
 42     if s.quick_ratio() < threshold:
 43         return 0
 44     ratio = s.ratio()
 45     if ratio < threshold:

271     if revs == None:
272         revs = "0:tip"
273 
274     for r in revrange(repo, [revs]):
275         ctx = repo[r]
276         __dump_metadata(ctx)
277 
278 @command('ls-tree', [],  'hg ls-tree')
279 def ls_tree(ui, repo, rev, **opts):
280     nullHash = '0' * 40
281     ctx = revsingle(repo, rev)
282     for filename in ctx.manifest():
283         fctx = ctx.filectx(filename)
284         if 'x' in fctx.flags():
285             write('100755 blob ')
286         else:
287             write('100644 blob ')
288         write(nullHash)
289         write('\t')
290         writeln(filename)










  6 # published by the Free Software Foundation.
  7 #
  8 # This code is distributed in the hope that it will be useful, but WITHOUT
  9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 10 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 11 # version 2 for more details (a copy is included in the LICENSE file that
 12 # accompanied this code).
 13 #
 14 # You should have received a copy of the GNU General Public License version
 15 # 2 along with this work; if not, write to the Free Software Foundation,
 16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 17 #
 18 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 19 # or visit www.oracle.com if you need additional information or have any
 20 # questions.
 21 
 22 import mercurial
 23 import mercurial.patch
 24 import mercurial.mdiff
 25 import mercurial.util
 26 import mercurial.hg
 27 import mercurial.node
 28 import difflib
 29 import sys
 30 
 31 # space separated version list
 32 testedwith = '4.9.2 5.0.2'
 33 
 34 def mode(fctx):
 35     flags = fctx.flags()
 36     if flags == '': return '100644'
 37     if flags == 'x': return '100755'
 38     if flags == 'l': return '120000'
 39 
 40 def ratio(a, b, threshold):
 41     s = difflib.SequenceMatcher(None, a, b)
 42     if s.real_quick_ratio() < threshold:
 43         return 0
 44     if s.quick_ratio() < threshold:
 45         return 0
 46     ratio = s.ratio()
 47     if ratio < threshold:

273     if revs == None:
274         revs = "0:tip"
275 
276     for r in revrange(repo, [revs]):
277         ctx = repo[r]
278         __dump_metadata(ctx)
279 
280 @command('ls-tree', [],  'hg ls-tree')
281 def ls_tree(ui, repo, rev, **opts):
282     nullHash = '0' * 40
283     ctx = revsingle(repo, rev)
284     for filename in ctx.manifest():
285         fctx = ctx.filectx(filename)
286         if 'x' in fctx.flags():
287             write('100755 blob ')
288         else:
289             write('100644 blob ')
290         write(nullHash)
291         write('\t')
292         writeln(filename)
293 
294 @command('ls-remote', [],  'hg ls-remote PATH')
295 def ls_remote(ui, repo, path, **opts):
296     peer = mercurial.hg.peer(ui or repo, opts, ui.expandpath(path))
297     for branch, heads in peer.branchmap().iteritems():
298         for head in heads:
299             write(mercurial.node.hex(head))
300             write("\t")
301             writeln(branch)
< prev index next >