Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hg-pull-mirror-test2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
heptapod
Testing Projects
hg-pull-mirror-test2
Commits
8029ee2949b8
Commit
8029ee2949b8
authored
19 years ago
by
mpm
Browse files
Options
Downloads
Patches
Plain Diff
Add options to annotate for user/rev/changeset
This eliminates the blame command and makes annotate more flexible.
parent
8cd45e152c83
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hg
+49
-40
49 additions, 40 deletions
hg
with
49 additions
and
40 deletions
hg
+
49
−
40
View file @
8029ee29
...
...
@@ -23,5 +23,7 @@
print
"""
\
commands:
init create a new repository in this directory
add [files...] add the given files in the next commit
addremove add all new files, delete all missing files
annotate [files...] show changeset number per file line
branch <path> create a branch of <path> in this directory
...
...
@@ -27,3 +29,2 @@
branch <path> create a branch of <path> in this directory
merge <path> merge changes from <path> into local repository
checkout [changeset] checkout the latest or given changeset
...
...
@@ -29,6 +30,2 @@
checkout [changeset] checkout the latest or given changeset
status show new, missing, and changed files in working dir
add [files...] add the given files in the next commit
remove [files...] remove the given files in the next commit
addremove add all new files, delete all missing files
commit commit all changes to the repository
...
...
@@ -34,5 +31,4 @@
commit commit all changes to the repository
history show changeset history
log <file> show revision history of a single file
diff [files...] diff working directory (or selected files)
dump <file> [rev] dump the latest or given revision of a file
dumpmanifest [rev] dump the latest or given revision of the manifest
...
...
@@ -37,4 +33,9 @@
dump <file> [rev] dump the latest or given revision of a file
dumpmanifest [rev] dump the latest or given revision of the manifest
diff [files...] diff working directory (or selected files)
history show changeset history
init create a new repository in this directory
log <file> show revision history of a single file
merge <path> merge changes from <path> into local repository
remove [files...] remove the given files in the next commit
status show new, missing, and changed files in working dir
tags show current changeset tags
...
...
@@ -40,6 +41,4 @@
tags show current changeset tags
annotate [files...] show changeset number per file line
blame [files...] show commit user per file line
"""
def
filterfiles
(
list
,
files
):
...
...
@@ -215,4 +214,21 @@
diff
(
args
,
*
revs
)
elif
cmd
==
"
annotate
"
:
bcache
=
{}
def
getnode
(
rev
):
return
hg
.
short
(
repo
.
changelog
.
node
(
rev
))
def
getname
(
rev
):
try
:
return
bcache
[
rev
]
except
KeyError
:
cl
=
repo
.
changelog
.
read
(
repo
.
changelog
.
node
(
rev
))
name
=
cl
[
1
]
f
=
name
.
find
(
'
@
'
)
if
f
>=
0
:
name
=
name
[:
f
]
bcache
[
rev
]
=
name
return
name
aoptions
=
{}
...
...
@@ -218,3 +234,7 @@
aoptions
=
{}
opts
=
[(
'
r
'
,
'
revision
'
,
''
,
'
revision
'
)]
opts
=
[(
'
r
'
,
'
revision
'
,
''
,
'
revision
'
),
(
'
u
'
,
'
user
'
,
None
,
'
show user
'
),
(
'
n
'
,
'
number
'
,
None
,
'
show revision number
'
),
(
'
c
'
,
'
changeset
'
,
None
,
'
show changeset
'
)]
args
=
fancyopts
.
fancyopts
(
args
,
opts
,
aoptions
,
...
...
@@ -220,5 +240,9 @@
args
=
fancyopts
.
fancyopts
(
args
,
opts
,
aoptions
,
'
hg annotate [-r id] [files]
'
)
'
hg annotate [-u] [-c] [-n] [-r id] [files]
'
)
opmap
=
[[
'
user
'
,
getname
],
[
'
number
'
,
str
],
[
'
changeset
'
,
getnode
]]
if
not
aoptions
[
'
user
'
]
and
not
aoptions
[
'
changeset
'
]:
aoptions
[
'
number
'
]
=
1
if
args
:
if
relpath
:
args
=
[
os
.
path
.
join
(
relpath
,
x
)
for
x
in
args
]
...
...
@@ -222,9 +246,8 @@
if
args
:
if
relpath
:
args
=
[
os
.
path
.
join
(
relpath
,
x
)
for
x
in
args
]
node
=
repo
.
current
if
aoptions
[
'
revision
'
]:
node
=
repo
.
changelog
.
lookup
(
aoptions
[
'
revision
'
])
change
=
repo
.
changelog
.
read
(
node
)
mmap
=
repo
.
manifest
.
read
(
change
[
0
])
...
...
@@ -226,6 +249,8 @@
node
=
repo
.
current
if
aoptions
[
'
revision
'
]:
node
=
repo
.
changelog
.
lookup
(
aoptions
[
'
revision
'
])
change
=
repo
.
changelog
.
read
(
node
)
mmap
=
repo
.
manifest
.
read
(
change
[
0
])
maxuserlen
=
0
maxchangelen
=
0
for
f
in
args
:
...
...
@@ -231,4 +256,4 @@
for
f
in
args
:
for
n
,
l
in
repo
.
file
(
f
).
annotate
(
mmap
[
f
])
:
sys
.
stdout
.
write
(
"
% 6s:%s
"
%
(
n
,
l
))
lines
=
repo
.
file
(
f
).
annotate
(
mmap
[
f
])
pieces
=
[]
...
...
@@ -234,28 +259,12 @@
elif
cmd
==
"
blame
"
:
aoptions
=
{}
opts
=
[(
'
r
'
,
'
revision
'
,
''
,
'
revision
'
)]
args
=
fancyopts
.
fancyopts
(
args
,
opts
,
aoptions
,
'
hg blame [-r id] [files]
'
)
if
args
:
bcache
=
{}
node
=
repo
.
current
if
aoptions
[
'
revision
'
]:
node
=
repo
.
changelog
.
lookup
(
aoptions
[
'
revision
'
])
change
=
repo
.
changelog
.
read
(
node
)
mmap
=
repo
.
manifest
.
read
(
change
[
0
])
for
f
in
args
:
for
n
,
l
in
repo
.
file
(
f
).
annotate
(
mmap
[
f
]):
try
:
name
=
bcache
[
n
]
except
KeyError
:
cl
=
repo
.
changelog
.
read
(
repo
.
changelog
.
node
(
n
))
name
=
cl
[
1
]
f
=
name
.
find
(
'
@
'
)
if
f
>=
0
:
name
=
name
[:
f
]
bcache
[
n
]
=
name
sys
.
stdout
.
write
(
"
% 10s:%s
"
%
(
name
,
l
))
for
o
,
f
in
opmap
:
if
aoptions
[
o
]:
l
=
[
f
(
n
)
for
n
,
t
in
lines
]
m
=
max
(
map
(
len
,
l
))
pieces
.
append
([
"
%*s
"
%
(
m
,
x
)
for
x
in
l
])
for
p
,
l
in
zip
(
zip
(
*
pieces
),
lines
):
sys
.
stdout
.
write
(
"
"
.
join
(
p
)
+
"
:
"
+
l
[
1
])
elif
cmd
==
"
export
"
:
node
=
repo
.
lookup
(
args
[
0
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment