##// END OF EJS Templates
identify: avoid a crash when given '-r wdir()'...
Matt Harbison -
r25683:3b1fc406 default
parent child Browse files
Show More
@@ -4064,7 +4064,9 b' def identify(ui, repo, source=None, rev='
4064 if bm:
4064 if bm:
4065 output.append(bm)
4065 output.append(bm)
4066 else:
4066 else:
4067 if not rev:
4067 ctx = scmutil.revsingle(repo, rev, None)
4068
4069 if ctx.rev() is None:
4068 ctx = repo[None]
4070 ctx = repo[None]
4069 parents = ctx.parents()
4071 parents = ctx.parents()
4070 changed = ""
4072 changed = ""
@@ -4079,7 +4081,6 b' def identify(ui, repo, source=None, rev='
4079 output.append("%s%s" %
4081 output.append("%s%s" %
4080 ('+'.join([str(p.rev()) for p in parents]), changed))
4082 ('+'.join([str(p.rev()) for p in parents]), changed))
4081 else:
4083 else:
4082 ctx = scmutil.revsingle(repo, rev)
4083 if default or id:
4084 if default or id:
4084 output = [hexfunc(ctx.node())]
4085 output = [hexfunc(ctx.node())]
4085 if num:
4086 if num:
@@ -47,6 +47,8 b' Setup:'
47 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 $ hg identify
48 $ hg identify
49 acb14030fe0a tip
49 acb14030fe0a tip
50 $ hg identify -r 'wdir()'
51 acb14030fe0a tip
50 $ cacheexists
52 $ cacheexists
51 tag cache exists
53 tag cache exists
52 No fnodes cache because .hgtags file doesn't exist
54 No fnodes cache because .hgtags file doesn't exist
@@ -174,6 +176,8 b' Create a branch:'
174 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
176 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
175 $ hg id
177 $ hg id
176 acb14030fe0a+ first
178 acb14030fe0a+ first
179 $ hg id -r 'wdir()'
180 acb14030fe0a+ first
177 $ hg -v id
181 $ hg -v id
178 acb14030fe0a+ first
182 acb14030fe0a+ first
179 $ hg status
183 $ hg status
General Comments 0
You need to be logged in to leave comments. Login now