Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify "-ib" options in "hg id" call to fix lua error on hg projects #1989

Closed
wants to merge 1 commit into from

Conversation

Shingyx
Copy link

@Shingyx Shingyx commented Dec 14, 2018

"hg id" by itself is not specific enough and appears to only work when the current revision is not tagged and is not on the default branch. When the current revision is on the default branch and isn't the tip, there is a "attempt to concatenate field '?' (a nil value)" error. If the revision was the tip, then the branch would appear as "tip" rather than "(default)".

Also, remove hg related functions which are no longer used.

This resolves #1978 and builds on some of the work done in #1834.

"hg id" by itself is not specific enough and appears to only work when
the current revision is not tagged and is not on the default branch.
When the current revision is on the default branch and isn't the tip,
there is a "attempt to concatenate field '?' (a nil value)" error.
If the revision was the tip, then the branch would appear as "tip"
rather than "(default)".

Also, remove hg related functions which are no longer used.
@Shingyx Shingyx changed the title Specify "-ib" options in "hg id" call Specify "-ib" options in "hg id" call to fix lua error on hg projects Dec 14, 2018
@daxgames
Copy link
Member

@cmderdev/trusted-contributors Can anyone verify this works as stated and does not break anything.

@daxgames
Copy link
Member

@b0bh00d How about you? Can you confirm this works as expected?

@Shingyx
Copy link
Author

Shingyx commented Dec 17, 2018

FWIW, attached is a small hg repo to reproduce this issue - hg-test.zip

And here some output from Cmder 1.3.8.793 and hg 4.8.1
C:\Source\node\hg-test  ([email protected])tip
λ hg log
changeset:   3:f47cc38193e9
tag:         tip
user:        Su-Shing Chen
date:        Fri Dec 14 19:19:25 2018 +1300
summary:     Added tag tag1 for changeset bacc703dc1e5

changeset:   2:164ceb5fd3a3
parent:      0:7bc48d859742
user:        Su-Shing Chen
date:        Fri Dec 14 18:49:49 2018 +1300
summary:     Commit

changeset:   1:bacc703dc1e5
branch:      separate-branch
tag:         tag1
user:        Su-Shing Chen
date:        Fri Dec 14 18:50:59 2018 +1300
summary:     Open branch

changeset:   0:7bc48d859742
user:        Su-Shing Chen
date:        Fri Dec 14 18:48:54 2018 +1300
summary:     Initial commit



C:\Source\node\hg-test  ([email protected])tip
λ hg id
f47cc38193e9 tip

C:\Source\node\hg-test  ([email protected])tip
λ hg id -ib
f47cc38193e9 default

C:\Source\node\hg-test  ([email protected])tip
λ hg update -r 2
0 files updated, 0 files merged, 1 files removed, 0 files unresolved

C:\Users\Shingy\APPLIC~2\CMDER_~1\vendor/clink.lua:339: attempt to concatenate field '?' (a nil value)
C:\Source\node\hg-test>hg id
164ceb5fd3a3

C:\Users\Shingy\APPLIC~2\CMDER_~1\vendor/clink.lua:339: attempt to concatenate field '?' (a nil value)
C:\Source\node\hg-test>hg id -ib
164ceb5fd3a3 default

C:\Users\Shingy\APPLIC~2\CMDER_~1\vendor/clink.lua:339: attempt to concatenate field '?' (a nil value)
C:\Source\node\hg-test>hg update -r 1
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

C:\Source\node\hg-test  ([email protected])(separate-branch)
λ hg id
bacc703dc1e5 (separate-branch) tag1

C:\Source\node\hg-test  ([email protected])(separate-branch)
λ hg id -ib
bacc703dc1e5 separate-branch

C:\Source\node\hg-test  ([email protected])(separate-branch)
λ hg update -r 0
0 files updated, 0 files merged, 1 files removed, 0 files unresolved

C:\Users\Shingy\APPLIC~2\CMDER_~1\vendor/clink.lua:339: attempt to concatenate field '?' (a nil value)
C:\Source\node\hg-test>hg id
7bc48d859742

C:\Users\Shingy\APPLIC~2\CMDER_~1\vendor/clink.lua:339: attempt to concatenate field '?' (a nil value)
C:\Source\node\hg-test>hg id -ib
7bc48d859742 default

C:\Users\Shingy\APPLIC~2\CMDER_~1\vendor/clink.lua:339: attempt to concatenate field '?' (a nil value)
C:\Source\node\hg-test>hg update tip
2 files updated, 0 files merged, 0 files removed, 0 files unresolved

C:\Source\node\hg-test  ([email protected])tip
λ

The above output shows that the current clink.lua expects hg id to print something like bacc703dc1e5 (branch-name), but this isn't the case in all situations.

@Tomalak
Copy link
Contributor

Tomalak commented Dec 20, 2018

It's not exactly the same thing. hg status shows new files (not added to the repository):

> hg status
? test.txt

whereas hg id -ib does not:

> hg id -ib
000000000000 default

only after including the file in the repo, the output changes:

> hg add test.txt
> hg id -ib
000000000000+ default

@Shingyx
Copy link
Author

Shingyx commented Dec 21, 2018

If hg id doesn't give all of the information that hg status provides, then perhaps we should revert #1834 completely. Thoughts on this?

@b0bh00d
Copy link
Contributor

b0bh00d commented Dec 23, 2018 via email

@Shingyx
Copy link
Author

Shingyx commented Dec 28, 2018

If that's the case, then I think adding the -ib options is the correct fix. It would be great if you could investigate this Lua issue when you have time.

@Stanzilla
Copy link
Member

Obsolete now that we merged #2002 right?

@Shingyx
Copy link
Author

Shingyx commented Jan 8, 2019

I guess so, though I don't quite understand why the additional changes were required from my quick test. This PR also deletes code that is no longer used but I'll leave it to you guys to decide what you want to do with that.

Thanks.

@Shingyx Shingyx closed this Jan 8, 2019
@Shingyx Shingyx deleted the hg-fix branch January 8, 2019 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hg_prompt_filter @ clink.lua is broken
5 participants