long-node.diff

Toshi MARUYAMA, 2013-06-26 17:25

Download (5.22 KB)

View differences:

lib/redmine/scm/adapters/mercurial/redminehelper.py
16 16
:file path: urlencoded, raw string
17 17
:tag name: utf-8
18 18
:branch name: utf-8
19
:node: 12-digits (short) hex string
19
:node: hex string
20 20

  
21 21
Output example of rhsummary::
22 22

  
......
60 60
            return repo.changelog.count() - 1
61 61
    tipctx = repo.changectx(tiprev())
62 62
    ui.write('<tip revision="%d" node="%s"/>\n'
63
             % (tipctx.rev(), _x(node.short(tipctx.node()))))
63
             % (tipctx.rev(), _x(node.hex(tipctx.node()))))
64 64

  
65 65
_SPECIAL_TAGS = ('tip',)
66 66

  
......
74 74
        except error.LookupError:
75 75
            continue
76 76
        ui.write('<tag revision="%d" node="%s" name="%s"/>\n'
77
                 % (r, _x(node.short(n)), _x(t)))
77
                 % (r, _x(node.hex(n)), _x(t)))
78 78

  
79 79
def _branches(ui, repo):
80 80
    # see mercurial/commands.py:branches
......
89 89
    for t, n, r in sorted(iterbranches(), key=lambda e: e[2], reverse=True):
90 90
        if repo.lookup(r) in branchheads(t):
91 91
            ui.write('<branch revision="%d" node="%s" name="%s"/>\n'
92
                     % (r, _x(node.short(n)), _x(t)))
92
                     % (r, _x(node.hex(n)), _x(t)))
93 93

  
94 94
def _manifest(ui, repo, path, rev):
95 95
    ctx = repo.changectx(rev)
......
114 114
            tm, tzoffset = fctx.date()
115 115
            ui.write('<file name="%s" revision="%d" node="%s" '
116 116
                     'time="%d" size="%d"/>\n'
117
                     % (_u(name), fctx.rev(), _x(node.short(fctx.node())),
117
                     % (_u(name), fctx.rev(), _x(node.hex(fctx.node())),
118 118
                        tm, fctx.size(), ))
119 119

  
120 120
    ui.write('</manifest>\n')
lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl
1 1
changeset = 'This template must be used with --debug option\n'
2 2
changeset_quiet =  'This template must be used with --debug option\n'
3 3
changeset_verbose = 'This template must be used with --debug option\n'
4
changeset_debug = '<logentry revision="{rev}" node="{node|short}">\n<author>{author|escape}</author>\n<date>{date|isodatesec}</date>\n<paths>\n{file_mods}{file_adds}{file_dels}{file_copies}</paths>\n<msg>{desc|escape}</msg>\n<parents>\n{parents}</parents>\n</logentry>\n\n'
4
changeset_debug = '<logentry revision="{rev}" node="{node}">\n<author>{author|escape}</author>\n<date>{date|isodatesec}</date>\n<paths>\n{file_mods}{file_adds}{file_dels}{file_copies}</paths>\n<msg>{desc|escape}</msg>\n<parents>\n{parents}</parents>\n</logentry>\n\n'
5 5

  
6 6
file_mod = '<path action="M">{file_mod|urlescape}</path>\n'
7 7
file_add = '<path action="A">{file_add|urlescape}</path>\n'
8 8
file_del = '<path action="D">{file_del|urlescape}</path>\n'
9 9
file_copy = '<path-copied copyfrom-path="{source|urlescape}">{name|urlescape}</path-copied>\n'
10
parent = '<parent>{node|short}</parent>\n'
10
parent = '<parent>{node}</parent>\n'
11 11
header='<?xml version="1.0" encoding="UTF-8" ?>\n<log>\n\n'
12 12
# footer="</log>"
app/models/repository/mercurial.rb
81 81
      cs = changesets.where(:revision => s).first
82 82
    end
83 83
    return cs if cs
84
    changesets.where('scmid LIKE ?', "#{s}%").first
84
    cs = changesets.where(:scmid => s[0, 12]).first
85
    return cs if cs
86
    cs = changesets.where('scmid LIKE ?', "#{s}%").first
87
    return cs if cs
88
    changesets.where('scmid LIKE ?', "#{s[0, 12]}%").first
85 89
  end
86 90

  
87 91
  # Returns the latest changesets for +path+; sorted by revision number
app/models/repository/mercurial.rb
59 59

  
60 60
  # Returns the readable identifier for the given mercurial changeset
61 61
  def self.format_changeset_identifier(changeset)
62
    "#{changeset.revision}:#{changeset.scmid}"
62
    "#{changeset.revision}:#{changeset.scmid[0, 12]}"
63 63
  end
64 64

  
65 65
  # Returns the identifier for the given Mercurial changeset